Changes in src/benchmark/bench.c [8cb6fcd:17af7d1]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/benchmark/bench.c
r8cb6fcd r17af7d1 4 4 #include <thread> 5 5 6 #include "bench.h" 6 #include <unistd.h> // sysconf 7 #include <sys/times.h> // times 8 #include <time.h> 9 10 inline unsigned long long int Time() { 11 timespec ts; 12 clock_gettime( 13 #if defined( __linux__ ) 14 CLOCK_THREAD_CPUTIME_ID, 15 #elif defined( __freebsd__ ) 16 CLOCK_PROF, 17 #elif defined( __solaris__ ) 18 CLOCK_HIGHRES, 19 #else 20 #error uC++ : internal error, unsupported architecture 21 #endif 22 &ts ); 23 return 1000000000LL * ts.tv_sec + ts.tv_nsec; 24 } // Time 7 25 8 26 //======================================= … … 68 86 //======================================= 69 87 70 coroutine CoroutineDummy {}; 88 struct CoroutineDummy { coroutine_desc __cor; }; 89 DECL_COROUTINE(CoroutineDummy); 71 90 void main(CoroutineDummy * this) {} 72 91 … … 98 117 } 99 118 100 coroutineCoroutineResume {119 struct CoroutineResume { 101 120 int N; 121 coroutine_desc __cor; 102 122 }; 123 124 DECL_COROUTINE(CoroutineResume); 103 125 104 126 void ?{}(CoroutineResume* this, int N) { … … 128 150 //======================================= 129 151 130 thread ThreadDummy {}; 152 struct ThreadDummy { thread_desc __thrd; }; 153 DECL_THREAD(ThreadDummy); 131 154 void main(ThreadDummy * this) {} 132 155 … … 154 177 } 155 178 156 threadContextSwitch {179 struct ContextSwitch { 157 180 int N; 158 181 long long result; 182 thread_desc __thrd; 159 183 }; 184 185 DECL_THREAD(ContextSwitch); 160 186 161 187 void main(ContextSwitch * this) { … … 215 241 DynamicTaskCreateDelete( NoOfTimes ); 216 242 { 217 ContextSwitchdummy = { (int)NoOfTimes }; // context switch243 scoped(ContextSwitch) dummy = { (int)NoOfTimes }; // context switch 218 244 } 219 245 sout | "\t" | endl;
Note: See TracChangeset
for help on using the changeset viewer.