Changeset 9791ab5 for benchmark/io
- Timestamp:
- Jun 24, 2020, 4:57:42 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:
- 8b58bae
- Parents:
- 564148f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/readv.cfa
r564148f r9791ab5 17 17 #include <time.hfa> 18 18 19 #include "../benchcltr.hfa" 20 19 21 extern bool traceHeapOn(); 20 22 extern ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags); … … 26 28 unsigned long int buflen = 50; 27 29 28 cluster * the_cluster; 29 30 thread Reader {}; 30 thread __attribute__((aligned(128))) Reader {}; 31 31 void ?{}( Reader & this ) { 32 ((thread&)this){ "Reader Thread", *the_cluster }; 33 } 34 35 struct my_processor { 36 processor p; 37 }; 38 39 void ?{}( my_processor & this ) { 40 (this.p){ "I/O Processor", *the_cluster }; 32 ((thread&)this){ "Reader Thread", *the_benchmark_cluster }; 41 33 } 42 34 43 35 void main( Reader & ) { 44 while(!__atomic_load_n(&run, __ATOMIC_RELAXED)) yield(); 36 park( __cfaabi_dbg_ctx ); 37 /* paranoid */ assert( true == __atomic_load_n(&run, __ATOMIC_RELAXED) ); 45 38 46 39 char data[buflen]; … … 153 146 { 154 147 Time start, end; 155 cluster cl = { "IO Cluster", flags }; 156 the_cluster = &cl; 148 BenchCluster cl = { flags }; 157 149 #if !defined(__CFA_NO_STATISTICS__) 158 print_stats_at_exit( cl );150 print_stats_at_exit( cl.self ); 159 151 #endif 160 152 { 161 my_processorprocs[nprocs];153 BenchProc procs[nprocs]; 162 154 { 163 155 Reader threads[nthreads]; 164 156 165 157 printf("Starting\n"); 158 bool is_tty = isatty(STDOUT_FILENO); 166 159 start = getTime(); 167 160 run = true; 168 do { 169 sleep(500`ms); 170 end = getTime(); 171 } while( (end - start) < duration`s ); 161 162 for(i; nthreads) { 163 unpark( threads[i] __cfaabi_dbg_ctx2 ); 164 } 165 wait(duration, start, end, is_tty); 166 172 167 run = false; 173 168 end = getTime(); 174 printf(" Done\n");169 printf("\nDone\n"); 175 170 } 176 171 }
Note: See TracChangeset
for help on using the changeset viewer.