Changing '--rate' option to type float, remove stringstream from argument scan

This correction to the previous commit leaves the <sstream> header in, because
std::stringstream has been using already before and the header was missing.
This commit is contained in:
Matthias Richter 2017-11-15 11:01:08 +01:00 committed by Mohammad Al-Turany
parent 9b2b1cf9f1
commit 2a134b9206
2 changed files with 3 additions and 3 deletions

View File

@ -520,7 +520,7 @@ void FairMQDevice::RunWrapper()
if (fRate > 0.001) {
auto timeSinceRef = std::chrono::duration_cast<TimeScale>(std::chrono::system_clock::now() - reftime);
auto timespan = timeSinceRef.count() - fLastTime;
TimeScale::rep period = (float)TimeScale::period::den / fRate;
TimeScale::rep period = static_cast<float>(TimeScale::period::den) / fRate;
if (timespan < period) {
TimeScale sleepfor(period - timespan);
std::this_thread::sleep_for(sleepfor);
@ -909,7 +909,7 @@ void FairMQDevice::SetConfig(FairMQProgOptions& config)
fNetworkInterface = config.GetValue<string>("network-interface");
fNumIoThreads = config.GetValue<int>("io-threads");
fInitializationTimeoutInS = config.GetValue<int>("initialization-timeout");
std::stringstream(fConfig->GetValue<string>("rate")) >> fRate;
fRate = fConfig->GetValue<float>("rate");
}
void FairMQDevice::LogSocketRates()

View File

@ -336,7 +336,7 @@ void FairMQProgOptions::FillOptionDescription(boost::program_options::options_de
("print-channels", po::value<bool >()->implicit_value(true), "Print registered channel endpoints in a machine-readable format (<channel name>:<min num subchannels>:<max num subchannels>)")
("shm-segment-size", po::value<size_t>()->default_value(2000000000), "shmem transport: size of the shared memory segment (in bytes).")
("shm-segment-name", po::value<string>()->default_value("fairmq_shmem_main"), "shmem transport: name of the shared memory segment.")
("rate", po::value<string>()->default_value(""), "rate for conditional run loop (Hz)")
("rate", po::value<float>()->default_value(0.), "rate for conditional run loop (Hz)")
;
}