source: doc/generic_types/evaluation/bench.hpp @ 87c5f40

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 87c5f40 was 87c5f40, checked in by Aaron Moss <a3moss@…>, 5 years ago

Update benchmarks to include stack of pairs

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