The gr-latency GNU Radio Out-of-Tree module is a Free Software Package that aims to provide tools to measure flowgraph latency. The module provides features to measure GNU Radio flowgraph latency, e.g.:
- Which blocks delay processing?
- How long does it take a packet to propagate through the DSP chain?
We add a timestamp to a packet. Either in a PDU or with other means. The trick is a
const auto ticks = std::chrono::high_resolution_clock::now().time_since_epoch()
which represents our timestamp. Further down the processing chain, we can pick up this tag and analyze the time difference. This might give us a pretty consistent idea where we spend most of our latency.
-
This module was inspired by a comment in gr-sched.
-
Bloessl, Müller, Hollick: "Benchmarking and Profiling the GNU Radio Scheduler", GNU Radio Conference (GRCon), September 2019, Huntsville, AL, USA
- All data is printed to
stdout
. Instead, we should use GNU Radio's logging capabilities. - Debug data should contain a common identifier, preferably the timestamp itself to identify different propagation stages of the same packet.
This is the current way to format everything:
find . -regex '.*\.\(c\|cc\|cpp\|cxx\|h\|hh\)' -not -path "*build*" -exec clang-format -style=file -i {} \;
This is a short example how to generate latency reports. It uses Pandas
- Use a flowgraph in
examples
. - Generate this flowgraph in GRC, e.g.
tag_timestamp_demo.grc
- Run flowgraph with
GR_CONF_LOG_LOG_FILE=log.txt ./tag_timestamp_demo.py
. This does create a new fileexamples/log.txt
- Plot results with
python/latency_analysis.py