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 2b8bc41 was 604e76d, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago |
initial setup for general and concurrency papers
|
-
Property mode
set to
100644
|
File size:
433 bytes
|
Line | |
---|
1 | #pragma once
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <time.h>
|
---|
4 |
|
---|
5 | long 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.