> As such, do you know an approach to solve this blocking problem?  I have
> tried to set the timeout as a small value, e.g. 1ms, but it seems not
> able to completely solve the problem.  I have never seen such behavior
> using the raw Ethernet code.  What's the difference?
> 

Andrew,

The uhd_usrp_sink::work() should always block until the entire buffer
has been transmitted. There is no choice in the matter. However many
samples gnuradio buffered before calling work(), we must send all of
those samples.

Now, there is a question of where is the delay, what is taking too long,
what is buffering too much, etc. I am attaching a diff with prints for
the time before and after the send() call in the work function. This
will tell us how often work is called, how many samples are transmitted,
and how long this operation takes. Please try the attached diff and post
the output.

Thanks,
-Josh
diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc
index b8b99a4..0e2319d 100644
--- a/gr-uhd/lib/gr_uhd_usrp_sink.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc
@@ -22,6 +22,7 @@
 #include <gr_uhd_usrp_sink.h>
 #include <gr_io_signature.h>
 #include <stdexcept>
+#include <iostream>
 
 /***********************************************************************
  * UHD Multi USRP Sink
@@ -170,15 +171,18 @@ public:
         gr_vector_const_void_star &input_items,
         gr_vector_void_star &output_items
     ){
+        std::cout << "gr_uhd_usrp_sink::work() " << noutput_items << std::endl;
         //send a mid-burst packet with time spec
         _metadata.start_of_burst = false;
         _metadata.end_of_burst = false;
         _metadata.has_time_spec = _has_time_spec;
 
+        std::cout << "time before send() " << uhd::time_spec_t::get_system_time().get_real_secs() << std::endl;
         size_t num_sent = _dev->get_device()->send(
             input_items, noutput_items, _metadata,
             _type, uhd::device::SEND_MODE_FULL_BUFF, 1.0
         );
+        std::cout << "time after send() " << uhd::time_spec_t::get_system_time().get_real_secs() << std::endl;
 
         //increment the timespec by the number of samples sent
         _metadata.time_spec += uhd::time_spec_t(0, num_sent, _sample_rate);
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to