Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/transfer.cpp

    r65c9208 r6dc2db9  
    1212
    1313bool exhaust = false;
    14 volatile bool estop = false;
    1514
    1615bench_sem the_main;
     
    4342                                if( to_miliseconds(timeHiRes() - start) > 5'000 ) {
    4443                                        std::cerr << "Programs has been blocked for more than 5 secs" << std::endl;
    45                                         estop = true;
    46                                         the_main.post();
    47                                         goto END;
     44                                        std::exit(1);
    4845                                }
    4946                        }
    5047                }
    51                 END:;
    5248                PRINT( std::cout | "Waiting done"; )
    5349        }
     
    6359        void lead() {
    6460                this->idx = ++lead_idx;
    65                 if(lead_idx > stop_count || estop) {
     61                if(lead_idx > stop_count) {
    6662                        PRINT( std::cout << "Leader " << this->id << " done" << std::endl; )
    6763                        the_main.post();
     
    9288        }
    9389
    94         static void main(MyThread * arg) {
    95                 MyThread & self = *arg;
     90        static void main(void * arg) {
     91                MyThread & self = *reinterpret_cast<MyThread*>(arg);
    9692                self.park();
    9793
     
    105101                                self.wait();
    106102                        }
    107                         if(lead_idx > stop_count || estop) break;
     103                        if(lead_idx > stop_count) break;
    108104                }
    109105        }
     
    148144                        for(size_t i = 0; i < nthreads; i++) {
    149145                                threads[i] = new MyThread( i );
    150                                 handles[i] = new Fibre();
    151                                 handles[i]->run( MyThread::main, threads[i] );
     146                                handles[i] = new Fibre( MyThread::main, threads[i] );
    152147                        }
    153148
     
    169164                                PRINT( std::cout << i << " joined" << std::endl; )
    170165                                rechecks += thrd.rechecks;
     166                                // delete( handles[i] );
    171167                                delete( threads[i] );
    172168                        }
     
    180176        std::cout << "Number of processors    : " << nprocs << std::endl;
    181177        std::cout << "Number of threads       : " << nthreads << std::endl;
    182         std::cout << "Total Operations(ops)   : " << (lead_idx - 1) << std::endl;
     178        std::cout << "Total Operations(ops)   : " << stop_count << std::endl;
    183179        std::cout << "Threads parking on wait : " << (exhaust ? "yes" : "no") << std::endl;
    184180        std::cout << "Rechecking              : " << rechecks << std::endl;
    185         std::cout << "ns per transfer         : " << std::fixed << (((double)(end - start)) / (lead_idx)) << std::endl;
    186181
    187182
Note: See TracChangeset for help on using the changeset viewer.