diff options
author | Brent Stapleton <brent.stapleton@ettus.com> | 2019-09-03 18:49:14 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-09-04 09:16:12 -0700 |
commit | 37c2463798eb1728689577de0374a536fa79f648 (patch) | |
tree | eedc600945f23223cbe7e05bd9c523ec9395627f /host/examples/benchmark_rate.cpp | |
parent | cff98f5d8b9bee715964ff61c6065e0806542f96 (diff) | |
download | uhd-37c2463798eb1728689577de0374a536fa79f648.tar.gz uhd-37c2463798eb1728689577de0374a536fa79f648.tar.bz2 uhd-37c2463798eb1728689577de0374a536fa79f648.zip |
examples: bmark_rate: fixup INIT_DELAY
Fixing accounting for INIT_DELAY in the stream duration
Diffstat (limited to 'host/examples/benchmark_rate.cpp')
-rw-r--r-- | host/examples/benchmark_rate.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp index a76da3c18..6c2c6868d 100644 --- a/host/examples/benchmark_rate.cpp +++ b/host/examples/benchmark_rate.cpp @@ -540,9 +540,12 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) } // sleep for the required duration - const bool wait_for_multichan = - (rx_channel_nums.size() <= 1 and tx_channel_nums.size() <= 1); - const int64_t secs = int64_t(duration + (wait_for_multichan ? 0 : INIT_DELAY * 1000)); + if (rx_channel_nums.size() > 1 or tx_channel_nums.size() > 1) { + // If we have multiple channels, we need to account for the INIT_DELAY in order to + // send/receive the proper number of samples. + duration += INIT_DELAY; + } + const int64_t secs = int64_t(duration); const int64_t usecs = int64_t((duration - secs) * 1e6); std::this_thread::sleep_for( std::chrono::seconds(secs) + std::chrono::microseconds(usecs)); |