File: clar_libgit2_timer.c

package info (click to toggle)
libgit2 0.25.1%2Breally0.24.6-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 28,512 kB
  • ctags: 15,888
  • sloc: ansic: 153,520; sh: 297; python: 175; makefile: 70; php: 65
file content (31 lines) | stat: -rw-r--r-- 531 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "clar_libgit2.h"
#include "clar_libgit2_timer.h"
#include "buffer.h"

void cl_perf_timer__init(cl_perf_timer *t)
{
	memset(t, 0, sizeof(cl_perf_timer));
}

void cl_perf_timer__start(cl_perf_timer *t)
{
	t->time_started = git__timer();
}

void cl_perf_timer__stop(cl_perf_timer *t)
{
	double time_now = git__timer();

	t->last = time_now - t->time_started;
	t->sum += t->last;
}

double cl_perf_timer__last(const cl_perf_timer *t)
{
	return t->last;
}

double cl_perf_timer__sum(const cl_perf_timer *t)
{
	return t->sum;
}