Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce latency and CPU utilization #84

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

argilo
Copy link
Collaborator

@argilo argilo commented Oct 31, 2024

To control RDS latency, many blocks in rds_tx.grc have a maximum output buffer size (Maxoutbuf) specified. As noted in #83 (comment), this causes excessively high CPU utilization. This stems almost entirely from the high-sample-rate blocks (Multiply, Add, Frequency Mod) which contribute a negligible amount to the overall RDS latency. Removing the Maxoutbuf setting for these blocks reduces CPU utilization by about 65% without any noticeable effect on latency.

Also, two low-sample-rate blocks (RDS Encoder, Chunks to Symbols) do not specify a maximum output buffer size. Adding the setting to the RDS Encoder block reduces RDS latency from 72 seconds to 20. I've added the setting to the Chunks to Symbols block as well, but unfortunately it has no effect at the moment due to a bug in GNU Radio: gnuradio/gnuradio#7534. If that bug is fixed, then another 7 seconds of latency could be removed.

As noted in #83 (comment), a better way to control latency would be to use the approach taken by gr-latency_manager: have the RDS Encoder block generate stream tags, and limit its output until those tags are seen downstream. That's a bigger change, so I thought it would make sense to do a quick fix to the Maxoutbuf settings first, which already gives a substantial improvement.

@bastibl
Copy link
Owner

bastibl commented Nov 1, 2024

Great, thank you!

Does that mean that the flowgraph will automatically apply the setting once Chunks to Symbols is fixed or would this require another patch?

@bastibl bastibl merged commit 670e205 into bastibl:maint-3.10 Nov 1, 2024
@argilo argilo deleted the reduce-latency branch November 1, 2024 13:07
@argilo
Copy link
Collaborator Author

argilo commented Nov 1, 2024

Does that mean that the flowgraph will automatically apply the setting once Chunks to Symbols is fixed

Yes.

And to get the latency reduction without waiting for a bug fix, the generated rds_tx.py can be edited to replace this line:

self.digital_chunks_to_symbols_xx_0.set_max_output_buffer(outbuffer)

with:

self.digital_chunks_to_symbols_xx_0.set_max_output_buffer(0, outbuffer)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants