Changeset 78ea291 for libcfa/src/concurrency
- Timestamp:
- May 19, 2021, 1:17:05 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d36bac7
- Parents:
- 63f42a8
- Location:
- libcfa/src/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_queue.cfa
r63f42a8 r78ea291 448 448 // If list looks empty retry 449 449 if( is_empty(lane) ) { 450 __STATS( stats.espec++; )451 450 return 0p; 452 451 } … … 454 453 // If we can't get the lock retry 455 454 if( !__atomic_try_acquire(&lane.lock) ) { 456 __STATS( stats.elock++; )457 455 return 0p; 458 456 } … … 461 459 if( is_empty(lane) ) { 462 460 __atomic_unlock(&lane.lock); 463 __STATS( stats.eempty++; )464 461 return 0p; 465 462 } … … 471 468 472 469 /* paranoid */ verify(thrd); 470 /* paranoid */ verify(tsv); 473 471 /* paranoid */ verify(lane.lock); 474 472 -
libcfa/src/concurrency/stats.cfa
r63f42a8 r78ea291 19 19 stats->ready.pop.local .attempt = 0; 20 20 stats->ready.pop.local .success = 0; 21 stats->ready.pop.local .elock = 0;22 stats->ready.pop.local .eempty = 0;23 stats->ready.pop.local .espec = 0;24 21 stats->ready.pop.help .attempt = 0; 25 22 stats->ready.pop.help .success = 0; 26 stats->ready.pop.help .elock = 0;27 stats->ready.pop.help .eempty = 0;28 stats->ready.pop.help .espec = 0;29 23 stats->ready.pop.steal .attempt = 0; 30 24 stats->ready.pop.steal .success = 0; 31 stats->ready.pop.steal .elock = 0;32 stats->ready.pop.steal .eempty = 0;33 stats->ready.pop.steal .espec = 0;34 25 stats->ready.pop.search.attempt = 0; 35 26 stats->ready.pop.search.success = 0; 36 stats->ready.pop.search.elock = 0;37 stats->ready.pop.search.eempty = 0;38 stats->ready.pop.search.espec = 0;39 27 stats->ready.threads.migration = 0; 40 28 stats->ready.threads.extunpark = 0; 41 29 stats->ready.threads.threads = 0; 30 stats->ready.threads.cthreads = 0; 42 31 stats->ready.sleep.halts = 0; 43 32 stats->ready.sleep.cancels = 0; … … 59 48 stats->io.calls.completed = 0; 60 49 stats->io.calls.errors.busy = 0; 61 stats->io.poller.sleeps = 0;62 50 #endif 63 51 … … 87 75 tally_one( &cltr->ready.pop.local .attempt, &proc->ready.pop.local .attempt ); 88 76 tally_one( &cltr->ready.pop.local .success, &proc->ready.pop.local .success ); 89 tally_one( &cltr->ready.pop.local .elock , &proc->ready.pop.local .elock );90 tally_one( &cltr->ready.pop.local .eempty , &proc->ready.pop.local .eempty );91 tally_one( &cltr->ready.pop.local .espec , &proc->ready.pop.local .espec );92 77 tally_one( &cltr->ready.pop.help .attempt, &proc->ready.pop.help .attempt ); 93 78 tally_one( &cltr->ready.pop.help .success, &proc->ready.pop.help .success ); 94 tally_one( &cltr->ready.pop.help .elock , &proc->ready.pop.help .elock );95 tally_one( &cltr->ready.pop.help .eempty , &proc->ready.pop.help .eempty );96 tally_one( &cltr->ready.pop.help .espec , &proc->ready.pop.help .espec );97 79 tally_one( &cltr->ready.pop.steal .attempt, &proc->ready.pop.steal .attempt ); 98 80 tally_one( &cltr->ready.pop.steal .success, &proc->ready.pop.steal .success ); 99 tally_one( &cltr->ready.pop.steal .elock , &proc->ready.pop.steal .elock );100 tally_one( &cltr->ready.pop.steal .eempty , &proc->ready.pop.steal .eempty );101 tally_one( &cltr->ready.pop.steal .espec , &proc->ready.pop.steal .espec );102 81 tally_one( &cltr->ready.pop.search.attempt, &proc->ready.pop.search.attempt ); 103 82 tally_one( &cltr->ready.pop.search.success, &proc->ready.pop.search.success ); 104 tally_one( &cltr->ready.pop.search.elock , &proc->ready.pop.search.elock );105 tally_one( &cltr->ready.pop.search.eempty , &proc->ready.pop.search.eempty );106 tally_one( &cltr->ready.pop.search.espec , &proc->ready.pop.search.espec );107 83 tally_one( &cltr->ready.threads.migration , &proc->ready.threads.migration ); 108 84 tally_one( &cltr->ready.threads.extunpark , &proc->ready.threads.extunpark ); 109 85 tally_one( &cltr->ready.threads.threads , &proc->ready.threads.threads ); 86 tally_one( &cltr->ready.threads.cthreads , &proc->ready.threads.cthreads ); 110 87 tally_one( &cltr->ready.sleep.halts , &proc->ready.sleep.halts ); 111 88 tally_one( &cltr->ready.sleep.cancels , &proc->ready.sleep.cancels ); … … 127 104 tally_one( &cltr->io.calls.completed , &proc->io.calls.completed ); 128 105 tally_one( &cltr->io.calls.errors.busy, &proc->io.calls.errors.busy ); 129 tally_one( &cltr->io.poller.sleeps , &proc->io.poller.sleeps );130 106 #endif 131 107 } … … 140 116 if( flags & CFA_STATS_READY_Q ) { 141 117 142 sstr | "----- " | type | " \"" | name | "\" (" | "" | id | "" | ") - Ready Q Stats -----";118 sstr | "----- " | type | " \"" | name | "\" (" | "" | id | "" | ") - Ready Q Stats -----"; 143 119 144 120 uint64_t totalR = ready.pop.local.success + ready.pop.help.success + ready.pop.steal.success + ready.pop.search.success; 145 121 uint64_t totalS = ready.push.local.success + ready.push.share.success + ready.push.extrn.success; 146 sstr | "- totals : " | eng3(totalR) | "run," | eng3(totalS) | "schd (" | eng3(ready.push.extrn.success) | "ext," | eng3(ready.threads.migration) | "mig," | eng3(ready.threads.extunpark) | " eupk)"; 122 sstr | "- totals : " | eng3(totalR) | "run," | eng3(totalS) | "schd (" | eng3(ready.push.extrn.success) | "ext," 123 | eng3(ready.threads.migration) | "mig," | eng3(ready.threads.extunpark) | " eupk," | ready.threads.threads | " t," | ready.threads.cthreads | " cthr)"; 147 124 148 125 double push_len = ((double)ready.push.local.attempt + ready.push.share.attempt + ready.push.extrn.attempt) / totalS; … … 157 134 double rLcl_pc = (100.0 * (double)ready.pop.local .success) / totalR; 158 135 sstr | "- local : " | eng3(ready.pop.local .success) | "-"| ws(3, 3, rLcl_pc) | '%' 159 | " (" | eng3(ready.pop.local .attempt) | " try ," | eng3(ready.pop.local .espec) | " spc," | eng3(ready.pop.local .elock) | " lck," | eng3(ready.pop.local .eempty) | " ept)";136 | " (" | eng3(ready.pop.local .attempt) | " try)"; 160 137 double rHlp_pc = (100.0 * (double)ready.pop.help .success) / totalR; 161 138 sstr | "- help : " | eng3(ready.pop.help .success) | "-"| ws(3, 3, rHlp_pc) | '%' 162 | " (" | eng3(ready.pop.help .attempt) | " try ," | eng3(ready.pop.help .espec) | " spc," | eng3(ready.pop.help .elock) | " lck," | eng3(ready.pop.help .eempty) | " ept)";139 | " (" | eng3(ready.pop.help .attempt) | " try)"; 163 140 double rStl_pc = (100.0 * (double)ready.pop.steal .success) / totalR; 164 141 sstr | "- steal : " | eng3(ready.pop.steal .success) | "-"| ws(3, 3, rStl_pc) | '%' 165 | " (" | eng3(ready.pop.steal .attempt) | " try ," | eng3(ready.pop.steal .espec) | " spc," | eng3(ready.pop.steal .elock) | " lck," | eng3(ready.pop.steal .eempty) | " ept)";142 | " (" | eng3(ready.pop.steal .attempt) | " try)"; 166 143 double rSch_pc = (100.0 * (double)ready.pop.search.success) / totalR; 167 144 sstr | "- search : " | eng3(ready.pop.search.success) | "-"| ws(3, 3, rSch_pc) | '%' 168 | " (" | eng3(ready.pop.search.attempt) | " try ," | eng3(ready.pop.search.espec) | " spc," | eng3(ready.pop.search.elock) | " lck," | eng3(ready.pop.search.eempty) | " ept)";145 | " (" | eng3(ready.pop.search.attempt) | " try)"; 169 146 170 147 sstr | "- Idle Slp : " | eng3(ready.sleep.halts) | "halt," | eng3(ready.sleep.cancels) | "cancel," | eng3(ready.sleep.wakes) | "wake," | eng3(ready.sleep.exits) | "exit"; … … 174 151 #if defined(CFA_HAVE_LINUX_IO_URING_H) 175 152 if( flags & CFA_STATS_IO ) { 176 sstr | "----- " | type | " \"" | name | "\" (" | "" | id | "" | ") - I/O Stats -----";153 sstr | "----- " | type | " \"" | name | "\" (" | "" | id | "" | ") - I/O Stats -----"; 177 154 178 155 uint64_t total_allocs = io.alloc.fast + io.alloc.slow; 179 double avgfasta = (100.0 * (double)io.alloc.fast) / total_allocs;180 sstr | "- total allocations : " | eng3(io.alloc.fast) | "fast," | eng3(io.alloc.slow) | "slow (" | ws(3, 3, avgfasta) | "%)";181 sstr | "- failures : " | eng3(io.alloc.fail) | "oom, " | eng3(io.alloc.revoke) | "rvk, " | eng3(io.alloc.block) | "blk";182 156 183 157 uint64_t total_submits = io.submit.fast + io.submit.slow; 184 double avgfasts = (100.0 * (double)io.submit.fast) / total_submits; 185 sstr | "- total submits : " | eng3(io.submit.fast) | "fast," | eng3(io.submit.slow) | "slow (" | ws(3, 3, avgfasts) | "%)"; 186 sstr | "- flush external : " | eng3(io.flush.external); 187 188 sstr | "- io_uring_enter : " | eng3(io.calls.flush) | " (" | eng3(io.calls.drain) | ", " | eng3(io.calls.errors.busy) | " EBUSY)"; 158 sstr | "- totals : allc" | eng3(io.alloc .fast) | nonl; 159 if(io.alloc.slow) { 160 double avgfasta = (100.0 * (double)io.alloc.fast) / total_allocs; 161 sstr | "fast," | eng3(io.alloc .slow) | "slow (" | ws(3, 3, avgfasta) | "%)" | nonl; 162 } 163 sstr | " - subm" | eng3(io.submit.fast) | nonl; 164 if(io.alloc.slow) { 165 double avgfasts = (100.0 * (double)io.submit.fast) / total_submits; 166 sstr | "fast," | eng3(io.submit.slow) | "slow (" | ws(3, 3, avgfasts) | "%)" | nonl; 167 } 168 sstr | nl; 169 170 if(io.alloc.fail || io.alloc.revoke || io.alloc.block) 171 sstr | "- failures : " | eng3(io.alloc.fail) | "oom, " | eng3(io.alloc.revoke) | "rvk, " | eng3(io.alloc.block) | "blk"; 172 if(io.flush.external) 173 sstr | "- flush external : " | eng3(io.flush.external); 189 174 190 175 double avgsubs = ((double)io.calls.submitted) / io.calls.flush; 191 176 double avgcomp = ((double)io.calls.completed) / io.calls.drain; 192 sstr | "- submits : " | eng3(io.calls.submitted) | "(" | ws(3, 3, avgsubs) | "/flush)";193 sstr | "- completes : " | eng3(io.calls.completed) | "(" | ws(3, 3, avgcomp) | "/drain)";194 195 sstr | "- poller sleeping : " | eng3(io.poller.sleeps);177 sstr | "- syscll : " 178 | " sub " | eng3(io.calls.flush) | "/" | eng3(io.calls.submitted) | "(" | ws(3, 3, avgsubs) | "/flush)" 179 | " - cmp " | eng3(io.calls.drain) | "/" | eng3(io.calls.completed) | "(" | ws(3, 3, avgcomp) | "/drain)" 180 | " - " | eng3(io.calls.errors.busy) | " EBUSY"; 196 181 sstr | nl; 197 182 } -
libcfa/src/concurrency/stats.hfa
r63f42a8 r78ea291 2 2 3 3 // #define CFA_STATS_ARRAY 10000 4 // #define __CFA_NO_STATISTICS__ 4 5 5 6 #include <stdint.h> … … 22 23 // number of successes at poping 23 24 volatile uint64_t success; 24 25 // number of attempts failed due to the lock being held26 volatile uint64_t elock;27 28 // number of attempts failed due to the queue being empty (lock held)29 volatile uint64_t eempty;30 31 // number of attempts failed due to the queue looking empty (lock not held)32 volatile uint64_t espec;33 25 }; 34 26 … … 71 63 volatile uint64_t migration; 72 64 volatile uint64_t extunpark; 73 volatile int64_t threads; // number of threads in the system, includes only local change 65 volatile int64_t threads; // number of threads in the system, includes only local change 66 volatile int64_t cthreads; // number of threads in the system, includes only local change 74 67 } threads; 75 68 struct {
Note: See TracChangeset
for help on using the changeset viewer.