diff options
author | Ciro Nishiguchi <ciro.nishiguchi@ni.com> | 2020-01-20 11:01:35 -0600 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2020-01-20 11:57:34 -0800 |
commit | eb7949e2b39ad9bb6f1e52ca67cfb7b5c0952501 (patch) | |
tree | 3691bcd17e0136812371ac2cfd070d62ac3c00ea | |
parent | 74c2e7224681088a593eef25f87281c1882d2dec (diff) | |
download | uhd-eb7949e2b39ad9bb6f1e52ca67cfb7b5c0952501.tar.gz uhd-eb7949e2b39ad9bb6f1e52ca67cfb7b5c0952501.tar.bz2 uhd-eb7949e2b39ad9bb6f1e52ca67cfb7b5c0952501.zip |
examples: Fix tx timeout caused by initial delay
Using default values, the initial delay for tx is larger than the
default timeout of tx_streamer::send. Changing the example to always
specify a timeout in send.
-rw-r--r-- | host/examples/benchmark_rate.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp index 1fa151069..79cd9ed27 100644 --- a/host/examples/benchmark_rate.cpp +++ b/host/examples/benchmark_rate.cpp @@ -209,7 +209,7 @@ void benchmark_tx_rate(uhd::usrp::multi_usrp::sptr usrp, if (elevate_priority) { uhd::set_thread_priority_safe(); } - + // print pre-test summary std::cout << boost::format("[%s] Testing transmit rate %f Msps on %u channels") % NOW() % (usrp->get_tx_rate() / 1e6) % tx_stream->get_num_channels() @@ -227,12 +227,13 @@ void benchmark_tx_rate(uhd::usrp::multi_usrp::sptr usrp, md.has_time_spec = (buffs.size() != 1); md.time_spec = usrp->get_time_now() + uhd::time_spec_t(tx_delay); + const float timeout = 1.0; + if (random_nsamps) { std::srand((unsigned int)time(NULL)); while (not burst_timer_elapsed) { size_t total_num_samps = rand() % max_samps_per_packet; size_t num_acc_samps = 0; - const float timeout = 1; usrp->set_time_now(uhd::time_spec_t(0.0)); while (num_acc_samps < total_num_samps) { @@ -246,7 +247,7 @@ void benchmark_tx_rate(uhd::usrp::multi_usrp::sptr usrp, } else { while (not burst_timer_elapsed) { const size_t num_tx_samps_sent_now = - tx_stream->send(buffs, spp, md) * tx_stream->get_num_channels(); + tx_stream->send(buffs, spp, md, timeout) * tx_stream->get_num_channels(); num_tx_samps += num_tx_samps_sent_now; if (num_tx_samps_sent_now == 0) { num_timeouts_tx++; |