aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/benchmark_rate.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-15 14:42:12 -0700
committerJosh Blum <josh@joshknows.com>2011-06-15 14:42:12 -0700
commitb769fe40f1f36fda1110fdd99e5f5c21755b93cc (patch)
treea8f8555262e171cfda57ea254070e4489b1a54f8 /host/examples/benchmark_rate.cpp
parent868d58627808b03d77d3df7d6f9e182de98d69d1 (diff)
downloaduhd-b769fe40f1f36fda1110fdd99e5f5c21755b93cc.tar.gz
uhd-b769fe40f1f36fda1110fdd99e5f5c21755b93cc.tar.bz2
uhd-b769fe40f1f36fda1110fdd99e5f5c21755b93cc.zip
uhd: more benchmark tweaks, removed old benchmark rx
Diffstat (limited to 'host/examples/benchmark_rate.cpp')
-rw-r--r--host/examples/benchmark_rate.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp
index a9bbc1265..6927b512b 100644
--- a/host/examples/benchmark_rate.cpp
+++ b/host/examples/benchmark_rate.cpp
@@ -122,9 +122,11 @@ void benchmark_tx_rate_async_helper(uhd::usrp::multi_usrp::sptr usrp){
//setup variables and allocate buffer
uhd::async_metadata_t async_md;
- while (not boost::this_thread::interruption_requested()){
+ while (true){
- if (not usrp->get_device()->recv_async_msg(async_md)) continue;
+ if (not usrp->get_device()->recv_async_msg(async_md)){
+ if (boost::this_thread::interruption_requested()) return;
+ }
//handle the error codes
switch(async_md.event_code){
@@ -210,7 +212,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//sleep for the required duration
const long secs = long(duration);
- const long usecs = (duration - secs)*1e6;
+ const long usecs = long((duration - secs)*1e6);
boost::this_thread::sleep(boost::posix_time::seconds(secs) + boost::posix_time::microseconds(usecs));
//interrupt and join the threads
@@ -220,12 +222,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//print summary
std::cout << std::endl << boost::format(
"Benchmark rate summary:\n"
- " Num received samples: %u\n"
- " Num dropped samples: %u\n"
- " Num overflows detected: %u\n"
+ " Num received samples: %u\n"
+ " Num dropped samples: %u\n"
+ " Num overflows detected: %u\n"
" Num transmitted samples: %u\n"
" Num underflows detected: %u\n"
- ) % num_rx_samps % num_dropped_samps % num_overflows % num_tx_samps % num_overflows << std::endl;
+ ) % num_rx_samps % num_dropped_samps % num_overflows % num_tx_samps % num_underflows << std::endl;
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;