Last change
on this file since 562ccf9 was
79d4186,
checked in by Aaron Moss <a3moss@…>, 7 years ago
|
Update evaluation code for paper
|
-
Property mode set to
100644
|
File size:
451 bytes
|
Rev | Line | |
---|
[604e76d] | 1 | #pragma once |
---|
| 2 | #include <stdio.h> |
---|
| 3 | #include <time.h> |
---|
| 4 | |
---|
| 5 | long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); } |
---|
| 6 | |
---|
[79d4186] | 7 | #ifndef N |
---|
[604e76d] | 8 | #define N 40000000 |
---|
[79d4186] | 9 | #endif |
---|
| 10 | |
---|
[604e76d] | 11 | #define TIMED(name, code) { \ |
---|
| 12 | volatile clock_t _start, _end; \ |
---|
| 13 | _start = clock(); \ |
---|
| 14 | code \ |
---|
| 15 | _end = clock(); \ |
---|
| 16 | printf("%s:\t%8ld ms\n", name, ms_between(_start, _end)); \ |
---|
| 17 | } |
---|
| 18 | #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.