Changeset f1dd17a
- Timestamp:
- Oct 24, 2017, 5:46:09 PM (7 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:
- 034165a, 15e4e22
- Parents:
- af98d27
- Location:
- src/benchmark
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/benchmark/CorCtxSwitch.c
raf98d27 rf1dd17a 7 7 coroutine GreatSuspender {}; 8 8 9 void ?{}( GreatSuspender *this ) {9 void ?{}( GreatSuspender & this ) { 10 10 prime(this); 11 11 } 12 12 13 void main( GreatSuspender *this )13 void main( GreatSuspender & this ) 14 14 { 15 15 while( true ) { … … 18 18 } 19 19 20 void resumer( GreatSuspender *this, const unsigned int NoOfTimes ) {20 void resumer( GreatSuspender & this, const unsigned int NoOfTimes ) { 21 21 for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) { 22 22 resume( this ); … … 31 31 32 32 StartTime = Time(); 33 resumer( &s, NoOfTimes );33 resumer( s, NoOfTimes ); 34 34 EndTime = Time(); 35 35 -
src/benchmark/PthrdCtxSwitch.c
raf98d27 rf1dd17a 1 1 #include <stdio.h> 2 2 #include <stdlib.h> 3 #define _GNU_SOURCE 4 #include < pthread.h>3 4 #include <sched.h> 5 5 6 6 #include "bench.h" … … 12 12 StartTime = Time(); 13 13 for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) { 14 pthread_yield();14 sched_yield(); 15 15 } 16 16 EndTime = Time();
Note: See TracChangeset
for help on using the changeset viewer.