Changeset 3c039b0
- Timestamp:
- May 4, 2020, 4:20:31 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:
- 61dd73d
- Parents:
- 6502a2b
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r6502a2b r3c039b0 204 204 this.io.submit_q.stats.submit_avg.cnt = 0; 205 205 this.io.completion_q.stats.completed_avg.val = 0; 206 this.io.completion_q.stats.completed_avg.cnt = 0; 206 this.io.completion_q.stats.completed_avg.slow_cnt = 0; 207 this.io.completion_q.stats.completed_avg.fast_cnt = 0; 207 208 #endif 208 209 … … 269 270 "- total submit calls : %llu\n" 270 271 "- avg submit : %lf\n" 271 "- total wait calls : %llu \n"272 "- total wait calls : %llu (%llu slow, %llu fast)\n" 272 273 "- avg completion/wait : %lf\n", 273 274 this.io.submit_q.stats.submit_avg.cnt, 274 275 ((double)this.io.submit_q.stats.submit_avg.val) / this.io.submit_q.stats.submit_avg.cnt, 275 this.io.completion_q.stats.completed_avg.cnt, 276 ((double)this.io.completion_q.stats.completed_avg.val) / this.io.completion_q.stats.completed_avg.cnt 276 this.io.completion_q.stats.completed_avg.slow_cnt + this.io.completion_q.stats.completed_avg.fast_cnt, 277 this.io.completion_q.stats.completed_avg.slow_cnt, this.io.completion_q.stats.completed_avg.fast_cnt, 278 ((double)this.io.completion_q.stats.completed_avg.val) / (this.io.completion_q.stats.completed_avg.slow_cnt + this.io.completion_q.stats.completed_avg.fast_cnt) 277 279 ); 278 280 } … … 326 328 // Nothing was new return 0 327 329 if (head == tail) { 328 #if !defined(__CFA_NO_STATISTICS__)329 ring.completion_q.stats.completed_avg.cnt += 1;330 #endif331 330 return 0; 332 331 } … … 354 353 __atomic_fetch_add( ring.completion_q.head, count, __ATOMIC_RELAXED ); 355 354 356 // Update statistics357 #if !defined(__CFA_NO_STATISTICS__)358 ring.completion_q.stats.completed_avg.val += count;359 ring.completion_q.stats.completed_avg.cnt += 1;360 #endif361 362 355 return count; 363 356 } … … 386 379 // batton pass to the user-thread 387 380 int count = __drain_io( ring, &mask, 1, true ); 381 382 // Update statistics 383 #if !defined(__CFA_NO_STATISTICS__) 384 ring.completion_q.stats.completed_avg.val += count; 385 ring.completion_q.stats.completed_avg.slow_cnt += 1; 386 #endif 387 388 388 if(count > 0) { 389 389 __cfadbg_print_safe(io_core, "Kernel I/O : Moving to ring %p to fast poller\n", &ring); … … 395 395 396 396 //In the naive approach, just poll the io completion queue directly 397 __drain_io( ring, &mask, 1, true ); 397 int count = __drain_io( ring, &mask, 1, true ); 398 399 // Update statistics 400 #if !defined(__CFA_NO_STATISTICS__) 401 ring.completion_q.stats.completed_avg.val += count; 402 ring.completion_q.stats.completed_avg.slow_cnt += 1; 403 #endif 398 404 399 405 #endif … … 416 422 // Drain the io 417 423 this.waiting = false; 418 int ret = __drain_io( *this.ring, 0p, 0, false ); 424 int count = __drain_io( *this.ring, 0p, 0, false ); 425 426 // Update statistics 427 #if !defined(__CFA_NO_STATISTICS__) 428 this.ring->completion_q.stats.completed_avg.val += count; 429 this.ring->completion_q.stats.completed_avg.fast_cnt += 1; 430 #endif 431 419 432 this.waiting = true; 420 if(0 > ret) {433 if(0 > count) { 421 434 // If we got something, just yield and check again 422 435 yield(); -
libcfa/src/concurrency/kernel.hfa
r6502a2b r3c039b0 182 182 struct { 183 183 unsigned long long int val; 184 unsigned long long int cnt; 184 unsigned long long int slow_cnt; 185 unsigned long long int fast_cnt; 185 186 } completed_avg; 186 187 } stats;
Note: See TracChangeset
for help on using the changeset viewer.