ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since 3895b8b5 was
0d10090,
checked in by Aaron Moss <a3moss@…>, 7 years ago
|
Add printing code to benchmark
|
-
Property mode set to
100644
|
File size:
535 bytes
|
Rev | Line | |
---|
[b276be5] | 1 | #pragma once |
---|
| 2 | |
---|
| 3 | #include <iomanip> |
---|
| 4 | #include <iostream> |
---|
| 5 | #include <time.h> |
---|
| 6 | |
---|
[0d10090] | 7 | #ifndef N |
---|
| 8 | static const int N = 40000000; |
---|
| 9 | #endif |
---|
[b276be5] | 10 | |
---|
| 11 | long ms_between(clock_t start, clock_t end) { |
---|
| 12 | return (end - start) / (CLOCKS_PER_SEC / 1000); |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | #define TIMED(name, code) { \ |
---|
| 16 | volatile clock_t _start, _end; \ |
---|
| 17 | _start = clock(); \ |
---|
| 18 | code \ |
---|
| 19 | _end = clock(); \ |
---|
[47535a0d] | 20 | std::cout << name << ":\t" << std::setw(8) << ms_between(_start, _end) << std::setw(0) << " ms" << std::endl; \ |
---|
[b276be5] | 21 | } |
---|
| 22 | |
---|
| 23 | #define REPEAT_TIMED(name, code) TIMED( name, for (int _i = 0; _i < N; ++_i) { code } ) |
---|
Note: See
TracBrowser
for help on using the repository browser.