summaryrefslogtreecommitdiff
path: root/test/pktmr.cpp
blob: 0ad19106aa8656e8f56caa30f80d2da01e5584ed (plain)
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

#include "../pktmr.h"
#include "../pkmacros.h"

#include <stdint.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
	struct pk_tmr tmr = {};
	uint64_t asdf;
	(void)asdf;
	(void)stdout;
	(void)argc;
	(void)argv;

	// timer
	{
		pk_tmr_start(tmr);
		pk_tmr_stop(tmr);
		PK_LOGV_INF("%s: elapsed time (u64) ns: %llu\n", __FILE__, pk_tmr_duration_u64_nano(tmr));
		PK_LOGV_INF("%s: elapsed time (dbl) ns: %.9f\n", __FILE__, pk_tmr_duration_dbl_nano(tmr));
		PK_LOGV_INF("%s: elapsed time (dbl) μs: %.9f\n", __FILE__, pk_tmr_duration_dbl_micro(tmr));
		PK_LOGV_INF("%s: elapsed time (dbl) ms: %.9f\n", __FILE__, pk_tmr_duration_dbl_mili(tmr));
		PK_LOGV_INF("%s: elapsed time (dbl)  s: %.9f\n", __FILE__, pk_tmr_duration_dbl_scnd(tmr));
	}

	return 0;
}