[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get average execution time of a block?
From: |
Marcus Müller |
Subject: |
Re: How to get average execution time of a block? |
Date: |
Wed, 14 Feb 2024 15:44:58 +0100 |
User-agent: |
Mozilla Thunderbird |
Hi Bob,
complicated answer: yes, but.
So, we do have the performance counters that can be enabled at compile time in GNU Radio,
and which can be queried through ctrlport. Ctrlport has been hard to or impossible to use
for quite a while, so it's pretty possible this is not a viable option to you. However, if
it is: the gr-perf-monitorx program connects to a running flowgraph's ctrlport server and
displays statistics like average and per-item runtime. These performance counters do come
with performance overhead, so use at your own risk.
A lot easier would be to attach a "Probe Rate" block to the filter's output (unless you
inherently know the rate already), and use `perf top -ag` to check how much time your CPU
cores spend in which function (pretty much randomly sampled); this won't give you an exact
"time per call", but it would give you a "CPU usage percentage per call" and inherently
"usage percentage per sample", if you will. That might be what you need, but it might also
*not* be what you need.
In case you really want to get the time in seconds per call, and relate that to the number
of items produces: see the attached bpftrace script. This uses modern Linux and bpftrace
capabilities to hook user functions. It still does have some, but usually, much more
benign, overhead.
Best regards,
Marcus
On 13.02.24 16:47, Bob Gnu wrote:
I'm using the 'Lowpass Filter Block'. Is there a way to get the average execution time
for that block? Per sample or per 1000 samples, for example? The sample rate is 2 MHz.
thanks
tracegr.bt
Description: Text document