aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/cycles.h
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-07-12 17:39:18 +0200
committerCyril SIX <cyril.six@kalray.eu>2019-07-12 17:39:18 +0200
commit151307bc11cff63a5b026a4a8b0807bb6280b937 (patch)
treeb3ddb2246cbee940f267dc21e87fd359182ca9a3 /test/monniaux/cycles.h
parent5eb05f7f598621f0781900c21a9f210d74651f95 (diff)
downloadcompcert-kvx-151307bc11cff63a5b026a4a8b0807bb6280b937.tar.gz
compcert-kvx-151307bc11cff63a5b026a4a8b0807bb6280b937.zip
(#143) More features
Diffstat (limited to 'test/monniaux/cycles.h')
-rw-r--r--test/monniaux/cycles.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/monniaux/cycles.h b/test/monniaux/cycles.h
index c7978ff4..8012a013 100644
--- a/test/monniaux/cycles.h
+++ b/test/monniaux/cycles.h
@@ -1,9 +1,10 @@
#include <inttypes.h>
+#include <stdio.h>
typedef unsigned long cycle_t;
#ifdef MAX_MEASURES
- cycle_t _last_stop = 0;
- cycle_t _total_cycles[MAX_MEASURES] = {0};
+ static cycle_t _last_stop[MAX_MEASURES] = {0};
+ static cycle_t _total_cycles[MAX_MEASURES] = {0};
#endif
#ifdef __K1C__
@@ -43,7 +44,7 @@ static inline cycle_t get_cycle(void) { return 0; }
#endif
#ifdef MAX_MEASURES
- #define TIMEINIT {_last_stop = get_cycle();}
- #define TIMESTOP(i) {cycle_t cur = get_cycle(); _total_cycles[i] += cur - _last_stop; _last_stop = cur;}
+ #define TIMEINIT(i) {_last_stop[i] = get_cycle();}
+ #define TIMESTOP(i) {cycle_t cur = get_cycle(); _total_cycles[i] += cur - _last_stop[i]; _last_stop[i] = cur;}
#define TIMEPRINT(n) { for (int i = 0; i <= n; i++) printf("(%d) cycles: %" PRIu64 "\n", i, _total_cycles[i]); }
#endif