timer.h File Reference

This file defines some macros used to perform timing measurements. More...

#include "stopwatch.h"

Go to the source code of this file.

Defines

#define _TIFA_TIMER_H_
#define TIMING_FORMAT   "%8.3f"
#define INIT_NAMED_TIMER(NAME)
#define RESET_NAMED_TIMER(NAME)
#define START_NAMED_TIMER(NAME)
#define STOP_NAMED_TIMER(NAME)
#define GET_NAMED_TIMING(NAME)   get_stopwatch_elapsed(&__TIFA_STOPWATCH_ ##NAME)
#define INIT_TIMER   INIT_NAMED_TIMER()
#define RESET_TIMER   RESET_NAMED_TIMER()
#define START_TIMER   START_NAMED_TIMER()
#define STOP_TIMER   STOP_NAMED_TIMER()
#define GET_TIMING   GET_NAMED_TIMING()


Detailed Description

This file defines some macros used to perform timing measurements.

Author:
Jerome Milan
Date:
Fri Jun 10 2011
Version:
2011-06-10
Warning:
The __TIMING__ symbol should be defined in the file including this header. It is under the responsability of the including file to check for its definition or to define it, if needed.
If __TIMING__ is set to 0, then the macros defined in this file do nothing.

Definition in file timer.h.


Define Documentation

#define _TIFA_TIMER_H_

Standard include guard.

Definition at line 40 of file timer.h.

#define GET_NAMED_TIMING ( NAME   )     get_stopwatch_elapsed(&__TIFA_STOPWATCH_ ##NAME)

Return the timing of the timer named NAME as seconds.

Warning:
The returned result is only meaningful if the timer is not running (i.e. it has been stopped via STOP_NAMED_TIMER).

Definition at line 118 of file timer.h.

#define GET_TIMING   GET_NAMED_TIMING()

Get timing from an unamed timer.

Definition at line 149 of file timer.h.

#define INIT_NAMED_TIMER ( NAME   ) 

Value:

stopwatch_t __TIFA_STOPWATCH_ ##NAME;       \
        init_stopwatch(&__TIFA_STOPWATCH_ ##NAME);
Initialize a timer named NAME.

Warning:
The timer name should not be enclosed in quotes, e.g. INIT_NAMED_TIMER(my_timer) is correct, but INIT_NAMED_TIMER("my_timer") is wrong and will result in a compilation error.
This warning holds for all of the *_NAMED_TIMER macros.

Definition at line 70 of file timer.h.

#define INIT_TIMER   INIT_NAMED_TIMER()

Initialize an unamed timer.

Definition at line 125 of file timer.h.

#define RESET_NAMED_TIMER ( NAME   ) 

Value:

do {                                            \
            reset_stopwatch(&__TIFA_STOPWATCH_ ##NAME); \
        } while (0)
Reset the timer named NAME to zero.

Definition at line 78 of file timer.h.

#define RESET_TIMER   RESET_NAMED_TIMER()

Reset an unamed timer.

Definition at line 131 of file timer.h.

#define START_NAMED_TIMER ( NAME   ) 

Value:

do {                                            \
            start_stopwatch(&__TIFA_STOPWATCH_ ##NAME); \
        } while (0)
Start the timer named NAME.

Note:
Consecutive "calls" to START_NAMED_TIMER are without effect.

Definition at line 89 of file timer.h.

#define START_TIMER   START_NAMED_TIMER()

Start an unamed timer.

Definition at line 137 of file timer.h.

#define STOP_NAMED_TIMER ( NAME   ) 

Value:

do {                                            \
            stop_stopwatch(&__TIFA_STOPWATCH_ ##NAME);  \
        } while (0)
Stop the timer named NAME. Successive "calls" to START_NAMED_TIMER and STOP_NAMED_TIMER are cumulative. In other words, the timer's state holds the time elapsed during all previous time intervals defined by a "call" to START_NAMED_TIMER followed by a "call" to STOP_NAMED_TIMER (provided that the timer was not reset via RESET_NAMED_TIMER).

Note:
Consecutive "calls" to STOP_NAMED_TIMER are without side effects.

Definition at line 106 of file timer.h.

#define STOP_TIMER   STOP_NAMED_TIMER()

Stop an unamed timer.

Definition at line 143 of file timer.h.

#define TIMING_FORMAT   "%8.3f"

Format used to print timing measurements.

Definition at line 57 of file timer.h.


Generated on Fri Jun 17 11:10:12 2011 for TIFA by Doxygen 1.5.5