- Timestamp:
- Jun 24, 2020, 1:40:35 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:
- c7816be
- Parents:
- de917da3
- Location:
- libcfa/src/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_queue.cfa
rde917da3 r52769ba 219 219 thrd->link.ts = rdtscl(); 220 220 221 #if defined(BIAS) && !defined(__CFA_NO_STATISTICS__) 222 bool local = false; 223 #endif 224 221 225 // Try to pick a lane and lock it 222 226 unsigned i; … … 234 238 235 239 #if !defined(__CFA_NO_STATISTICS__) 240 local = true; 236 241 __tls_stats()->ready.pick.push.local++; 237 242 #endif … … 241 246 // Use all queues 242 247 i = rhigh; 248 local = false; 243 249 } 244 250 #else … … 276 282 // Update statistics 277 283 #if !defined(__CFA_NO_STATISTICS__) 284 #if defined(BIAS) 285 if( local ) __tls_stats()->ready.pick.push.lsuccess++; 286 #endif 278 287 __tls_stats()->ready.pick.push.success++; 279 288 #endif … … 299 308 unsigned i,j; 300 309 #if defined(BIAS) 310 #if !defined(__CFA_NO_STATISTICS__) 311 bool local = false; 312 #endif 301 313 uint64_t r = __tls_rand(); 302 314 unsigned rlow = r % BIAS; … … 313 325 314 326 #if !defined(__CFA_NO_STATISTICS__) 327 local = true; 315 328 __tls_stats()->ready.pick.pop.local++; 316 329 #endif … … 332 345 // try popping from the 2 picked lists 333 346 struct $thread * thrd = try_pop(cltr, i, j); 334 if(thrd) return thrd; 347 if(thrd) { 348 #if defined(BIAS) && !defined(__CFA_NO_STATISTICS__) 349 if( local ) __tls_stats()->ready.pick.pop.lsuccess++; 350 #endif 351 return thrd; 352 } 335 353 } 336 354 -
libcfa/src/concurrency/stats.cfa
rde917da3 r52769ba 8 8 #if !defined(__CFA_NO_STATISTICS__) 9 9 void __init_stats( struct __stats_t * stats ) { 10 stats->ready.pick.push.attempt = 0; 11 stats->ready.pick.push.success = 0; 12 stats->ready.pick.pop .probe = 0; 13 stats->ready.pick.pop .attempt = 0; 14 stats->ready.pick.pop .local = 0; 15 stats->ready.pick.pop .success = 0; 10 stats->ready.pick.push.attempt = 0; 11 stats->ready.pick.push.success = 0; 12 stats->ready.pick.push.local = 0; 13 stats->ready.pick.push.lsuccess = 0; 14 stats->ready.pick.pop .probe = 0; 15 stats->ready.pick.pop .attempt = 0; 16 stats->ready.pick.pop .success = 0; 17 stats->ready.pick.pop .local = 0; 18 stats->ready.pick.pop .lsuccess = 0; 16 19 stats->ready.sleep.halts = 0; 17 20 stats->ready.sleep.cancels = 0; … … 37 40 38 41 void __tally_stats( struct __stats_t * cltr, struct __stats_t * proc ) { 39 __atomic_fetch_add( &cltr->ready.pick.push.attempt, proc->ready.pick.push.attempt, __ATOMIC_SEQ_CST ); 40 __atomic_fetch_add( &cltr->ready.pick.push.local , proc->ready.pick.push.local , __ATOMIC_SEQ_CST ); 41 __atomic_fetch_add( &cltr->ready.pick.push.success, proc->ready.pick.push.success, __ATOMIC_SEQ_CST ); 42 __atomic_fetch_add( &cltr->ready.pick.pop .probe , proc->ready.pick.pop .probe , __ATOMIC_SEQ_CST ); 43 __atomic_fetch_add( &cltr->ready.pick.pop .attempt, proc->ready.pick.pop .attempt, __ATOMIC_SEQ_CST ); 44 __atomic_fetch_add( &cltr->ready.pick.pop .local , proc->ready.pick.pop .local , __ATOMIC_SEQ_CST ); 45 __atomic_fetch_add( &cltr->ready.pick.pop .success, proc->ready.pick.pop .success, __ATOMIC_SEQ_CST ); 42 __atomic_fetch_add( &cltr->ready.pick.push.attempt , proc->ready.pick.push.attempt , __ATOMIC_SEQ_CST ); 43 __atomic_fetch_add( &cltr->ready.pick.push.success , proc->ready.pick.push.success , __ATOMIC_SEQ_CST ); 44 __atomic_fetch_add( &cltr->ready.pick.push.local , proc->ready.pick.push.local , __ATOMIC_SEQ_CST ); 45 __atomic_fetch_add( &cltr->ready.pick.push.lsuccess, proc->ready.pick.push.lsuccess, __ATOMIC_SEQ_CST ); 46 __atomic_fetch_add( &cltr->ready.pick.pop .probe , proc->ready.pick.pop .probe , __ATOMIC_SEQ_CST ); 47 __atomic_fetch_add( &cltr->ready.pick.pop .attempt , proc->ready.pick.pop .attempt , __ATOMIC_SEQ_CST ); 48 __atomic_fetch_add( &cltr->ready.pick.pop .success , proc->ready.pick.pop .success , __ATOMIC_SEQ_CST ); 49 __atomic_fetch_add( &cltr->ready.pick.pop .local , proc->ready.pick.pop .local , __ATOMIC_SEQ_CST ); 50 __atomic_fetch_add( &cltr->ready.pick.pop .lsuccess, proc->ready.pick.pop .lsuccess, __ATOMIC_SEQ_CST ); 46 51 __atomic_fetch_add( &cltr->ready.sleep.halts , proc->ready.sleep.halts , __ATOMIC_SEQ_CST ); 47 52 __atomic_fetch_add( &cltr->ready.sleep.cancels, proc->ready.sleep.cancels, __ATOMIC_SEQ_CST ); … … 74 79 double pop_len = ((double)ready.pick.pop .attempt) / ready.pick.pop .success; 75 80 81 double lpush_sur = (100.0 * ((double)ready.pick.push.lsuccess) / ready.pick.push.local); 82 double lpop_sur = (100.0 * ((double)ready.pick.pop .lsuccess) / ready.pick.pop .local); 83 84 double lpush_len = ((double)ready.pick.push.local) / ready.pick.push.lsuccess; 85 double lpop_len = ((double)ready.pick.pop .local) / ready.pick.pop .lsuccess; 86 76 87 #if defined(HAVE_LINUX_IO_URING_H) 77 88 double avgrdy = ((double)io.submit_q.submit_avg.rdy) / io.submit_q.submit_avg.cnt; … … 98 109 "- total threads run : %'15lu\n" 99 110 "- total threads scheduled: %'15lu\n" 100 "- push average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts, %'15lu local)\n" 101 "- pop average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts, %'15lu local)\n" 111 "- push average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n" 112 "- pop average probe len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n" 113 "- local push avg prb len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n" 114 "- local pop avg prb len : %'18.2lf, %'18.2lf%% (%'15lu attempts)\n" 102 115 "- Idle Sleep -\n" 103 116 "-- halts : %'15lu\n" … … 123 136 , ready.pick.pop.success 124 137 , ready.pick.push.success 125 , push_len, push_sur, ready.pick.push.attempt, ready.pick.push.local 126 , pop_len , pop_sur , ready.pick.pop .attempt, ready.pick.pop .local 138 , push_len, push_sur, ready.pick.push.attempt 139 , pop_len , pop_sur , ready.pick.pop .attempt 140 , lpush_len, lpush_sur, ready.pick.push.local 141 , lpop_len , lpop_sur , ready.pick.pop .local 127 142 , ready.sleep.halts, ready.sleep.cancels, ready.sleep.wakes, ready.sleep.exits 128 143 #if defined(HAVE_LINUX_IO_URING_H) -
libcfa/src/concurrency/stats.hfa
rde917da3 r52769ba 16 16 volatile uint64_t attempt; 17 17 18 // number of attemps at pushing something something to preferred queues 18 // number of successes at pushing 19 volatile uint64_t success; 20 21 // number of attemps at pushing something to preferred queues 19 22 volatile uint64_t local; 20 23 21 // number of successes at pushing 22 volatile uint64_t success;24 // number of successes at pushing to preferred queues 25 volatile uint64_t lsuccess; 23 26 } push; 24 27 … … 33 36 volatile uint64_t attempt; 34 37 35 // number of attemps at poping something from preferred queues 38 // number of successes at poping 39 volatile uint64_t success; 40 41 // number of attemps at poping something to preferred queues 36 42 volatile uint64_t local; 37 43 38 // number of successes at poping 39 volatile uint64_t success;44 // number of successes at poping to preferred queues 45 volatile uint64_t lsuccess; 40 46 } pop; 41 47 } pick;
Note: See TracChangeset
for help on using the changeset viewer.