source:
doc/papers/OOPSLA17/evaluation/bench.hpp@
6b00c53
Last change on this file since 6b00c53 was f4e3419d, checked in by , 8 years ago | |
---|---|
|
|
File size: 521 bytes |
Line | |
---|---|
1 | #pragma once |
2 | #include <iomanip> |
3 | #include <iostream> |
4 | #include <time.h> |
5 | |
6 | long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); } |
7 | |
8 | static const int N = 40000000; |
9 | #define TIMED(name, code) { \ |
10 | volatile clock_t _start, _end; \ |
11 | _start = clock(); \ |
12 | code \ |
13 | _end = clock(); \ |
14 | std::cout << name << ":\t" << std::setw(8) << ms_between(_start, _end) \ |
15 | << std::setw(0) << " ms" << std::endl; \ |
16 | } |
17 | #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.