Changeset b7170a64 for src/benchmark/ctxswitch/pthreads.c
- Timestamp:
- Oct 26, 2017, 12:16:10 PM (5 years ago)
- Branches:
- aaron-thesis, arm-eh, 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:
- 6395817
- Parents:
- 4149d9d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/benchmark/ctxswitch/pthreads.c
r4149d9d rb7170a64 6 6 #include "bench.h" 7 7 8 int main() { 9 const unsigned int NoOfTimes = N; 10 long long int StartTime, EndTime; 8 int main(int argc, char* argv[]) { 9 BENCH( 10 for (size_t i = 0; i < n; i++) { 11 sched_yield(); 12 }, 13 result 14 ) 11 15 12 StartTime = Time(); 13 for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) { 14 sched_yield(); 15 } 16 EndTime = Time(); 17 18 printf("%lld\n", ( EndTime - StartTime ) / NoOfTimes ); 16 printf("%llu\n", result); 19 17 }
Note: See TracChangeset
for help on using the changeset viewer.