ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resnenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change
on this file since 107b01a was
73abe95,
checked in by Thierry Delisle <tdelisle@…>, 6 years ago
|
Replace extension-less headers with .hfa
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | #pragma once |
---|
2 | |
---|
3 | #if defined(__cforall) |
---|
4 | extern "C" { |
---|
5 | #endif |
---|
6 | #include <stdlib.h> |
---|
7 | #include <unistd.h> // sysconf |
---|
8 | #if ! defined(__cforall) |
---|
9 | #include <time.h> |
---|
10 | #include <sys/time.h> |
---|
11 | #else |
---|
12 | } |
---|
13 | #include <time.hfa> |
---|
14 | #endif |
---|
15 | |
---|
16 | |
---|
17 | static inline unsigned long long int bench_time() { |
---|
18 | struct timespec ts; |
---|
19 | clock_gettime( |
---|
20 | #if defined( __linux__ ) |
---|
21 | CLOCK_THREAD_CPUTIME_ID, |
---|
22 | #elif defined( __freebsd__ ) |
---|
23 | CLOCK_PROF, |
---|
24 | #elif defined( __solaris__ ) |
---|
25 | CLOCK_HIGHRES, |
---|
26 | #else |
---|
27 | #error uC++ : internal error, unsupported architecture |
---|
28 | #endif |
---|
29 | &ts ); |
---|
30 | return 1000000000LL * ts.tv_sec + ts.tv_nsec; |
---|
31 | } // Time |
---|
32 | |
---|
33 | #ifndef BENCH_N |
---|
34 | #define BENCH_N 500 //10000000 |
---|
35 | #endif |
---|
36 | |
---|
37 | #define BENCH(statement, output) \ |
---|
38 | size_t n = BENCH_N; \ |
---|
39 | if( argc > 2 ) return 1; \ |
---|
40 | if( argc == 2 ) { \ |
---|
41 | n = atoi(argv[1]); \ |
---|
42 | } \ |
---|
43 | long long int StartTime, EndTime; \ |
---|
44 | StartTime = bench_time(); \ |
---|
45 | statement; \ |
---|
46 | EndTime = bench_time(); \ |
---|
47 | unsigned long long int output = \ |
---|
48 | ( EndTime - StartTime ) / n; |
---|
49 | |
---|
50 | #if defined(__cforall) |
---|
51 | Duration default_preemption() { |
---|
52 | return 0; |
---|
53 | } |
---|
54 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.