source: src/benchmark/bench.h@ dc2334c

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 dc2334c was dbe7756, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

bench.h now compiles in C and C++

  • Property mode set to 100644
File size: 632 bytes
Line 
1#pragma once
2
3#ifdef __CFORALL__
4extern "C" {
5#endif
6 #include <unistd.h> // sysconf
7 #include <sys/times.h> // times
8 #include <time.h>
9#ifdef __CFORALL__
10}
11#endif
12
13
14static inline unsigned long long int Time() {
15 struct timespec ts;
16 clock_gettime(
17#if defined( __linux__ )
18 CLOCK_THREAD_CPUTIME_ID,
19#elif defined( __freebsd__ )
20 CLOCK_PROF,
21#elif defined( __solaris__ )
22 CLOCK_HIGHRES,
23#else
24 #error uC++ : internal error, unsupported architecture
25#endif
26 &ts );
27 return 1000000000LL * ts.tv_sec + ts.tv_nsec;
28} // Time
29
30#ifndef N
31#define N 10000000
32#endif
33
34unsigned int default_preemption() {
35 return 0;
36}
Note: See TracBrowser for help on using the repository browser.