source: doc/generic_types/evaluation/bench.hpp@ b276be5

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since b276be5 was b276be5, checked in by Aaron Moss <a3moss@…>, 9 years ago

Further updates to benchmarks (new C++ virtual benchmark still slightly broken)

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