Changeset 6250a312 for src/benchmark/bench.c
- Timestamp:
- May 10, 2017, 5:00:47 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 8514fe19, dbfb35d
- Parents:
- 0f9bef3 (diff), 29cf9c8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/benchmark/bench.c
r0f9bef3 r6250a312 4 4 #include <thread> 5 5 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 6 #include "bench.h" 25 7 26 8 //======================================= … … 86 68 //======================================= 87 69 88 struct CoroutineDummy { coroutine_desc __cor; }; 89 DECL_COROUTINE(CoroutineDummy); 70 coroutine CoroutineDummy {}; 90 71 void main(CoroutineDummy * this) {} 91 72 … … 117 98 } 118 99 119 structCoroutineResume {100 coroutine CoroutineResume { 120 101 int N; 121 coroutine_desc __cor;122 102 }; 123 124 DECL_COROUTINE(CoroutineResume);125 103 126 104 void ?{}(CoroutineResume* this, int N) { … … 150 128 //======================================= 151 129 152 struct ThreadDummy { thread_desc __thrd; }; 153 DECL_THREAD(ThreadDummy); 130 thread ThreadDummy {}; 154 131 void main(ThreadDummy * this) {} 155 132 … … 177 154 } 178 155 179 structContextSwitch {156 thread ContextSwitch { 180 157 int N; 181 158 long long result; 182 thread_desc __thrd;183 159 }; 184 185 DECL_THREAD(ContextSwitch);186 160 187 161 void main(ContextSwitch * this) { … … 241 215 DynamicTaskCreateDelete( NoOfTimes ); 242 216 { 243 scoped(ContextSwitch)dummy = { (int)NoOfTimes }; // context switch217 ContextSwitch dummy = { (int)NoOfTimes }; // context switch 244 218 } 245 219 sout | "\t" | endl;
Note: See TracChangeset
for help on using the changeset viewer.