Main Page | Class List | File List | Class Members | File Members | Related Pages

stopwatch.h File Reference

Simple portable stopwatch timer implementation. More...

Go to the source code of this file.

Classes

struct  StopWatch

Functions

EXTERN_C_BEGIN LIBGIFT_EXPORT
void 
stopwatch_init (StopWatch *sw)
LIBGIFT_EXPORT void stopwatch_finish (StopWatch *sw)
LIBGIFT_EXPORT StopWatchstopwatch_new (BOOL start)
LIBGIFT_EXPORT void stopwatch_free (StopWatch *sw)
LIBGIFT_EXPORT double stopwatch_free_elapsed (StopWatch *sw)
LIBGIFT_EXPORT void stopwatch_start (StopWatch *sw)
LIBGIFT_EXPORT void stopwatch_stop (StopWatch *sw)
LIBGIFT_EXPORT double stopwatch_elapsed (StopWatch *sw, unsigned long *msec)


Detailed Description

Simple portable stopwatch timer implementation.

Calculates the elapsed time between calls.


Function Documentation

LIBGIFT_EXPORT double stopwatch_elapsed StopWatch sw,
unsigned long *  msec
 

Calculate the amount of time elapsed between start and stop. If the timer is currently active, the time up until this call is calculated.

Parameters:
sw 
msec Storage location to put number of microseconds.
Return values:
Total elapsed time in seconds (with millisecond precision).

LIBGIFT_EXPORT void stopwatch_finish StopWatch sw  ) 
 

Release usage of the previously initialized StopWatch object. This will not free the memory pointed to by sw, as that will be left up to the caller. See stopwatch_init for this interfaces constructor.

LIBGIFT_EXPORT void stopwatch_free StopWatch sw  ) 
 

Unallocate all memory associated with the StopWatch object. See stopwatch_finish.

LIBGIFT_EXPORT double stopwatch_free_elapsed StopWatch sw  ) 
 

Helper identical to calling stopwatch_elapsed, and then immediately stopwatch_free. Useful when you want a simple single execution timer instance.

EXTERN_C_BEGIN LIBGIFT_EXPORT void stopwatch_init StopWatch sw  ) 
 

Alternate interface for initializing a previously allocated StopWatch object. The suggested usage of this interface is:

StopWatch sw; stopwatch_init (&sw, ...); stopwatch_finish (&sw);

Parameters:
sw Pointer to a previously allocated StopWatch object.

LIBGIFT_EXPORT StopWatch* stopwatch_new BOOL  start  ) 
 

Allocate a new StopWatch object. See stopwatch_init.

Parameters:
start If TRUE, automatically start the timer with stopwatch_start.

LIBGIFT_EXPORT void stopwatch_start StopWatch sw  ) 
 

Start the timer.

LIBGIFT_EXPORT void stopwatch_stop StopWatch sw  ) 
 

Stop the timer.


Generated on Sun Aug 22 08:07:11 2004 by doxygen 1.3.7