mightymandel v16

GPU-based Mandelbrot set explorer

stopwatch.h File Reference

(v16)

Stopwatch timers for measuring elapsed time. More...

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

Go to the source code of this file.

Functions

struct stopwatchstopwatch_new ()
 Create a new stopwatch.
void stopwatch_delete (struct stopwatch *t)
 Delete a stopwatch.
void stopwatch_reset (struct stopwatch *t)
 Reset a stopwatch.
void stopwatch_start (struct stopwatch *t)
 Start a stopwatch.
void stopwatch_stop (struct stopwatch *t)
 Stop a stopwatch.
double stopwatch_elapsed (struct stopwatch *t)
 Get the elapsed time of a stopwatch.

Detailed Description

Stopwatch timers for measuring elapsed time.

Typical usage:

struct stopwatch *t = stopwatch_new();
stopwatch_reset(t);
stopwatch_start(t);
do_stuff();
stopwatch_stop(t);
do_other_stuff();
stopwatch_start(t);
do_stuff();
stopwatch_stop(t);
double s = stopwatch_elapsed(t);
stopwatch_delete(t);

Then s contains the elapsed time in seconds for both do_stuff() occasions, not including the time taken for do_other_stuff().

On POSIX, uses clock_gettime(). On Windows, uses QueryPerformanceCounter().

Definition in file stopwatch.h.

Function Documentation

void stopwatch_delete ( struct stopwatch t)

Delete a stopwatch.

Parameters
tThe stopwatch.

Definition at line 135 of file stopwatch.c.

Referenced by poll_delete(), and render_end().

+ Here is the caller graph for this function:

double stopwatch_elapsed ( struct stopwatch t)

Get the elapsed time of a stopwatch.

Parameters
tThe stopwatch.
Returns
The total elapsed time in seconds.

Definition at line 145 of file stopwatch.c.

References stopwatch::elapsed, stopwatch_start(), and stopwatch_stop().

Referenced by main(), poll_ui(), render_calculate(), and render_display().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct stopwatch* stopwatch_new ( )
read

Create a new stopwatch.

Returns
The new stopwatch.

Definition at line 32 of file stopwatch.c.

Referenced by main(), poll_new(), and render_begin().

+ Here is the caller graph for this function:

void stopwatch_reset ( struct stopwatch t)

Reset a stopwatch.

Parameters
tThe stopwatch.

Definition at line 139 of file stopwatch.c.

References stopwatch::elapsed, stopwatch_start(), and stopwatch_stop().

Referenced by main(), poll_set_timeout(), poll_ui(), and render_calculate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void stopwatch_start ( struct stopwatch t)

Start a stopwatch.

Parameters
tThe stopwatch.

Definition at line 36 of file stopwatch.c.

References stopwatch::start.

Referenced by poll_new(), stopwatch_elapsed(), and stopwatch_reset().

+ Here is the caller graph for this function:

void stopwatch_stop ( struct stopwatch t)

Stop a stopwatch.

Parameters
tThe stopwatch.

Definition at line 40 of file stopwatch.c.

References stopwatch::elapsed, stopwatch::start, stopwatch::stop, and time_difference().

Referenced by stopwatch_elapsed(), and stopwatch_reset().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: