Changeset a381b46 for doc/generic_types/evaluation/bench.h
- Timestamp:
- Apr 15, 2017, 7:09:59 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- c57d1935
- Parents:
- 308880c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/bench.h
r308880c ra381b46 1 1 #pragma once 2 3 2 #include <stdio.h> 4 3 #include <time.h> 5 4 6 #ifndef N 5 long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); } 6 7 7 #define N 40000000 8 #endif9 10 long ms_between(clock_t start, clock_t end) {11 return (end - start) / (CLOCKS_PER_SEC / 1000);12 }13 14 8 #define TIMED(name, code) { \ 15 9 volatile clock_t _start, _end; \ … … 19 13 printf("%s:\t%8ld ms\n", name, ms_between(_start, _end)); \ 20 14 } 21 22 15 #define REPEAT_N_TIMED(name, n, code) TIMED( name, for (int _i = 0; _i < n; ++_i) { code } ) 23 24 16 #define REPEAT_TIMED(name, code) REPEAT_N_TIMED(name, N, code)
Note: See TracChangeset
for help on using the changeset viewer.