Changeset bdfc032 for benchmark/schedint/upp.cc
- Timestamp:
- Feb 4, 2020, 11:35:26 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- eef8dfb
- Parents:
- aefb247 (diff), 4f7b418 (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
-
benchmark/schedint/upp.cc
raefb247 rbdfc032 3 3 #include "bench.h" 4 4 5 int argc;6 char** argv;7 5 volatile int go = 0; 8 6 … … 13 11 cond.signal(); 14 12 } 13 void __attribute__((noinline)) wait() { 14 go = 1; 15 for ( size_t i = 0; i < times; i++ ) { 16 cond.wait(); 17 } 18 } 19 } m; 15 20 16 int __attribute__((noinline)) wait() { 17 go = 1; 21 _Task T { 22 void main() { 23 while ( go == 0 ) { yield(); } // waiter must start first 18 24 BENCH( 19 for ( size_t i = 0; i < n; i++) {20 cond.wait();25 for ( size_t i = 0; i < times; i++ ) { 26 m.call(); 21 27 }, 22 28 result 23 29 ) 24 25 printf("%g\n", result); 26 go = 0; 27 return 0; 30 printf( "%g\n", result ); 28 31 } 29 32 }; 30 33 31 M m; 34 int main( int argc, char * argv[] ) { 35 BENCH_START() 36 T t; 37 m.wait(); 38 } 32 39 33 _Task T { 34 void main() { 35 while(go == 0) { yield(); } 36 while(go == 1) { m.call(); } 37 38 } 39 }; 40 41 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 42 T t; 43 return m.wait(); 44 } 40 // Local Variables: // 41 // tab-width: 4 // 42 // End: //
Note: See TracChangeset
for help on using the changeset viewer.