Skip to contentSkip to conversation

perf: make perf script actually spit out backtraces for events

PATCH In review Josef Bacik 2 participants 3 messages Mar 26, 2014 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: make perf script actually spit out backtraces for events

We are trying to debug a problem internally and noticed that if we use perf record -g -e <tracepoint> and then try to use perf script to get the events and their backtraces that we weren't getting the backtraces, even though they were collected and would show up with perf report. For some reason the tracepoint print stuff didn't have the right things set in order to print out backtraces. I have no idea why this is as adding them in there makes the backtraces come out properly, and if we don't use the -g option perf script still acts properly with those options set. Hopefully this is the correct fix, it has fixed the problem for us. Thanks,

---
NOTE: I looked at MAINTAINERS to see if there was a perf list and it didn't look like there was one, sorry if this is the wrong place to send patches to.

 tools/perf/builtin-script.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-script.c +3 -1
index baf1798..6d14c06 100644
@@ -99,7 +99,9 @@ static struct {
 
 		.fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
 				  PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
-				  PERF_OUTPUT_EVNAME | PERF_OUTPUT_TRACE,
+				  PERF_OUTPUT_EVNAME | PERF_OUTPUT_TRACE |
+				  PERF_OUTPUT_IP | PERF_OUTPUT_SYM |
+				  PERF_OUTPUT_DSO,
 	},
 
 	[PERF_TYPE_RAW] = {
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 9 lines · Josef Bacik

We are trying to debug a problem internally and noticed that if we use perf record -g -e <tracepoint> and then try to use perf script to get the events and their backtraces that we weren't getting the backtraces, even though they were collected and would show up with perf report. For some reason the tracepoint print stuff didn't have the right things set in order to print out backtraces. I have no idea why this is as adding them in there makes the backtraces come out properly, and if we don't use the -g option perf script still acts properly with those options set. Hopefully this is the correct fix, it has fixed the problem for us. Thanks,

You can manually request fields using the -f option.

That said ...

Quoted 14 lines

---
NOTE: I looked at MAINTAINERS to see if there was a perf list and it didn't look like there was one, sorry if this is the wrong place to send patches to.

  tools/perf/builtin-script.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-script.c +0 -0
index baf1798..6d14c06 100644

tools/perf/builtin-script.c static struct { · line 104

Quoted 7 lines
tools/perf/builtin-script.c +3 -1
@@ -99,7 +99,9 @@ static struct {
 
  		.fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
  				  PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
-				  PERF_OUTPUT_EVNAME | PERF_OUTPUT_TRACE,
+				  PERF_OUTPUT_EVNAME | PERF_OUTPUT_TRACE |
+				  PERF_OUTPUT_IP | PERF_OUTPUT_SYM |
+				  PERF_OUTPUT_DSO,

A change has been applied to upstream:
https://lkml.org/lkml/2013/11/30/63

David

#2 lore raw
Quoted 39 lines · David Ahern
Quoted 9 lines · Josef Bacik

We are trying to debug a problem internally and noticed that if we use perf
record -g -e <tracepoint> and then try to use perf script to get the events and
their backtraces that we weren't getting the backtraces, even though they were
collected and would show up with perf report. For some reason the tracepoint
print stuff didn't have the right things set in order to print out

Quoted 8 lines

backtraces.
I have no idea why this is as adding them in there makes the backtraces come out
properly, and if we don't use the -g option perf script still acts properly with
those options set. Hopefully this is the correct fix, it has fixed the problem
for us. Thanks,

You can manually request fields using the -f option.

That said ...

Quoted 16 lines

---
NOTE: I looked at MAINTAINERS to see if there was a perf list and it didn't look
like there was one, sorry if this is the wrong place to send patches to.

  tools/perf/builtin-script.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-script.c +0 -0
index baf1798..6d14c06 100644
@@ -99,7 +99,9 @@ static struct {
 
Quoted 10 lines

tools/perf/builtin-script.c static struct { · line 104

Quoted 6 lines
tools/perf/builtin-script.c +3 -1
          .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
                    PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
-                  PERF_OUTPUT_EVNAME | PERF_OUTPUT_TRACE,
+                  PERF_OUTPUT_EVNAME | PERF_OUTPUT_TRACE |
+                  PERF_OUTPUT_IP | PERF_OUTPUT_SYM |
+                  PERF_OUTPUT_DSO,

A change has been applied to upstream:
https://urldefense.proofpoint.com/v1/url?u=https://lkml.org/lkml/2013/11/30/63&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=cKCbChRKsMpTX8ybrSkonQ%3D%3D%0A&m=kB8XhiqkBzGE%2BTCnMhkJQP%2BjerKZ5bWPi%2BqGVVwGKPg%3D%0A&s=c232c9e9ea4eb35f56ba43dd8e7e70589e016430a7b4a5a89f7c938d05bd7b7a

Argh sorry I was testing on my tree but I'm still 3.13 based. Thanks,

Josef