ektologo

An Incomplete Guide to Optimizing the Throughput of GNURadio Flowgraphs

by [SAn]

Streamlining the performance of a GNURadio flowgraph, especially with real-time constraints, can be challenging. This guide aims to highlight key considerations and offer insights into potential approaches.

## Context

## Things to consider

## Measuring and profiling

### Categorize Blocks

Identify and categorize blocks as fast or slow based on their operational speed.

#### Utilize htop

Run the flowgraph and htop to spot the names of the blocks with higher CPU usage. Use the Time column, and make htop show the userland threads with its names.

#### Employ gnuradio perfcounters

Run the flowgraph and use perfcounters to get a sorted list of the work_time_total per block. (hint: run using GR_CONF_PERFCOUNTERS_ON=1 and call block.pc_work_time_total() for each block).

### Benchmarking the flowgraph peak throughput (without real time considerations)

Understanding both peak and average throughput can unveil invaluable insights into the performance and efficiency of the system. The peak throughput is the maximum rate at which data can be processed. It provides insights into the system’s capacity under optimal conditions. The average throughput is the mean rate at which data is typically processed, often determined by the SDR's sample rate.

Comparing these two metrics unveils the throughput efficiency ratio. A higher ratio indicates that the system has ample capacity but may not be optimally configured or efficiently utilized. Consider a scenario where the peak throughput is 100Msps (mega samples per second), while the SDR’s sample rate is 10Msps. This 10:1 ratio indicates a system with substantial untapped potential.

To get the peak throughput run the flowgraph (or subparts of it) using a null sink (without the SDR) and using a fast source as a constant or noise source. To time the execution using setting the max_noutput_items like tb.start(max_noutput_items=100_000_000) to process always the same quantity of items. Another way is to use a file source with a file in tmpfs like /tmp/ but it will have more impact on the system.

## Ideas to increase throughput