title
Graph Drawing Toolkit

An object-oriented C++ library for handling and drawing graphs

stopwatch.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  stopwatch

Enumerations

enum  time_type { USER_TIME, SYSTEM_TIME, ABSOLUTE_TIME }


Detailed Description

Definition in file stopwatch.h.


Enumeration Type Documentation

enum time_type

The following class implements a stopwatch. You may have more than one stopwatch running without any interference and without any additional computational work. The clock interrupt has a frequency of 100 Hz (this is stated by the macro HZ, in /usr/include/asm/params.h). The value of the clock is stored in the tms_utime field of the struct tms (in the file /usr/include/sys/times.h), and is of type clock_t (a long int defined in /usr/include/bits/types.h). Since a long int has 32 bits (/usr/include/values.h) it follows that the clock should have the same value after 2^32/100 secs, that is 715828 minutes (497 days). Since clock_t is a long int (and not an "unsigned long int") we don't have to worry about when the wrapping occurs. Suppose, for example that you start your stopwatch at MAXLONG and stop it at MINLONG+10, then (MINLONG+10) - MAXLONG = 11 (correct! 11 ticks passed).

EXAMPLE OF USE:

stopwatch* stop = new stopwatch(); stop->start(); ... ... HEAVY OPERATIONS HERE ... cout.form("computational time = %f secs\n",stop->get()); delete(stop);

Enumerator:
USER_TIME 
SYSTEM_TIME 
ABSOLUTE_TIME 

Definition at line 36 of file stopwatch.h.


Generated on Thu Jan 10 14:48:37 2008 for GDToolkit GAPI by  doxygen 1.5.3