Changeset b232745 for doc/theses/thierry_delisle_PhD/code/relaxed_list.cpp
- Timestamp:
- Jun 22, 2020, 4:29:05 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:
- 13c5e19
- Parents:
- 0f89d4f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/code/relaxed_list.cpp
r0f89d4f rb232745 1 #include "relaxed_list.hpp" 1 #if !defined(LIST_VARIANT_HPP) 2 #define LIST_VARIANT_HPP "relaxed_list.hpp" 3 #endif 4 5 #include LIST_VARIANT_HPP 6 #if !defined(LIST_VARIANT) 7 #error not variant selected 8 #endif 2 9 3 10 #include <array> … … 35 42 36 43 template<> 37 thread_local relaxed_list<Node>::TLS relaxed_list<Node>::tls = {};44 thread_local LIST_VARIANT<Node>::TLS LIST_VARIANT<Node>::tls = {}; 38 45 39 46 template<> 40 relaxed_list<Node> * relaxed_list<Node>::head = nullptr;47 std::atomic_uint32_t LIST_VARIANT<Node>::ticket = { 0 }; 41 48 42 49 #ifndef NO_STATS 43 50 template<> 44 relaxed_list<Node>::GlobalStats relaxed_list<Node>::global_stats = {};51 LIST_VARIANT<Node>::GlobalStats LIST_VARIANT<Node>::global_stats = {}; 45 52 #endif 46 53 … … 120 127 atomic_min(global.valmin, local.valmin); 121 128 122 relaxed_list<Node>::stats_tls_tally();129 LIST_VARIANT<Node>::stats_tls_tally(); 123 130 } 124 131 … … 199 206 std::cout << "Total ops : " << ops << "(" << global.in << "i, " << global.out << "o, " << global.empty << "e)\n"; 200 207 #ifndef NO_STATS 201 relaxed_list<Node>::stats_print(std::cout);208 LIST_VARIANT<Node>::stats_print(std::cout); 202 209 #endif 203 210 } … … 216 223 unsigned nslots, 217 224 local_stat_t & local, 218 relaxed_list<Node> & list225 LIST_VARIANT<Node> & list 219 226 ) { 220 227 while(__builtin_expect(!done.load(std::memory_order_relaxed), true)) { … … 254 261 std::cout << "Initializing "; 255 262 size_t npushed = 0; 256 relaxed_list<Node> list = { nthread *nqueues };263 LIST_VARIANT<Node> list = { nthread, nqueues }; 257 264 { 258 265 Node** all_nodes[nthread]; … … 340 347 unsigned nnodes, 341 348 local_stat_t & local, 342 relaxed_list<Node> & list349 LIST_VARIANT<Node> & list 343 350 ) { 344 351 Node * nodes[nnodes]; … … 384 391 std::cout << "Initializing "; 385 392 // List being tested 386 relaxed_list<Node> list = { nthread *nqueues };393 LIST_VARIANT<Node> list = { nthread, nqueues }; 387 394 { 388 395 enable_stats = true; … … 441 448 int nslots, 442 449 local_stat_t & local, 443 relaxed_list<Node> & list450 LIST_VARIANT<Node> & list 444 451 ) { 445 452 while(__builtin_expect(!done.load(std::memory_order_relaxed), true)) { … … 518 525 519 526 // List being tested 520 relaxed_list<Node> list = { nthread *nqueues };527 LIST_VARIANT<Node> list = { nthread, nqueues }; 521 528 { 522 529 Random rand(rdtscl()); … … 593 600 unsigned nnodes, 594 601 local_stat_t & local, 595 relaxed_list<Node> & list602 LIST_VARIANT<Node> & list 596 603 ) { 597 604 Node * nodes[nnodes]; … … 653 660 654 661 // List being tested 655 relaxed_list<Node> list = { nthread *nqueues };662 LIST_VARIANT<Node> list = { nthread, nqueues }; 656 663 { 657 664 enable_stats = true; … … 921 928 922 929 std::cout << "Running " << nthreads << " threads (" << (nthreads * nqueues) << " queues) for " << duration << " seconds" << std::endl; 923 std::cout << "Relaxed list variant: " << relaxed_list<Node>::name() << std::endl;930 std::cout << "Relaxed list variant: " << LIST_VARIANT<Node>::name() << std::endl; 924 931 switch(benchmark) { 925 932 case Churn:
Note: See TracChangeset
for help on using the changeset viewer.