Re: [PATCH 1/2] perf tools: add 'perf irq' to measure the hardware interrupts

From: Alexei Budankov
Date: Tue Jan 12 2021 - 14:52:26 EST



Hi Bixuan,

On 12.01.2021 15:55, Bixuan Cui wrote:
> Add 'perf irq' to trace/measure the hardware interrupts.
>
> Now three functions are provided:
> 1. 'perf irq record <command>' to record the irq handler events.
> 2. 'perf irq script' to see a detailed trace of the workload that
> was recorded.
> 3. 'perf irq timeconsume' to calculate the time consumed by each
> hardware interrupt processing function.
>
> Signed-off-by: Bixuan Cui <cuibixuan@xxxxxxxxxx>

Thanks for the patches. There is still something that could be improved.

> ---
> tools/perf/Build | 1 +
> tools/perf/builtin-irq.c | 288 +++++++++++++++++++++++++++++++++++++++
> tools/perf/builtin.h | 1 +
> tools/perf/perf.c | 1 +
> 4 files changed, 291 insertions(+)
> create mode 100644 tools/perf/builtin-irq.c
>

<SNIP>

> +
> +static int __cmd_record(int argc, const char **argv)
> +{
> + unsigned int rec_argc, i, j;
> + const char **rec_argv;
> + const char * const record_args[] = {
> + "record",
> + "-a",

I see it works also like this:

sudo perf record -p PID -c 1 -e irq:irq_handler_entry,irq:irq_handler_exit
sudo perf record -R -c 1 -e irq:irq_handler_entry,irq:irq_handler_exit -- find /

This -a option jointly with -p option could be made configurable from
the command line for perf irq mode.

> + "-R",
> + "-m", "1024",

Do you see data losses with default buffer size of 512KB
when capturing trace in your specific use case?

If not then this -m could be avoided or made configurable
if you still need it.

Regards,
Alexei