From 2a134b9206bec31e25e6b9cd6cd632ce856ec919 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Wed, 15 Nov 2017 11:01:08 +0100 Subject: [PATCH] Changing '--rate' option to type float, remove stringstream from argument scan This correction to the previous commit leaves the header in, because std::stringstream has been using already before and the header was missing. --- fairmq/FairMQDevice.cxx | 4 ++-- fairmq/options/FairMQProgOptions.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fairmq/FairMQDevice.cxx b/fairmq/FairMQDevice.cxx index 98a50d64..58830243 100644 --- a/fairmq/FairMQDevice.cxx +++ b/fairmq/FairMQDevice.cxx @@ -520,7 +520,7 @@ void FairMQDevice::RunWrapper() if (fRate > 0.001) { auto timeSinceRef = std::chrono::duration_cast(std::chrono::system_clock::now() - reftime); auto timespan = timeSinceRef.count() - fLastTime; - TimeScale::rep period = (float)TimeScale::period::den / fRate; + TimeScale::rep period = static_cast(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("network-interface"); fNumIoThreads = config.GetValue("io-threads"); fInitializationTimeoutInS = config.GetValue("initialization-timeout"); - std::stringstream(fConfig->GetValue("rate")) >> fRate; + fRate = fConfig->GetValue("rate"); } void FairMQDevice::LogSocketRates() diff --git a/fairmq/options/FairMQProgOptions.cxx b/fairmq/options/FairMQProgOptions.cxx index 43a51f7a..631e4f38 100644 --- a/fairmq/options/FairMQProgOptions.cxx +++ b/fairmq/options/FairMQProgOptions.cxx @@ -336,7 +336,7 @@ void FairMQProgOptions::FillOptionDescription(boost::program_options::options_de ("print-channels", po::value()->implicit_value(true), "Print registered channel endpoints in a machine-readable format (::)") ("shm-segment-size", po::value()->default_value(2000000000), "shmem transport: size of the shared memory segment (in bytes).") ("shm-segment-name", po::value()->default_value("fairmq_shmem_main"), "shmem transport: name of the shared memory segment.") - ("rate", po::value()->default_value(""), "rate for conditional run loop (Hz)") + ("rate", po::value()->default_value(0.), "rate for conditional run loop (Hz)") ; }