source: doc/papers/general/evaluation/bench.hpp @ 8a930c03

Last change on this file since 8a930c03 was 79d4186, checked in by Aaron Moss <a3moss@…>, 7 years ago

Update evaluation code for paper

  • Property mode set to 100644
File size: 539 bytes
RevLine 
[604e76d]1#pragma once
2#include <iomanip>
3#include <iostream>
4#include <time.h>
5
6long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); }
7
[79d4186]8#ifndef N
[604e76d]9static const int N = 40000000;
[79d4186]10#endif
11
[604e76d]12#define TIMED(name, code) { \
13        volatile clock_t _start, _end; \
14        _start = clock(); \
15        code \
16        _end = clock(); \
17        std::cout << name << ":\t" << std::setw(8) << ms_between(_start, _end) \
18                << std::setw(0) << " ms" << std::endl; \
19}
20#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.