Re-enable rate limiting in benchmarkSampler

This commit is contained in:
Alexey Rybalchenko 2017-04-06 14:10:11 +02:00 committed by Mohammad Al-Turany
parent 5aaf27bf02
commit ac7017deb5

View File

@ -48,7 +48,7 @@ void FairMQBenchmarkSampler::InitTask()
void FairMQBenchmarkSampler::Run()
{
// std::thread resetMsgCounter(&FairMQBenchmarkSampler::ResetMsgCounter, this);
std::thread resetMsgCounter(&FairMQBenchmarkSampler::ResetMsgCounter, this);
uint64_t numSentMsgs = 0;
@ -96,18 +96,19 @@ void FairMQBenchmarkSampler::Run()
}
}
// --fMsgCounter;
--fMsgCounter;
// while (fMsgCounter == 0) {
// this_thread::sleep_for(chrono::milliseconds(1));
// }
while (fMsgCounter == 0)
{
this_thread::sleep_for(chrono::milliseconds(1));
}
}
auto tEnd = chrono::high_resolution_clock::now();
LOG(INFO) << "Leaving RUNNING state. Sent " << numSentMsgs << " messages in " << chrono::duration<double, milli>(tEnd - tStart).count() << "ms.";
// resetMsgCounter.join();
resetMsgCounter.join();
}
void FairMQBenchmarkSampler::ResetMsgCounter()
@ -117,4 +118,5 @@ void FairMQBenchmarkSampler::ResetMsgCounter()
fMsgCounter = fMsgRate / 100;
this_thread::sleep_for(chrono::milliseconds(10));
}
fMsgCounter = -1;
}