diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2019-07-12 12:05:38 +0200 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2019-07-12 12:05:38 +0200 |
commit | c64ea8db135af2d541d56f6bd1ebb689e7915589 (patch) | |
tree | b99ae5fa91f613a85655e6adcba12977b642caae | |
parent | 69fa20d6babe8f9cad978e55332f21f77f3bc964 (diff) | |
download | compcert-kvx-c64ea8db135af2d541d56f6bd1ebb689e7915589.tar.gz compcert-kvx-c64ea8db135af2d541d56f6bd1ebb689e7915589.zip |
(#143) Rajout de la macro TIMEINIT
-rw-r--r-- | test/monniaux/cycles.h | 1 | ||||
-rw-r--r-- | test/monniaux/sandbox/example.c | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/test/monniaux/cycles.h b/test/monniaux/cycles.h index f072e479..c7978ff4 100644 --- a/test/monniaux/cycles.h +++ b/test/monniaux/cycles.h @@ -43,6 +43,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 TIMEPRINT(n) { for (int i = 0; i <= n; i++) printf("(%d) cycles: %" PRIu64 "\n", i, _total_cycles[i]); } #endif diff --git a/test/monniaux/sandbox/example.c b/test/monniaux/sandbox/example.c index 4fec922d..dccb576e 100644 --- a/test/monniaux/sandbox/example.c +++ b/test/monniaux/sandbox/example.c @@ -8,15 +8,15 @@ int main(void){ int i; int S = 0; - TIMESTOP(0) + TIMEINIT for (i = 0; i < 1000; i++){ S += f(i, i*2); } - TIMESTOP(1) + TIMESTOP(0) printf("Final value: %d\n", S); - TIMESTOP(2) + TIMESTOP(1) - TIMEPRINT(2) + TIMEPRINT(1) return 0; } |