[PATCH v6 07/26] perf trace: Start BPF summary before starting workload
From: Ian Rogers
Date: Mon Sep 28 2026 - 14:27:27 EST
trace_start_bpf_summary() is called after evlist__start_workload(), so a
short lived workload can make its syscalls, or even exit, before the BPF
summary is enabled. It also ignores --delay. Enable it along with the
evlist, before the workload starts or after the initial delay.
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/builtin-trace.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index f94745a60f4a..1ffe824ba670 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -4855,17 +4855,19 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (!target__none(&trace->opts.target) && !trace->opts.target.initial_delay)
evlist__enable(evlist);
+ if (trace->summary_bpf && !trace->opts.target.initial_delay)
+ trace_start_bpf_summary();
+
if (forks)
evlist__start_workload(evlist);
if (trace->opts.target.initial_delay) {
usleep(trace->opts.target.initial_delay * 1000);
evlist__enable(evlist);
+ if (trace->summary_bpf)
+ trace_start_bpf_summary();
}
- if (trace->summary_bpf)
- trace_start_bpf_summary();
-
trace->multiple_threads = perf_thread_map__pid(evlist__core(evlist)->threads, 0) == -1 ||
perf_thread_map__nr(evlist__core(evlist)->threads) > 1 ||
evlist__first(evlist)->core.attr.inherit;
--
2.56.0.rc1.315.gc6ed9934b7-goog