* [PATCH] perf trace: Skip unnecessary synthesis for summary-only mode
@ 2026-03-30 20:14 Namhyung Kim
2026-03-30 21:00 ` Ian Rogers
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2026-03-30 20:14 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Howard Chu
It needs to synthesize task info for the comm name. The mmap
information is only needed for callchain symbolization which is not used
by the summary mode. Also total or cgroup summary mode don't require
the task info. Let's skip the processing if possible.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-trace.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index f487fbaa0ad60028..d09d78b3222717d1 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2004,11 +2004,23 @@ static int trace__symbols_init(struct trace *trace, int argc, const char **argv,
if (err < 0)
goto out;
- err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
- evlist->core.threads, trace__tool_process,
- /*needs_mmap=*/callchain_param.enabled,
- /*mmap_data=*/false,
- /*nr_threads_synthesize=*/1);
+ if (trace->summary_only) {
+ if (trace->summary_mode == SUMMARY__BY_THREAD) {
+ err = __machine__synthesize_threads(trace->host, &trace->tool,
+ &trace->opts.target,
+ evlist->core.threads,
+ trace__tool_process,
+ /*needs_mmap=*/false,
+ /*mmap_data=*/false,
+ /*nr_threads_synthesize=*/1);
+ }
+ } else {
+ err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
+ evlist->core.threads, trace__tool_process,
+ /*needs_mmap=*/callchain_param.enabled,
+ /*mmap_data=*/false,
+ /*nr_threads_synthesize=*/1);
+ }
out:
if (err) {
perf_env__exit(&trace->host_env);
--
2.53.0.1185.g05d4b7b318-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf trace: Skip unnecessary synthesis for summary-only mode
2026-03-30 20:14 [PATCH] perf trace: Skip unnecessary synthesis for summary-only mode Namhyung Kim
@ 2026-03-30 21:00 ` Ian Rogers
2026-03-31 7:07 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2026-03-30 21:00 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, James Clark, Jiri Olsa, Adrian Hunter,
Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users, Howard Chu
On Mon, Mar 30, 2026 at 1:14 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> It needs to synthesize task info for the comm name. The mmap
> information is only needed for callchain symbolization which is not used
> by the summary mode. Also total or cgroup summary mode don't require
> the task info. Let's skip the processing if possible.
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/builtin-trace.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index f487fbaa0ad60028..d09d78b3222717d1 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -2004,11 +2004,23 @@ static int trace__symbols_init(struct trace *trace, int argc, const char **argv,
> if (err < 0)
> goto out;
>
> - err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
> - evlist->core.threads, trace__tool_process,
> - /*needs_mmap=*/callchain_param.enabled,
> - /*mmap_data=*/false,
> - /*nr_threads_synthesize=*/1);
> + if (trace->summary_only) {
> + if (trace->summary_mode == SUMMARY__BY_THREAD) {
> + err = __machine__synthesize_threads(trace->host, &trace->tool,
> + &trace->opts.target,
> + evlist->core.threads,
> + trace__tool_process,
> + /*needs_mmap=*/false,
> + /*mmap_data=*/false,
> + /*nr_threads_synthesize=*/1);
> + }
> + } else {
> + err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
> + evlist->core.threads, trace__tool_process,
> + /*needs_mmap=*/callchain_param.enabled,
> + /*mmap_data=*/false,
> + /*nr_threads_synthesize=*/1);
> + }
Could this be simplified to something like:
```
if (!trace->summary_only || trace->summary_mode == SUMMARY__BY_THREAD) {
err = __machine__synthesize_threads(trace->host, &trace->tool,
&trace->opts.target,
evlist->core.threads,
trace__tool_process,
/*needs_mmap=*/callchain_param.enabled && !trace->summary_only,
/*mmap_data=*/false,
/*nr_threads_synthesize=*/1);
}
```
Thanks,
Ian
> out:
> if (err) {
> perf_env__exit(&trace->host_env);
> --
> 2.53.0.1185.g05d4b7b318-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf trace: Skip unnecessary synthesis for summary-only mode
2026-03-30 21:00 ` Ian Rogers
@ 2026-03-31 7:07 ` Namhyung Kim
0 siblings, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2026-03-31 7:07 UTC (permalink / raw)
To: Ian Rogers
Cc: Arnaldo Carvalho de Melo, James Clark, Jiri Olsa, Adrian Hunter,
Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users, Howard Chu
On Mon, Mar 30, 2026 at 02:00:08PM -0700, Ian Rogers wrote:
> On Mon, Mar 30, 2026 at 1:14 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > It needs to synthesize task info for the comm name. The mmap
> > information is only needed for callchain symbolization which is not used
> > by the summary mode. Also total or cgroup summary mode don't require
> > the task info. Let's skip the processing if possible.
> >
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> > tools/perf/builtin-trace.c | 22 +++++++++++++++++-----
> > 1 file changed, 17 insertions(+), 5 deletions(-)
> >
> > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> > index f487fbaa0ad60028..d09d78b3222717d1 100644
> > --- a/tools/perf/builtin-trace.c
> > +++ b/tools/perf/builtin-trace.c
> > @@ -2004,11 +2004,23 @@ static int trace__symbols_init(struct trace *trace, int argc, const char **argv,
> > if (err < 0)
> > goto out;
> >
> > - err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
> > - evlist->core.threads, trace__tool_process,
> > - /*needs_mmap=*/callchain_param.enabled,
> > - /*mmap_data=*/false,
> > - /*nr_threads_synthesize=*/1);
> > + if (trace->summary_only) {
> > + if (trace->summary_mode == SUMMARY__BY_THREAD) {
> > + err = __machine__synthesize_threads(trace->host, &trace->tool,
> > + &trace->opts.target,
> > + evlist->core.threads,
> > + trace__tool_process,
> > + /*needs_mmap=*/false,
> > + /*mmap_data=*/false,
> > + /*nr_threads_synthesize=*/1);
> > + }
> > + } else {
> > + err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
> > + evlist->core.threads, trace__tool_process,
> > + /*needs_mmap=*/callchain_param.enabled,
> > + /*mmap_data=*/false,
> > + /*nr_threads_synthesize=*/1);
> > + }
>
> Could this be simplified to something like:
> ```
> if (!trace->summary_only || trace->summary_mode == SUMMARY__BY_THREAD) {
> err = __machine__synthesize_threads(trace->host, &trace->tool,
> &trace->opts.target,
> evlist->core.threads,
> trace__tool_process,
>
> /*needs_mmap=*/callchain_param.enabled && !trace->summary_only,
> /*mmap_data=*/false,
> /*nr_threads_synthesize=*/1);
> }
> ```
Looks good, will update.
Btw, it'd be nice if you could find a mail client that can turn off the
line wrapping. :)
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-31 7:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 20:14 [PATCH] perf trace: Skip unnecessary synthesis for summary-only mode Namhyung Kim
2026-03-30 21:00 ` Ian Rogers
2026-03-31 7:07 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox