30#define TEST_OMIT_VARIABLES
40perf_ts_sub(
struct timespec *a,
struct timespec *b,
struct timespec *res)
42 res->tv_sec = a->tv_sec - b->tv_sec;
43 res->tv_nsec = a->tv_nsec - b->tv_nsec;
44 if (res->tv_nsec < 0) {
46 res->tv_nsec += 1000000000;
51perf_ts_mark_print(
const char *str)
55 clock_gettime(CLOCK_MONOTONIC, &ts);
57 printf(
"%lu.%.9lu: %s\n", ts.tv_sec, ts.tv_nsec, str);
61perf_ts_slot_print(
struct perf_slot *ps,
const char *str)
63 struct timespec t_res;
65 perf_ts_sub(&ps->
t_end, &ps->t_ini, &t_res);
67 printf(
"%lu.%.9lu: %s (%lu.%.9lu sec)\n",
69 str, t_res.tv_sec, t_res.tv_nsec);
72#define perf_ts_slot_start(ps) clock_gettime(CLOCK_MONOTONIC, &((ps)->t_ini))
73#define perf_ts_slot_stop(ps) clock_gettime(CLOCK_MONOTONIC, &((ps)->t_end))
#define DPKG_BEGIN_DECLS
Definition macros.h:164
#define DPKG_END_DECLS
Definition macros.h:165
struct timespec t_ini t_end
Definition perf.h:36