ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since bff607e was
8cb6fcd,
checked in by Thierry Delisle <tdelisle@…>, 8 years ago
|
Refactored common code into bench.h
|
-
Property mode set to
100644
|
File size:
515 bytes
|
Rev | Line | |
---|
[8cb6fcd] | 1 | #pragma once |
---|
| 2 | |
---|
| 3 | extern "C" { |
---|
| 4 | #include <unistd.h> // sysconf |
---|
| 5 | #include <sys/times.h> // times |
---|
| 6 | #include <time.h> |
---|
| 7 | } |
---|
| 8 | |
---|
| 9 | inline unsigned long long int Time() { |
---|
| 10 | timespec ts; |
---|
| 11 | clock_gettime( |
---|
| 12 | #if defined( __linux__ ) |
---|
| 13 | CLOCK_THREAD_CPUTIME_ID, |
---|
| 14 | #elif defined( __freebsd__ ) |
---|
| 15 | CLOCK_PROF, |
---|
| 16 | #elif defined( __solaris__ ) |
---|
| 17 | CLOCK_HIGHRES, |
---|
| 18 | #else |
---|
| 19 | #error uC++ : internal error, unsupported architecture |
---|
| 20 | #endif |
---|
| 21 | &ts ); |
---|
| 22 | return 1000000000LL * ts.tv_sec + ts.tv_nsec; |
---|
| 23 | } // Time |
---|
| 24 | |
---|
| 25 | #ifndef N |
---|
| 26 | #define N 10000000 |
---|
| 27 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.