Blame tests/clar_libgit2_timer.h
|
Packit |
ae9e2a |
#ifndef __CLAR_LIBGIT2_TIMER__
|
|
Packit |
ae9e2a |
#define __CLAR_LIBGIT2_TIMER__
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
struct cl_perf_timer
|
|
Packit |
ae9e2a |
{
|
|
Packit |
ae9e2a |
/* cummulative running time across all start..stop intervals */
|
|
Packit |
ae9e2a |
double sum;
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
/* value of last start..stop interval */
|
|
Packit |
ae9e2a |
double last;
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
/* clock value at start */
|
|
Packit |
ae9e2a |
double time_started;
|
|
Packit |
ae9e2a |
};
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
#define CL_PERF_TIMER_INIT {0}
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
typedef struct cl_perf_timer cl_perf_timer;
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
void cl_perf_timer__init(cl_perf_timer *t);
|
|
Packit |
ae9e2a |
void cl_perf_timer__start(cl_perf_timer *t);
|
|
Packit |
ae9e2a |
void cl_perf_timer__stop(cl_perf_timer *t);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
/**
|
|
Packit |
ae9e2a |
* return value of last start..stop interval in seconds.
|
|
Packit |
ae9e2a |
*/
|
|
Packit |
ae9e2a |
double cl_perf_timer__last(const cl_perf_timer *t);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
/**
|
|
Packit |
ae9e2a |
* return cummulative running time across all start..stop
|
|
Packit |
ae9e2a |
* intervals in seconds.
|
|
Packit |
ae9e2a |
*/
|
|
Packit |
ae9e2a |
double cl_perf_timer__sum(const cl_perf_timer *t);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
#endif /* __CLAR_LIBGIT2_TIMER__ */
|