RWTimer man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



RWTimer(3C++)							 RWTimer(3C++)

Name
     RWTimer - Rogue Wave library class

Synopsis
	      #include <rw/timer.h>

	      RWTimer timer;

Description
     This class can measure elapsed CPU (user) time.  The timer has two
     states: running and stopped.  The timer measures the total amount of time
     spent in the "running" state since it was either constructed or reset.
     The timer is put into the "running" state by calling member function
     start().  It is put into the "stopped" state by calling stop(). RWTimer
     uses the system-dpendent function clock() which returns the number of
     "ticks" since it was first called.	 As a result, RWTimer will not be able
     to measure intervals longer than some system-dependent value.  (For
     instance, on several common UNIX systems, this value is just under 36
     minutes.)

Persistence
     None

Example
     This example prints out the amount of CPU time used while looping for 5
     seconds (as measured using class RWTime).

	      #include <rw/timer.h>

	      #include <rw/rwtime.h>
	  #include <rw/rstream.h>
	  main()
	  {RWTimer t;
	   t.start();		      // Start the timer
	   RWTime start;
	   start.now();		      // Record starting time
	   // Loop for 5 seconds:
	   for (RWTime current; current.seconds() - start.seconds() < 5;
		current = RWTime::now())
	   {;}
	   t.stop();		      // Stop the timer
	   cout << t.elapsedTime() << endl;
	   return 0;
	  }

									Page 1

RWTimer(3C++)							 RWTimer(3C++)

     Program output (exact value may differ):

	      5.054945

Public Constructor

	      RWTimer();

     Constructs a new timer.  The timer will not start running until start()
     is called.

Public Member Functions
	      double
	  elapsedTime() const;

     Returns the amount of (CPU) time that has accumulated while the timer was
     in the running state.

	      void
	  reset();

     Resets (and stops) the timer.

	      void
	  start();

     Puts the timer in the "running" state.  Time accumulates while in this
     state.

	      void
	  stop();

     Puts the timer in the "stopped" state.  Time will not accumulate while in
     this state.

									Page 2

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net