source: doc/generic_types/evaluation/bench.h @ 9a9a5c4

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

Final version of the benchmark code

  • Property mode set to 100644
File size: 433 bytes
Line 
1#pragma once
2#include <stdio.h>
3#include <time.h>
4
5long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); }
6
7#define N 40000000
8#define TIMED(name, code) { \
9        volatile clock_t _start, _end; \
10        _start = clock(); \
11        code \
12        _end = clock(); \
13        printf("%s:\t%8ld ms\n", name, ms_between(_start, _end)); \
14}
15#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.