#include #include #include #include #include #include unsigned Producers = 7; unsigned Consumers = 5; unsigned Elements = 1000*1000; std::atomic finished(false); void do_nothing(uint64_t) {} utility::locked_queue Q; std::vector< std::vector > v; void produ(unsigned nr) { std::cout << "Producer #" << nr << " starts." << std::endl; for(unsigned e = 0; e1) { Producers = atol(argv[1]); if(Producers<1 || Producers > 99999) Producers = 1; } if(argc>2) { Consumers = atol(argv[2]); if(Consumers<1 || Consumers > 99999) Consumers = 1; } if(argc>3) { Elements = atol(argv[3]); if(Elements<1 || Elements > 1024*1024*1024) Elements = 10000; } std::cout << "Testing with " << Producers << " producer threads, " << Consumers << " consumer threads, " << Elements << " elements per thread." << std::endl; v.resize(Consumers); std::vector vp; vp.reserve(Producers); std::vector vc; vc.reserve(Consumers); for(unsigned c = 0; c s; for(unsigned c=0; c