- File:
-
- 1 edited
-
libcfa/src/concurrency/ready_queue.cfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_queue.cfa
r8cd5434 r69914cbc 398 398 399 399 if(proc->rdq.target == -1u) { 400 unsigned long long min = ts(lanes.data[proc->rdq.id]); 401 for(int i = 0; i < READYQ_SHARD_FACTOR; i++) { 402 unsigned long long tsc = ts(lanes.data[proc->rdq.id + i]); 403 if(tsc < min) min = tsc; 404 } 405 proc->rdq.cutoff = min; 400 _Static_assert(READYQ_SHARD_FACTOR == 2); 401 unsigned idx1 = proc->rdq.id + 0; 402 unsigned idx2 = proc->rdq.id + 1; 403 unsigned long long tsc1 = ts(lanes.data[idx1]); 404 unsigned long long tsc2 = ts(lanes.data[idx2]); 406 405 proc->rdq.target = __tls_rand() % lanes.count; 406 407 // WARNING: std::min is polymorphic and therefore causes 500% slowdown instead of the expected 2% 408 proc->rdq.cutoff = tsc1 < tsc2 ? tsc1 : tsc2; 407 409 } 408 410 else { … … 552 554 } 553 555 554 static void assign_list(unsigned & value, dlist(processor , processor) & list, unsigned count) {556 static void assign_list(unsigned & value, dlist(processor) & list, unsigned count) { 555 557 processor * it = &list`first; 556 558 for(unsigned i = 0; i < count; i++) { … … 702 704 /* paranoid */ verify( ready_mutate_islocked() ); 703 705 } 704 705 #if !defined(__CFA_NO_STATISTICS__)706 unsigned cnt(const __ready_queue_t & this, unsigned idx) {707 /* paranoid */ verify(this.lanes.count > idx);708 return this.lanes.data[idx].cnt;709 }710 #endif
Note:
See TracChangeset
for help on using the changeset viewer.