[USRP-users] Processing time between successive uhd::rx_streamer::recv

Marcus D. Leech mleech at ripnet.com
Wed Oct 29 17:54:39 EDT 2014


On 10/29/2014 05:47 PM, Nir Eden via USRP-users wrote:
> Thank you Marcus,
>
> I'm trying to understand what should be done in order to avoid data 
> loss and overflow. My receiver code is looking something like this:
> while(true) {
>      size_t num_rx_samps = rx_stream->recv(&buff.front(), buff.size(), 
> md, 3.0, enable_size_map);
>      // Do some number crunching
> }
>
> I do understand that the number crunching task can't take too long. 
> So, how long can it take before data loss? Should I implement double 
> buffer?
>
Well, if we pretend that there's no buffering, then if your crunching 
takes longer than 1 sample interval, you'll eventually run out of buffer.

The usual technique (which, BTW, Gnu Radio takes merciless advantage of) 
is to separate your "crunching" from your data-gathering, using
   multiple threads and ring-buffers.

Since these are radios that are sampling the physical world, there's no 
way to apply back-pressure to the physical world.  Your gather loop has to
   complete faster than size-of-sample-buffer*sample-time.   If, on 
average, it doesn't, you'll run out of buffering.




-- 
Marcus Leech
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org





More information about the USRP-users mailing list