summaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-07 11:11:28 -0700
committerJosh Blum <josh@joshknows.com>2010-07-07 11:11:28 -0700
commitc48f029971a879b367e8876351b4795d90346208 (patch)
tree46bdb12009a30f91858821842e1f5f85a36801e9 /host/examples
parentc36a671dc8b6f89789e92ab93c677156c3bdc190 (diff)
downloaduhd-c48f029971a879b367e8876351b4795d90346208.tar.gz
uhd-c48f029971a879b367e8876351b4795d90346208.tar.bz2
uhd-c48f029971a879b367e8876351b4795d90346208.zip
uhd: added single rate option to benchmark example
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/benchmark_rx_rate.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/host/examples/benchmark_rx_rate.cpp b/host/examples/benchmark_rx_rate.cpp
index a913261eb..7b512e56e 100644
--- a/host/examples/benchmark_rx_rate.cpp
+++ b/host/examples/benchmark_rx_rate.cpp
@@ -104,6 +104,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//variables to be set by po
std::string args;
double duration;
+ double only_rate;
//setup the program options
po::options_description desc("Allowed options");
@@ -111,6 +112,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("help", "help message")
("args", po::value<std::string>(&args)->default_value(""), "simple uhd device address args")
("duration", po::value<double>(&duration)->default_value(10.0), "duration for each test in seconds")
+ ("rate", po::value<double>(&only_rate), "specify to perform a single test as this rate (sps)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -128,12 +130,19 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::usrp::simple_usrp::sptr sdev = uhd::usrp::simple_usrp::make(args);
std::cout << boost::format("Using Device: %s") % sdev->get_pp_string() << std::endl;
- sdev->set_rx_rate(500e3); //initial rate
- while(true){
+ if (not vm.count("rate")){
+ sdev->set_rx_rate(500e3); //initial rate
+ while(true){
+ double rate = sdev->get_rx_rate();
+ test_device(sdev, rate, duration);
+ sdev->set_rx_rate(rate*2); //double the rate
+ if (sdev->get_rx_rate() == rate) break;
+ }
+ }
+ else{
+ sdev->set_rx_rate(only_rate);
double rate = sdev->get_rx_rate();
test_device(sdev, rate, duration);
- sdev->set_rx_rate(rate*2); //double the rate
- if (sdev->get_rx_rate() == rate) break;
}
//finished