diff options
author | Martin Braun <martin.braun@ettus.com> | 2016-07-22 11:45:17 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-07-22 11:45:17 -0700 |
commit | 8a8b90183b063410350995fcbb04494c3bf0a1bc (patch) | |
tree | 3e32f425640e4b062e9e65c1e0f446ef1f440942 /host | |
parent | 5d360ab43eca63e3f12f0e5abde5a3186b7f12dc (diff) | |
download | uhd-8a8b90183b063410350995fcbb04494c3bf0a1bc.tar.gz uhd-8a8b90183b063410350995fcbb04494c3bf0a1bc.tar.bz2 uhd-8a8b90183b063410350995fcbb04494c3bf0a1bc.zip |
examples: Added late command counter to benchmark_rate
Diffstat (limited to 'host')
-rw-r--r-- | host/examples/benchmark_rate.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp index c58d4f5ae..3d57037d5 100644 --- a/host/examples/benchmark_rate.cpp +++ b/host/examples/benchmark_rate.cpp @@ -47,6 +47,7 @@ unsigned long long num_rx_samps = 0; unsigned long long num_tx_samps = 0; unsigned long long num_dropped_samps = 0; unsigned long long num_seq_errors = 0; +unsigned long long num_late_commands = 0; unsigned long long num_timeouts = 0; /*********************************************************************** @@ -128,9 +129,16 @@ void benchmark_rx_rate( num_overflows++; break; + case uhd::rx_metadata_t::ERROR_CODE_LATE_COMMAND: + std::cerr << "Receiver error: " << md.strerror() << ", restart streaming..."<< std::endl; + num_late_commands++; + // Radio core will be in the idle state. Issue stream command to restart streaming. + cmd.time_spec = usrp->get_time_now() + uhd::time_spec_t(0.05); + cmd.stream_now = (buffs.size() == 1); + rx_stream->issue_stream_cmd(cmd); + break; + case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: - // If we stopped the streamer, then we expect this at some point - //if (burst_timer_elapsed.load(boost::memory_order_relaxed)) { if (burst_timer_elapsed) { return; } @@ -417,7 +425,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //sleep for the required duration const long secs = long(duration); const long usecs = long((duration - secs)*1e6); - boost::this_thread::sleep(boost::posix_time::seconds(secs) + boost::posix_time::microseconds(usecs)); + boost::this_thread::sleep(boost::posix_time::seconds(secs) + + boost::posix_time::microseconds(usecs) + + boost::posix_time::milliseconds(INIT_DELAY * 1000) + ); //interrupt and join the threads //burst_timer_elapsed.store(true, boost::memory_order_relaxed); @@ -433,11 +444,13 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ " Num transmitted samples: %u\n" " Num sequence errors: %u\n" " Num underflows detected: %u\n" + " Num late commands: %u\n" " Num timeouts: %u\n" ) % num_rx_samps % num_dropped_samps % num_overflows % num_tx_samps % num_seq_errors % num_underflows - % num_timeouts << std::endl; + % num_late_commands % num_timeouts + << std::endl; //finished std::cout << std::endl << "Done!" << std::endl << std::endl; |