Swarm-NG  1.1
stopwatch Class Reference

Class for benchmarking cpu & gpu performance. Based on NVIDIA's LinuxStopWatch class. More...

#include <stopwatch.h>

Public Member Functions

void start ()
 Start time measurement.
 
void stop ()
 Stop time measurement and increment add to the current diff_time summation variable. Also increment the number of times this clock has been run.
 
void reset ()
 Reset the timer to 0. Does not change the timer running state but does recapture this point in time as the current start time if it is running.
 
float getTime () const
 Time in sec. after start. If the stop watch is still running (i.e. there was no call to stop()) then the elapsed time is returned added to the current diff_time sum, otherwise the current summed time difference alone is returned.
 
void addTime (const float dt)
 Add dt seconds of time to the counter. Does not increment the number of clock sessions.
 
float getAverageTime () const
 Time in msec. for a single run based on the total number of COMPLETED runs and the total time.
 

Protected Attributes

struct timeval start_time
 Start of measurement.
 
float diff_time
 Time difference between the last start and stop (in ms)
 
float total_time
 TOTAL time difference between starts and stops (in ms)
 
bool running
 flag if the stop watch is running
 
int clock_sessions
 Number of times clock has been started and stopped (for averaging)
 

Detailed Description

Class for benchmarking cpu & gpu performance. Based on NVIDIA's LinuxStopWatch class.

Definition at line 33 of file stopwatch.h.


The documentation for this class was generated from the following file: