]>
Commit | Line | Data |
---|---|---|
9a859ef5 JH |
1 | #ifndef __CLAR_LIBGIT2_TIMER__ |
2 | #define __CLAR_LIBGIT2_TIMER__ | |
3 | ||
9a859ef5 JH |
4 | struct cl_perf_timer |
5 | { | |
6 | /* cummulative running time across all start..stop intervals */ | |
e5cf1c70 | 7 | double sum; |
9a859ef5 | 8 | |
e5cf1c70 JH |
9 | /* value of last start..stop interval */ |
10 | double last; | |
9a859ef5 | 11 | |
e5cf1c70 JH |
12 | /* clock value at start */ |
13 | double time_started; | |
9a859ef5 JH |
14 | }; |
15 | ||
16 | #define CL_PERF_TIMER_INIT {0} | |
17 | ||
9a859ef5 JH |
18 | typedef struct cl_perf_timer cl_perf_timer; |
19 | ||
20 | void cl_perf_timer__init(cl_perf_timer *t); | |
21 | void cl_perf_timer__start(cl_perf_timer *t); | |
22 | void cl_perf_timer__stop(cl_perf_timer *t); | |
23 | ||
24 | /** | |
25 | * return value of last start..stop interval in seconds. | |
26 | */ | |
27 | double cl_perf_timer__last(const cl_perf_timer *t); | |
28 | ||
29 | /** | |
30 | * return cummulative running time across all start..stop | |
31 | * intervals in seconds. | |
32 | */ | |
33 | double cl_perf_timer__sum(const cl_perf_timer *t); | |
34 | ||
35 | #endif /* __CLAR_LIBGIT2_TIMER__ */ |