source: doc/generic_types/evaluation/bench.hpp@ 47535a0d

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 stuck-waitfor-destruct with_gc
Last change on this file since 47535a0d was 47535a0d, checked in by Aaron Moss <a3moss@…>, 9 years ago

Update benchmarks to report peak memory usage

  • Property mode set to 100644
File size: 519 bytes
Line 
1#pragma once
2
3#include <iomanip>
4#include <iostream>
5#include <time.h>
6
7static const int N = 100000000;
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.