Changeset ec43cf9
- Timestamp:
- Apr 5, 2021, 7:06:37 PM (2 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 7039ab9, cd59d28
- Parents:
- a5a01faa
- Location:
- libcfa/src/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
ra5a01faa rec43cf9 357 357 break RUNNING; 358 358 case TICKET_UNBLOCK: 359 #if !defined(__CFA_NO_STATISTICS__) 360 __tls_stats()->ready.threads.threads++; 361 #endif 359 362 // This is case 2, the racy case, someone tried to run this thread before it finished blocking 360 363 // In this case, just run it again. … … 370 373 371 374 __cfadbg_print_safe(runtime_core, "Kernel : core %p finished running thread %p\n", this, thrd_dst); 375 376 #if !defined(__CFA_NO_STATISTICS__) 377 __tls_stats()->ready.threads.threads--; 378 #endif 372 379 373 380 /* paranoid */ verify( ! __preemption_enabled() ); … … 432 439 if (thrd->preempted == __NO_PREEMPTION) thrd->state = Ready; 433 440 441 // Dereference the thread now because once we push it, there is not guaranteed it's still valid. 442 struct cluster * cl = thrd->curr_cluster; 443 434 444 ready_schedule_lock(); 435 // Dereference the thread now because once we push it, there is not guaranteed it's still valid.436 struct cluster * cl = thrd->curr_cluster;437 438 445 // push the thread to the cluster ready-queue 439 446 push( cl, thrd ); … … 444 451 __wake_one( cl ); 445 452 ready_schedule_unlock(); 453 454 #if !defined(__CFA_NO_STATISTICS__) 455 if( kernelTLS().this_stats ) { 456 __tls_stats()->ready.threads.threads++; 457 } 458 else { 459 __atomic_fetch_add(&cl->stats->ready.threads.threads, 1, __ATOMIC_RELAXED); 460 } 461 #endif 446 462 447 463 /* paranoid */ verify( ! __preemption_enabled() ); -
libcfa/src/concurrency/stats.cfa
ra5a01faa rec43cf9 23 23 stats->ready.pick.pop .lsuccess = 0; 24 24 stats->ready.threads.migration = 0; 25 stats->ready.threads.threads = 0; 25 26 stats->ready.sleep.halts = 0; 26 27 stats->ready.sleep.cancels = 0; … … 61 62 __atomic_fetch_add( &cltr->ready.pick.pop .lsuccess, proc->ready.pick.pop .lsuccess, __ATOMIC_SEQ_CST ); proc->ready.pick.pop .lsuccess = 0; 62 63 __atomic_fetch_add( &cltr->ready.threads.migration , proc->ready.threads.migration , __ATOMIC_SEQ_CST ); proc->ready.threads.migration = 0; 64 __atomic_fetch_add( &cltr->ready.threads.threads , proc->ready.threads.threads , __ATOMIC_SEQ_CST ); proc->ready.threads.threads = 0; 63 65 __atomic_fetch_add( &cltr->ready.sleep.halts , proc->ready.sleep.halts , __ATOMIC_SEQ_CST ); proc->ready.sleep.halts = 0; 64 66 __atomic_fetch_add( &cltr->ready.sleep.cancels , proc->ready.sleep.cancels , __ATOMIC_SEQ_CST ); proc->ready.sleep.cancels = 0; … … 97 99 __cfaabi_bits_print_safe( STDOUT_FILENO, 98 100 "----- %s \"%s\" (%p) - Ready Q Stats -----\n" 99 "- total threads : %'15" PRIu64 "run, %'15" PRIu64 "schd (%'" PRIu64 "ext, %'" PRIu64 "mig )\n"101 "- total threads : %'15" PRIu64 "run, %'15" PRIu64 "schd (%'" PRIu64 "ext, %'" PRIu64 "mig, %'" PRId64 " )\n" 100 102 "- push avg probe : %'3.2lf, %'3.2lfl (%'15" PRIu64 " attempts, %'15" PRIu64 " locals)\n" 101 103 "- ext avg probe : %'3.2lf, %'3.2lfl (%'15" PRIu64 " attempts, %'15" PRIu64 " locals)\n" … … 106 108 , ready.pick.pop.success 107 109 , ready.pick.push.success + ready.pick.ext.success 108 , ready.pick.ext.success, ready.threads.migration 110 , ready.pick.ext.success, ready.threads.migration, ready.threads.threads 109 111 , push_len, lpush_len, ready.pick.push.attempt, ready.pick.push.local 110 112 , ext_len , lext_len , ready.pick.ext .attempt, ready.pick.ext .local -
libcfa/src/concurrency/stats.hfa
ra5a01faa rec43cf9 68 68 struct { 69 69 volatile uint64_t migration; 70 volatile int64_t threads; // number of threads in the system, includes only local change 70 71 } threads; 71 72 struct {
Note: See TracChangeset
for help on using the changeset viewer.