Ignore:
Timestamp:
Sep 27, 2019, 11:07:56 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c3a2007
Parents:
1e24d13
Message:

Fixed support for setting number of starting nodes

Location:
doc/theses/thierry_delisle_PhD/code
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/thierry_delisle_PhD/code/relaxed_list.cpp

    r1e24d13 rc921712  
    22
    33#include <array>
     4#include <iomanip>
    45#include <iostream>
    56#include <locale>
     
    104105
    105106        // Prep nodes
    106         std::cout << "Initializing" << std::endl;
     107        std::cout << "Initializing ";
     108        size_t nnodes  = 0;
     109        size_t npushed = 0;
    107110        NodeArray all_nodes[nthread];
    108111        for(auto & nodes : all_nodes) {
     
    110113                for(auto & node : nodes.array) {
    111114                        auto r = rand.next() % 100;
    112                         if(r < fill)
     115                        if(r < fill) {
    113116                                node = new Node(rand.next() % 100);
    114                         else
     117                                nnodes++;
     118                        } else {
    115119                                node = nullptr;
     120                        }
    116121                }
    117122
     
    121126                                global.crc_in += node->value;
    122127                                list.push(node);
     128                                npushed++;
    123129                                nodes.array[idx] = nullptr;
    124130                        }
    125131                }
    126132        }
     133
     134        std::cout << nnodes << " nodes " << fill << "% (" << npushed << " pushed)" << std::endl;
    127135
    128136        enable_stats = true;
     
    179187                        break;
    180188                }
    181                 std::cout << "\r" << durr.count() << "/" << duration;
     189                std::cout << "\r" << std::setprecision(4) << durr.count();
    182190                std::cout.flush();
    183191        }
     
    187195        duration_t durr = after - before;
    188196        duration = durr.count();
    189         std::cout << "\nClosing down" << std::endl;
     197        std::cout << "\rClosing down" << std::endl;
    190198
    191199        for(auto t : threads) {
     
    241249        {
    242250        case 5:
    243                 nqueues = std::stoul(argv[4]);
     251                fill = std::stoul(argv[4]);
    244252                [[fallthrough]];
    245253        case 4:
  • doc/theses/thierry_delisle_PhD/code/relaxed_list.hpp

    r1e24d13 rc921712  
    7474                #ifndef NO_STATS
    7575                        std::cout << "Difference   : "
    76                                 << size_t(double(intrusive_queue_t::stat::dif.value) / intrusive_queue_t::stat::dif.num  ) << " avg\t"
     76                                << ssize_t(double(intrusive_queue_t::stat::dif.value) / intrusive_queue_t::stat::dif.num  ) << " avg\t"
    7777                                << intrusive_queue_t::stat::dif.max << "max" << std::endl;
    7878                #endif
     
    200200                                stat::dif.value+= s.diff;
    201201                                stat::dif.num  ++;
    202                                 stat::dif.max  = std::max(stat::dif.max, s.diff);
     202                                stat::dif.max  = std::abs(stat::dif.max) > std::abs(s.diff) ? stat::dif.max : s.diff;
    203203                        #endif
    204204                }
Note: See TracChangeset for help on using the changeset viewer.