9.0
general documentation
Loading...
Searching...
No Matches
cs_timer.h File Reference
#include "base/cs_defs.h"
Include dependency graph for cs_timer.h:

Go to the source code of this file.

Data Structures

struct  cs_timer_t
struct  cs_timer_counter_t

Macros

#define CS_TIMER_COUNTER_INIT(_t)
#define CS_TIMER_COUNTER_ADD(_res, _c0, _c1)

Functions

double cs_timer_wtime (void)
 Return Wall clock time.
double cs_timer_cpu_time (void)
 Return CPU time.
void cs_timer_cpu_times (double *user_time, double *system_time)
 Return separate user and system CPU times.
cs_timer_t cs_timer_time (void)
 Return a timer's value.
cs_timer_counter_t cs_timer_diff (const cs_timer_t *t0, const cs_timer_t *t1)
 Compute the difference between 2 timers.
static void cs_timer_counter_add_diff (cs_timer_counter_t *tc, const cs_timer_t *t0, const cs_timer_t *t1)
const char * cs_timer_wtime_method (void)
 Return method used to return wall clock time.
const char * cs_timer_cpu_time_method (void)
 Return method used to return CPU time.

Variables

int cs_glob_timer_kernels_flag

Macro Definition Documentation

◆ CS_TIMER_COUNTER_ADD

#define CS_TIMER_COUNTER_ADD ( _res,
_c0,
_c1 )
Value:
(_res.nsec = _c0.nsec + _c1.nsec)

◆ CS_TIMER_COUNTER_INIT

#define CS_TIMER_COUNTER_INIT ( _t)
Value:
(_t.nsec = 0)

Function Documentation

◆ cs_timer_counter_add_diff()

void cs_timer_counter_add_diff ( cs_timer_counter_t * tc,
const cs_timer_t * t0,
const cs_timer_t * t1 )
inlinestatic

◆ cs_timer_cpu_time()

double cs_timer_cpu_time ( void )

Return CPU time.

Note that in the rare case that only the minimal C library clock() method is available (see cs_timer_cpu_time_method()), at least one of the cs_timer_...() functions (possibly this one) must be called upon program start for this function to be used. In addition, in this case, time may "loop" back to 0 every multiple of 2^size_t / CLOCKS_PER_SEC seconds.

Returns
current CPU time usage, or -1 if unable to compute.

◆ cs_timer_cpu_time_method()

const char * cs_timer_cpu_time_method ( void )

Return method used to return CPU time.

Returns
short description of method used to return CPU time.

◆ cs_timer_cpu_times()

void cs_timer_cpu_times ( double * user_time,
double * system_time )

Return separate user and system CPU times.

Note that in the rare case that only the minimal C library clock() method is available, this function will return -1 values.

Parameters
[out]user_timecurrent user CPU usage.
[out]system_timecurrent system CPU usage.

◆ cs_timer_diff()

cs_timer_counter_t cs_timer_diff ( const cs_timer_t * t0,
const cs_timer_t * t1 )

Compute the difference between 2 timers.

Parameters
[in]t0oldest timer value
[in]t1most recent timer value
Returns
last - first timer value.

◆ cs_timer_time()

cs_timer_t cs_timer_time ( void )

Return a timer's value.

Returns
timer structure.

◆ cs_timer_wtime()

double cs_timer_wtime ( void )

Return Wall clock time.

Returns
elapsed time from first call of a function of the cs_timer_...() series, or -1 if unable to compute.

◆ cs_timer_wtime_method()

const char * cs_timer_wtime_method ( void )

Return method used to return wall clock time.

Returns
short description of method used to return wall clock time.

Variable Documentation

◆ cs_glob_timer_kernels_flag

int cs_glob_timer_kernels_flag
extern