source:
doc/papers/OOPSLA17/evaluation/bench.h
@
e782290
Last change on this file since e782290 was f4e3419d, checked in by , 7 years ago | |
---|---|
|
|
File size: 433 bytes |
Rev | Line | |
---|---|---|
[d919f47] | 1 | #pragma once |
[309be81] | 2 | #include <stdio.h> |
3 | #include <time.h> | |
4 | ||
[a381b46] | 5 | long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); } |
[309be81] | 6 | |
[a381b46] | 7 | #define N 40000000 |
[309be81] | 8 | #define TIMED(name, code) { \ |
[b276be5] | 9 | volatile clock_t _start, _end; \ |
[d919f47] | 10 | _start = clock(); \ |
[309be81] | 11 | code \ |
[d919f47] | 12 | _end = clock(); \ |
[47535a0d] | 13 | printf("%s:\t%8ld ms\n", name, ms_between(_start, _end)); \ |
[309be81] | 14 | } |
[c87cd93] | 15 | #define REPEAT_TIMED(name, n, code) TIMED( name, for (int _i = 0; _i < n; ++_i) { code } ) |
Note: See TracBrowser
for help on using the repository browser.