Changeset a381b46 for doc/generic_types/evaluation/bench.hpp
- 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.hpp
r308880c ra381b46 1 1 #pragma once 2 3 2 #include <iomanip> 4 3 #include <iostream> 5 4 #include <time.h> 6 5 7 #ifndef N 6 long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); } 7 8 8 static const int N = 40000000; 9 #endif10 11 long ms_between(clock_t start, clock_t end) {12 return (end - start) / (CLOCKS_PER_SEC / 1000);13 }14 15 9 #define TIMED(name, code) { \ 16 10 volatile clock_t _start, _end; \ … … 18 12 code \ 19 13 _end = clock(); \ 20 std::cout << name << ":\t" << std::setw(8) << ms_between(_start, _end) << std::setw(0) << " ms" << std::endl; \ 14 std::cout << name << ":\t" << std::setw(8) << ms_between(_start, _end) \ 15 << std::setw(0) << " ms" << std::endl; \ 21 16 } 22 23 17 #define REPEAT_N_TIMED(name, n, code) TIMED( name, for (int _i = 0; _i < n; ++_i) { code } ) 24 25 18 #define REPEAT_TIMED(name, code) REPEAT_N_TIMED(name, N, code)
Note: See TracChangeset
for help on using the changeset viewer.