blob: 7611a2ee25d73b30d4ed76cfab4b3073475872d5 (
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
30
31
32
|
#include "cycles.h"
#include <stdio.h>
static cycle_t total_clock, last_start;
void clock_prepare(void) {
cycle_count_config();
}
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;
}
cycle_t get_current_cycle(void) {
return get_cycle();
}
void print_total_clock(void) {
printf("cycles: %lu\n", total_clock);
}
void printerr_total_clock(void) {
fprintf(stderr, "cycles: %lu\n", total_clock);
}
|