diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-03 08:17:40 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-03 08:17:40 +0100 |
commit | 1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68 (patch) | |
tree | 210ffc156c83f04fb0c61a40b4f9037d7ba8a7e1 /test/monniaux/clock.c | |
parent | 222c9047d61961db9c6b19fed5ca49829223fd33 (diff) | |
parent | 12be46d59a2483a10d77fa8ee67f7e0ca1bd702f (diff) | |
download | compcert-kvx-1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68.tar.gz compcert-kvx-1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68.zip |
Merge branch 'mppa-cse2' of gricad-gitlab.univ-grenoble-alpes.fr:sixcy/CompCert into mppa-work
Diffstat (limited to 'test/monniaux/clock.c')
-rw-r--r-- | test/monniaux/clock.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/monniaux/clock.c b/test/monniaux/clock.c new file mode 100644 index 00000000..fb636667 --- /dev/null +++ b/test/monniaux/clock.c @@ -0,0 +1,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("time cycles: %lu\n", total_clock); +} + +void printerr_total_clock(void) { + fprintf(stderr, "time cycles: %lu\n", total_clock); +} |