Changeset 038be32
- Timestamp:
- Apr 24, 2020, 4:17:33 PM (5 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:
- 44aad8f
- Parents:
- 0ea6c5a
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/readv.cfa
r0ea6c5a r038be32 40 40 41 41 int main(int argc, char * argv[]) { 42 #if !defined(__CFA_NO_STATISTICS__) 43 print_stats_at_exit( *active_cluster() ); 44 #endif 45 42 46 double duration = 5.0; 43 47 unsigned long int nthreads = 2; … … 46 50 printf("Setting local\n"); 47 51 setlocale(LC_NUMERIC, ""); 48 49 52 50 53 arg_loop: -
libcfa/src/concurrency/io.cfa
r0ea6c5a r038be32 177 177 178 178 // Initialize statistics 179 this.io.submit_q.stats.submit_avg.val = 0; 180 this.io.submit_q.stats.submit_avg.cnt = 0; 181 this.io.completion_q.stats.completed_avg.val = 0; 182 this.io.completion_q.stats.completed_avg.cnt = 0; 179 #if !defined(__CFA_NO_STATISTICS__) 180 this.io.submit_q.stats.submit_avg.val = 0; 181 this.io.submit_q.stats.submit_avg.cnt = 0; 182 this.io.completion_q.stats.completed_avg.val = 0; 183 this.io.completion_q.stats.completed_avg.cnt = 0; 184 #endif 183 185 184 186 // Create the poller thread … … 198 200 199 201 // print statistics 200 __cfaabi_bits_print_safe( STDERR_FILENO, 201 "----- I/O uRing Stats -----\n" 202 "- total submit calls : %llu\n" 203 "- avg submit : %lf\n" 204 "- total wait calls : %llu\n" 205 "- avg completion/wait : %lf\n", 206 this.io.submit_q.stats.submit_avg.cnt, 207 ((double)this.io.submit_q.stats.submit_avg.val) / this.io.submit_q.stats.submit_avg.cnt, 208 this.io.completion_q.stats.completed_avg.cnt, 209 ((double)this.io.completion_q.stats.completed_avg.val) / this.io.completion_q.stats.completed_avg.cnt 210 ); 202 #if !defined(__CFA_NO_STATISTICS__) 203 if(this.print_stats) { 204 __cfaabi_bits_print_safe( STDERR_FILENO, 205 "----- I/O uRing Stats -----\n" 206 "- total submit calls : %llu\n" 207 "- avg submit : %lf\n" 208 "- total wait calls : %llu\n" 209 "- avg completion/wait : %lf\n", 210 this.io.submit_q.stats.submit_avg.cnt, 211 ((double)this.io.submit_q.stats.submit_avg.val) / this.io.submit_q.stats.submit_avg.cnt, 212 this.io.completion_q.stats.completed_avg.cnt, 213 ((double)this.io.completion_q.stats.completed_avg.val) / this.io.completion_q.stats.completed_avg.cnt 214 ); 215 } 216 #endif 211 217 212 218 // Shutdown the io rings … … 257 263 // Nothing was new return 0 258 264 if (head == tail) { 259 ring.completion_q.stats.completed_avg.cnt += 1; 265 #if !defined(__CFA_NO_STATISTICS__) 266 ring.completion_q.stats.completed_avg.cnt += 1; 267 #endif 260 268 return 0; 261 269 } … … 282 290 __atomic_fetch_add( ring.completion_q.head, count, __ATOMIC_RELAXED ); 283 291 284 ring.completion_q.stats.completed_avg.val += count; 285 ring.completion_q.stats.completed_avg.cnt += 1; 292 // Update statistics 293 #if !defined(__CFA_NO_STATISTICS__) 294 ring.completion_q.stats.completed_avg.val += count; 295 ring.completion_q.stats.completed_avg.cnt += 1; 296 #endif 286 297 287 298 return count; … … 377 388 } 378 389 379 ring.submit_q.stats.submit_avg.val += 1; 380 ring.submit_q.stats.submit_avg.cnt += 1; 390 // update statistics 391 #if !defined(__CFA_NO_STATISTICS__) 392 ring.submit_q.stats.submit_avg.val += 1; 393 ring.submit_q.stats.submit_avg.cnt += 1; 394 #endif 381 395 382 396 unlock(ring.submit_q.lock); -
libcfa/src/concurrency/kernel.cfa
r0ea6c5a r038be32 257 257 ready_queue{}; 258 258 ready_queue_lock{}; 259 260 #if !defined(__CFA_NO_STATISTICS__) 261 print_stats = false; 262 #endif 259 263 260 264 procs{ __get }; -
libcfa/src/concurrency/kernel.hfa
r0ea6c5a r038be32 147 147 148 148 // Statistics 149 struct {149 #if !defined(__CFA_NO_STATISTICS__) 150 150 struct { 151 unsigned long long int val; 152 unsigned long long int cnt; 153 } submit_avg; 154 } stats; 151 struct { 152 unsigned long long int val; 153 unsigned long long int cnt; 154 } submit_avg; 155 } stats; 156 #endif 155 157 }; 156 158 … … 175 177 176 178 // Statistics 177 struct {179 #if !defined(__CFA_NO_STATISTICS__) 178 180 struct { 179 unsigned long long int val; 180 unsigned long long int cnt; 181 } completed_avg; 182 } stats; 181 struct { 182 unsigned long long int val; 183 unsigned long long int cnt; 184 } completed_avg; 185 } stats; 186 #endif 183 187 }; 184 188 … … 230 234 struct io_ring io; 231 235 #endif 236 237 #if !defined(__CFA_NO_STATISTICS__) 238 bool print_stats; 239 #endif 232 240 }; 233 241 extern Duration default_preemption(); … … 244 252 static inline struct processor * active_processor() { return TL_GET( this_processor ); } // UNSAFE 245 253 static inline struct cluster * active_cluster () { return TL_GET( this_processor )->cltr; } 254 255 #if !defined(__CFA_NO_STATISTICS__) 256 static inline void print_stats_at_exit( cluster & this ) { 257 this.print_stats = true; 258 } 259 #endif 246 260 247 261 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.