Conjecture::CpuTimer Class Reference

#include <CpuTimer.h>

Inheritance diagram for Conjecture::CpuTimer:

Conjecture::Root List of all members.

Detailed Description

microsecond-level timing support

Provides a microsecond level CPU usage timer, for user time, system time, or a combination of both. See also the WallTimer class.

Standard usage is: using namespace Conjecture; CpuTimer timer; // turned on when created. ... cout << "Total microsecond used: " << timer.millitime() << endl;

Features are: timer.stop(); // stop timing so subsequent timing requests all apply to the same time interval timer.start(); // restart the timer from now. timer.print(); // prints out a full summary timer.XtimeY(); // Returns time interval in request units X (seconds if X is empty, otherwise X = 'milli' or 'micro'). Only returns the time for request cpu section Y (both if Y is empty, otherwise Y = 'System' or 'User').


Public Member Functions

const bool & running () const
const struct rusage & reading () const
const struct rusage & start () const
void start ()
 Start the timer (remember current time).
void stop ()
 Stop the timer (remember current time).
unsigned time () const
 Returns the number of seconds between start and stop time.
unsigned timeUser () const
 Returns the number of user seconds between start and stop time.
unsigned timeSystem () const
 Returns the number of system seconds between start and stop time.
unsigned millitime () const
 Returns the number of milliseconds between start and stop time.
unsigned millitimeUser () const
 Returns the number of user milliseconds between start and stop time.
unsigned millitimeSystem () const
 Returns the number of system milliseconds between start and stop time.
unsigned microtime () const
 Returns the number of microseconds between start and stop time.
unsigned microtimeUser () const
 Returns the number of user microseconds between start and stop time.
unsigned microtimeSystem () const
 Returns the number of system microseconds between start and stop time.
void print (ostream &os=cout) const
 Print a description of the time results.
void printSummary (ostream &os=cout) const
 Print a one-line description of the time results.
void printMilliSummary (ostream &os=cout) const
void printMicroSummary (ostream &os=cout) const

Static Public Member Functions

static void test (int argc=0, const char *argv[]=NULL)

Protected Member Functions

void runningIs (const bool &running)
void readingIs (const struct rusage &reading)
void startIs (const struct rusage &start)


The documentation for this class was generated from the following files:
Generated on Mon Jun 12 20:27:18 2006 for Conjecture by  doxygen 1.4.6