- Timestamp:
- Apr 12, 2021, 5:22:02 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 7f5683e
- Parents:
- fe63ae6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/code/readyQ_proto/dynamic_entropy.hpp
rfe63ae6 ra1b9bc3 33 33 do { 34 34 // Pick the index of a lane 35 i = idx_from_r(tls.rng1.next(), tls.my_queue) ;35 i = idx_from_r(tls.rng1.next(), tls.my_queue).first; 36 36 // i = ret.first; //local = ret.second; 37 37 tls.stats.push.attempt++; … … 48 48 // Pick two lists at random 49 49 unsigned i, j; 50 //bool locali, localj;51 i = idx_from_r(tls.rng2.prev(), tls.my_queue);52 j = idx_from_r(tls.rng2.prev(), tls.my_queue);53 54 // i = reti.first; //local= reti.second;55 // j = retj.first; //local= retj.second;50 bool locali, localj; 51 auto reti = idx_from_r(tls.rng2.prev(), tls.my_queue); 52 auto retj = idx_from_r(tls.rng2.prev(), tls.my_queue); 53 54 i = reti.first; locali = reti.second; 55 j = retj.first; localj = retj.second; 56 56 tls.stats.pop.attempt++; 57 57 … … 108 108 } 109 109 110 inline unsignedidx_from_r(unsigned r, unsigned preferred) {110 inline std::pair<unsigned, bool> idx_from_r(unsigned r, unsigned preferred) { 111 111 unsigned i; 112 //bool local;112 bool local; 113 113 unsigned rlow = r % 4; 114 114 unsigned rhigh = r / 4; … … 117 117 // Use perferred queues 118 118 i = preferred + (rhigh % 4); 119 //local = true;119 local = true; 120 120 } 121 121 else { … … 123 123 // Use all queues 124 124 i = rhigh; 125 //local = false;126 } 127 return i % numLists;125 local = false; 126 } 127 return {i % numLists, local}; 128 128 } 129 129 private: … … 141 141 Random rng1 = { unsigned(std::hash<std::thread::id>{}(std::this_thread::get_id()) ^ rdtscl()) }; 142 142 Random rng2 = { unsigned(std::hash<std::thread::id>{}(std::this_thread::get_id()) ^ rdtscl()) }; 143 Random rng3 = { unsigned(std::hash<std::thread::id>{}(std::this_thread::get_id()) ^ rdtscl()) }; 143 144 unsigned my_queue = calc_preferred(); 144 145 struct { … … 185 186 } 186 187 187 static void stats_print(std::ostream & os ) {188 static void stats_print(std::ostream & os, double) { 188 189 const auto & global = global_stats; 189 190
Note:
See TracChangeset
for help on using the changeset viewer.