aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-trace.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 2ec53edcf649..a6e05e1bb350 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2114,6 +2114,28 @@ out_put:
2114 return err; 2114 return err;
2115} 2115}
2116 2116
2117static int trace__fprintf_callchain(struct trace *trace, struct perf_evsel *evsel,
2118 struct perf_sample *sample)
2119{
2120 struct addr_location al;
2121 /* TODO: user-configurable print_opts */
2122 const unsigned int print_opts = PRINT_IP_OPT_SYM |
2123 PRINT_IP_OPT_DSO |
2124 PRINT_IP_OPT_UNKNOWN_AS_ADDR;
2125
2126 if (sample->callchain == NULL)
2127 return 0;
2128
2129 if (machine__resolve(trace->host, &al, sample) < 0) {
2130 pr_err("Problem processing %s callchain, skipping...\n",
2131 perf_evsel__name(evsel));
2132 return 0;
2133 }
2134
2135 return perf_evsel__fprintf_callchain(evsel, sample, &al, 38, print_opts,
2136 scripting_max_stack, trace->output);
2137}
2138
2117static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, 2139static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
2118 union perf_event *event __maybe_unused, 2140 union perf_event *event __maybe_unused,
2119 struct perf_sample *sample) 2141 struct perf_sample *sample)
@@ -2193,21 +2215,7 @@ signed_print:
2193 2215
2194 fputc('\n', trace->output); 2216 fputc('\n', trace->output);
2195 2217
2196 if (sample->callchain) { 2218 trace__fprintf_callchain(trace, evsel, sample);
2197 struct addr_location al;
2198 /* TODO: user-configurable print_opts */
2199 const unsigned int print_opts = PRINT_IP_OPT_SYM |
2200 PRINT_IP_OPT_DSO |
2201 PRINT_IP_OPT_UNKNOWN_AS_ADDR;
2202
2203 if (machine__resolve(trace->host, &al, sample) < 0) {
2204 pr_err("problem processing %d event, skipping it.\n",
2205 event->header.type);
2206 goto out_put;
2207 }
2208 perf_evsel__fprintf_callchain(evsel, sample, &al, 38, print_opts,
2209 scripting_max_stack, trace->output);
2210 }
2211out: 2219out:
2212 ttrace->entry_pending = false; 2220 ttrace->entry_pending = false;
2213 err = 0; 2221 err = 0;
@@ -2355,6 +2363,9 @@ static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel,
2355 } 2363 }
2356 2364
2357 fprintf(trace->output, ")\n"); 2365 fprintf(trace->output, ")\n");
2366
2367 trace__fprintf_callchain(trace, evsel, sample);
2368
2358 return 0; 2369 return 0;
2359} 2370}
2360 2371