aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/clock.c
blob: 300cdc7fcadb837ef8d54424462f51f89034db79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "cycles.h"
#include <stdio.h>

static cycle_t total_clock, last_start;

void clock_start(void) {
  last_start = get_cycle();
}

void clock_stop(void) {
  total_clock += get_cycle() - last_start;
}

cycle_t get_total_clock(void) {
  return total_clock;
}

void print_total_clock(void) {
  printf("cycles: %llu\n", total_clock);
}