clar_libgit2_timer.h 792 Bytes
Newer Older
1 2 3 4 5
#ifndef __CLAR_LIBGIT2_TIMER__
#define __CLAR_LIBGIT2_TIMER__

struct cl_perf_timer
{
Dimitris Apostolou committed
6
	/* cumulative running time across all start..stop intervals */
7
	uint64_t sum;
8

9
	/* value of last start..stop interval */
10
	uint64_t last;
11

12
	/* clock value at start */
13
	uint64_t time_started;
14 15 16 17 18 19 20 21 22 23 24 25 26
};

#define CL_PERF_TIMER_INIT {0}

typedef struct cl_perf_timer cl_perf_timer;

void cl_perf_timer__init(cl_perf_timer *t);
void cl_perf_timer__start(cl_perf_timer *t);
void cl_perf_timer__stop(cl_perf_timer *t);

/**
 * return value of last start..stop interval in seconds.
 */
27
uint64_t cl_perf_timer__last(const cl_perf_timer *t);
28 29

/**
Dimitris Apostolou committed
30
 * return cumulative running time across all start..stop
31 32
 * intervals in seconds.
 */
33
uint64_t cl_perf_timer__sum(const cl_perf_timer *t);
34 35

#endif /* __CLAR_LIBGIT2_TIMER__ */