diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2019-07-12 11:57:48 +0200 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2019-07-12 11:57:48 +0200 |
commit | 69fa20d6babe8f9cad978e55332f21f77f3bc964 (patch) | |
tree | d39967a7db8d1d2a98103721e4ffcd36328730fc /test/monniaux/cycles.h | |
parent | 5d69b44d38730c7112634bf6f815168065ac9aad (diff) | |
download | compcert-kvx-69fa20d6babe8f9cad978e55332f21f77f3bc964.tar.gz compcert-kvx-69fa20d6babe8f9cad978e55332f21f77f3bc964.zip |
(#143) Mesure de cycles sur sandbox
Diffstat (limited to 'test/monniaux/cycles.h')
-rw-r--r-- | test/monniaux/cycles.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/monniaux/cycles.h b/test/monniaux/cycles.h index 4231a34e..f072e479 100644 --- a/test/monniaux/cycles.h +++ b/test/monniaux/cycles.h @@ -1,5 +1,11 @@ +#include <inttypes.h> typedef unsigned long cycle_t; +#ifdef MAX_MEASURES + cycle_t _last_stop = 0; + cycle_t _total_cycles[MAX_MEASURES] = {0}; +#endif + #ifdef __K1C__ #include <../../k1-cos/include/hal/cos_registers.h> @@ -35,3 +41,8 @@ static inline cycle_t get_cycle(void) { static inline cycle_t get_cycle(void) { return 0; } #endif #endif + +#ifdef MAX_MEASURES + #define TIMESTOP(i) {cycle_t cur = get_cycle(); _total_cycles[i] += cur - _last_stop; _last_stop = cur;} + #define TIMEPRINT(n) { for (int i = 0; i <= n; i++) printf("(%d) cycles: %" PRIu64 "\n", i, _total_cycles[i]); } +#endif |