Skip to contentSkip to conversation

perf trace: Skip unnecessary synthesis for summary-only mode

PATCH Applied Namhyung Kim 2 participants 3 messages Apr 1 – Apr 2 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH v2 1/1 perf trace: Skip unnecessary synthesis for summary-only mode

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.

---
v2) minimize the diff (Ian)

 tools/perf/builtin-trace.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +5 -1
index f487fbaa0ad60028..d121640ace6e1456 100644
@@ -2004,9 +2004,13 @@ static int trace__symbols_init(struct trace *trace, int argc, const char **argv,
 	if (err < 0)
 		goto out;
 
+	if (trace->summary_only && trace->summary_mode != SUMMARY__BY_THREAD)
+		goto out;
+
 	err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
 					    evlist->core.threads, trace__tool_process,
-					    /*needs_mmap=*/callchain_param.enabled,
+					    /*needs_mmap=*/callchain_param.enabled &&
+							   !trace->summary_only,
 					    /*mmap_data=*/false,
 					    /*nr_threads_synthesize=*/1);
 out:
Signature · 1 line
2.53.0.1213.gd9a14994de-goog
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Namhyung Kim

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.

Thanks,
Ian

Quoted 28 lines

---
v2) minimize the diff (Ian)

 tools/perf/builtin-trace.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +5 -2
index f487fbaa0ad60028..d121640ace6e1456 100644
@@ -2004,9 +2004,13 @@ static int trace__symbols_init(struct trace *trace, int argc, const char **argv,
        if (err < 0)
                goto out;
 
+       if (trace->summary_only && trace->summary_mode != SUMMARY__BY_THREAD)
+               goto out;
+
        err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
                                            evlist->core.threads, trace__tool_process,
-                                           /*needs_mmap=*/callchain_param.enabled,
+                                           /*needs_mmap=*/callchain_param.enabled &&
+                                                          !trace->summary_only,
                                            /*mmap_data=*/false,
                                            /*nr_threads_synthesize=*/1);
 out:
--

2.53.0.1213.gd9a14994de-goog

author maintainer Applied
#2 lore raw
In reply to Namhyung Kim
Quoted 6 lines · Namhyung Kim

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.

Applied to perf-tools-next, thanks!

Best regards,
Namhyung