Consumption of rtl_tcp too slow?
Mr Anthony Arnold
anthony.arnold at uqconnect.edu.au
Sat May 9 00:12:10 UTC 2015
The count on rtl_tcp keeps increasing until it reaches the default limit for the "-n" options (500).
When the gr-osmosdr source block is created, the first thing gnss-sdr does is to set up the sample rate, frequency, and gain parameters. It then connects the block up to the flowgraph and the flowgraph is run.
I tried a little experiment by writing my own block for consuming rtl_tcp. It's mostly the same as the gr-osmosdr one, except that it runs a separate thread for TCP reads. The producer thread continually reads from the socket, translates the incoming bytes to the float values via the LUT, then stuffs the floats into a circular buffer. The work function on the gnuradio thread just pulls data from the circular buffer. This gave a barely-noticeable improvement.
I did some tracing, and found the the producer thread gets held up; the buffer is almost constantly full. The hints that the network stack is not the issue, because the producer thread is reading faster than gnuradio can consume it.
This is all very confusing, because when I'm reading from the USB dongle directly on the same machine, gnss-sdr handles 1.2Msps in realtime without trouble and no overflows. It's only when it's reading from the network that it can't keep up, but the network itself doesn't seem to be the bottleneck.
Is it possible that the deinterleave and/or float_to_complex stages are what's holding this up?
Anthony Arnold | Programmer
e: anthony.arnold at uqconnect.edu.au
From: osmocom-sdr <osmocom-sdr-bounces at lists.osmocom.org> on behalf of ew <la at tfc-server.de>
Sent: Saturday, 9 May 2015 4:19 AM
To: osmocom-sdr at lists.osmocom.org
Subject: Re: Consumption of rtl_tcp too slow?
By the looks of it I'd say the gnss-sdr source is the problem, does the
count keep increasing or does it stop at a certain number?
The explanation for the latter would be that the Application connects,
but does not read, rtl-tcp has no starting or stopping. As soon as a
client connects it tries to pump out samples until the client
disconnects, so buffers are going to pile up if there is a delay between
connecting and reading and the count will stay the same if the
application does not read the data faster than real time to empty the list.
If it keeps increasing the most probable explanation would be a sample
rate mismatch or some other reason why the client does not read fast enough.
The "known to work" rates are just that - values that are known to work
without any side effects, but most other rates should work, too.
Frequent tuning, gain adjustments, or other commands might cause those
commands to pile up, but neither of those would cause the dongle to
produce more samples than anticipated unless your app accidentally sends
out a command to set a higher sample rate...
More information about the osmocom-sdr