From d6cab26bf26d61d71ba0792bce8f48a89f7dc2d7 Mon Sep 17 00:00:00 2001 From: Matt Ettus Date: Thu, 3 Feb 2011 16:41:01 -0800 Subject: successful latency test. About 500 us on my laptop. --- host/examples/latency_test.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'host') diff --git a/host/examples/latency_test.cpp b/host/examples/latency_test.cpp index b6afdeb34..340e87fb7 100644 --- a/host/examples/latency_test.cpp +++ b/host/examples/latency_test.cpp @@ -36,6 +36,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ double rate, freq; float ampl; double delta_t; + size_t pkts; //setup the program options po::options_description desc("Allowed options"); @@ -46,6 +47,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("rtt", po::value(&delta_t)->default_value(0.001), "Round-Trip time to test") ("nsamps", po::value(&total_num_samps)->default_value(100), "total number of samples to transmit") ("spp", po::value(&samps_per_packet)->default_value(1000), "number of samples per packet") + ("pkts", po::value(&pkts)->default_value(1000), "number of packets") ("rate", po::value(&rate)->default_value(100e6/4), "rate of outgoing samples") ("freq", po::value(&freq)->default_value(0), "rf center frequency in Hz") ("ampl", po::value(&l)->default_value(float(0.3)), "amplitude of each sample") @@ -110,12 +112,13 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ size_t num_packets = (total_num_samps+samps_per_packet-1)/samps_per_packet; - double cur_time = 0.0; + uhd::time_spec_t cur_time; sdev->set_time_now(uhd::time_spec_t(cur_time)); - for(int j=0;j<100;j++) { + for(int j=0;jget_time_now() + uhd::time_spec_t(0.01); stream_cmd.time_spec = uhd::time_spec_t(cur_time); sdev->issue_stream_cmd(stream_cmd); size_t num_acc_samps = 0; @@ -161,7 +164,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ size_t samps_to_send = std::min(total_num_samps - samps_per_packet*i, samps_per_packet); //send the entire packet (driver fragments internally) - tx_md.time_spec = uhd::time_spec_t(cur_time+delta_t); + //tx_md.time_spec = rx_md.time_spec+uhd::time_spec_t(delta_t); + tx_md.time_spec = cur_time + uhd::time_spec_t(delta_t); size_t num_tx_samps = dev->send (&txbuff.front(), samps_to_send, tx_md, uhd::io_type_t::COMPLEX_FLOAT32, -- cgit v1.2.3