uprof-timer

uprof-timer

Synopsis

#define             UPROF_STATIC_TIMER                  (TIMER_SYMBOL,
                                                         PARENT,
                                                         NAME,
                                                         DESCRIPTION,
                                                         PRIV)
#define             UPROF_TIMER                         (TIMER_SYMBOL,
                                                         PARENT,
                                                         NAME,
                                                         DESCRIPTION,
                                                         PRIV)
#define             UPROF_TIMER_START                   (CONTEXT,
                                                         TIMER_SYMBOL)
#define             UPROF_TIMER_STOP                    (CONTEXT,
                                                         TIMER_SYMBOL)
#define             UPROF_RECURSIVE_TIMER_START         (CONTEXT,
                                                         TIMER_SYMBOL)
#define             UPROF_RECURSIVE_TIMER_STOP          (CONTEXT,
                                                         TIMER_SYMBOL)
void                uprof_context_add_timer             (UProfContext *context,
                                                         UProfTimer *timer);

Description

Details

UPROF_STATIC_TIMER()

#define             UPROF_STATIC_TIMER(TIMER_SYMBOL, PARENT, NAME, DESCRIPTION, PRIV)

This can be used to declare a new static timer structure which can then be used with the UPROF_TIMER_START() and UPROF_TIMER_STOP() macros.

TIMER_SYMBOL :

The name of the C symbol to declare

PARENT :

The name of a parent timer (it should really be the name given to the parent, not the C symbol name for the parent)

NAME :

The timer name used for reporting

DESCRIPTION :

A string describing what the timer represents

PRIV :

Optional private data (unsigned long) which you can access if you are generating a very customized report. For example you might put application specific flags here that affect reporting.

UPROF_TIMER()

#define             UPROF_TIMER(TIMER_SYMBOL, PARENT, NAME, DESCRIPTION, PRIV)


UPROF_TIMER_START()

#define             UPROF_TIMER_START(CONTEXT, TIMER_SYMBOL)

Starts the timer timing. It is an error to try and start a timer that is already timing; if you need to do this you should use UPROF_RECURSIVE_TIMER_START() instead.


UPROF_TIMER_STOP()

#define             UPROF_TIMER_STOP(CONTEXT, TIMER_SYMBOL)

Stops the timer timing. It is an error to try and stop a timer that isn't actually timing. It is also an error to use this macro if the timer was started using UPROF_RECURSIVE_TIMER_START(); you should use UPROF_RECURSIVE_TIMER_STOP() instead.


UPROF_RECURSIVE_TIMER_START()

#define             UPROF_RECURSIVE_TIMER_START(CONTEXT, TIMER_SYMBOL)

Starts the timer timing like UPROF_TIMER_START() but with additional guards to allow the timer to be started multiple times, such that UPROF_RECURSIVE_TIMER_STOP() must be called an equal number of times to actually stop it timing.


UPROF_RECURSIVE_TIMER_STOP()

#define             UPROF_RECURSIVE_TIMER_STOP(CONTEXT, TIMER_SYMBOL)

Stops a recursive timer timing. It is an error to try and stop a timer that isn't actually timing. It is also an error to use this macro if the timer was started using UPROF_TIMER_START(); you should use UPROF_TIMER_STOP() instead.


uprof_context_add_timer ()

void                uprof_context_add_timer             (UProfContext *context,
                                                         UProfTimer *timer);

Declares a new uprof timer and associates it with a context. Normally this API isn't used directly because the UPROF_TIMER_START() and UPROF_RECURSIVE_TIMER_START() macros will ensure a timer is added the first time it used.