Changeset 2073d207
- Timestamp:
- Jun 16, 2020, 1:13:31 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 37ba662
- Parents:
- 8834751
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/readyQ/yield.cfa
r8834751 r2073d207 22 22 volatile unsigned long long global_counter; 23 23 24 thread Yielder {24 thread __attribute__((aligned(64))) Yielder { 25 25 unsigned long long counter; 26 26 }; … … 117 117 run = true; 118 118 119 bool is_tty = isatty(STDOUT_FILENO); 119 120 for(i; nthreads) { 120 121 unpark( threads[i] __cfaabi_dbg_ctx2 ); 121 122 } 122 do{123 for() { 123 124 sleep(500`ms); 124 125 end = getTime(); 125 } while( (end - start) < duration`s ); 126 if( (end - start) >= duration`s ) { 127 break; 128 } 129 if(is_tty) { 130 printf("\r%.4lf", (double)(end - start)`s); 131 fflush(stdout); 132 } 133 } 126 134 127 135 run = false; … … 132 140 133 141 printf("Took %'ld ms\n", (end - start)`ms); 134 printf("Total yields : %'15llu\n", global_counter); 135 printf("yields per second : %'18.2lf\n", ((double)global_counter) / (end - start)`s); 136 printf("ns per yields : %'18.2lf\n", ((double)(end - start)`ns) / global_counter); 142 printf("Total yields : %'15llu\n", global_counter); 143 printf("Yields per procs : %'15llu\n", global_counter / nprocs); 144 printf("Yields per second : %'18.2lf\n", ((double)global_counter) / (end - start)`s); 145 printf("Yields/sec/procs : %'18.2lf\n", (((double)global_counter) / nprocs) / (end - start)`s); 146 printf("ns per yields : %'18.2lf\n", ((double)(end - start)`ns) / global_counter); 147 printf("ns per yields/procs : %'18.2lf\n", ((double)(end - start)`ns) / (global_counter / nprocs)); 148 137 149 } 138 150 }
Note: See TracChangeset
for help on using the changeset viewer.