Skip to contentSkip to conversation

Access to backtraces from user-space tracepoint callback in perf-script?

DISCUSSION Milian Wolff 4 participants 7 messages Apr 29, 2014 – May 17, 2014

lore
Share & tools
lore
#0 lore raw

Hello,

today I played around with perf-script(-python) and custom tracepoints. What I could not figure out so far is how to print a backtrace from the python callback. Can someone explain me how this is done, or point me to the documentation for this?

Bye

Signature · 3 lines
Milian Wolff
[email protected]
http://milianw.de
#1 lore raw
Quoted 6 lines · On Tuesday 29 April 2014 17:44:54 Milian Wolff wrote:

Hello,

today I played around with perf-script(-python) and custom tracepoints. What I could not figure out so far is how to print a backtrace from the python callback. Can someone explain me how this is done, or point me to the documentation for this?

Ping? Could someone help me here please?

Signature · 3 lines
Milian Wolff
[email protected]
http://milianw.de
#2 lore raw

Hi Milian,

Quoted 9 lines · Milian Wolff
Quoted 6 lines · On Tuesday 29 April 2014 17:44:54 Milian Wolff wrote:

Hello,

today I played around with perf-script(-python) and custom tracepoints. What I could not figure out so far is how to print a backtrace from the python callback. Can someone explain me how this is done, or point me to the documentation for this?

Ping? Could someone help me here please?

As far as I know it's not possible currently.. I vaguely recall that there's a patch to support the feature but unfortunately it didn't get reviews..

Thanks,
Namhyung

#3 lore raw
Quoted 11 lines · On Wednesday 14 May 2014 09:33:35 Namhyung Kim wrote:

Hi Milian,

Quoted 8 lines · Milian Wolff
Quoted 6 lines · On Tuesday 29 April 2014 17:44:54 Milian Wolff wrote:

Hello,

today I played around with perf-script(-python) and custom tracepoints. What I could not figure out so far is how to print a backtrace from the python callback. Can someone explain me how this is done, or point me to the documentation for this?

Quoted 5 lines
Quoted 1 line

Ping? Could someone help me here please?

As far as I know it's not possible currently.. I vaguely recall that there's a patch to support the feature but unfortunately it didn't get reviews..

Is it this one: https://lkml.org/lkml/2014/4/3/217 ?

If so, could I kindly ask the perf developers to take a look at that? It would be an immensely useful feature for third-party tool developers to have.

Cheers

Signature · 3 lines
Milian Wolff
[email protected]
http://milianw.de
#4 lore raw
Quoted 4 lines · Milian Wolff

[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

today I played around with perf-script(-python) and custom tracepoints. What I could not figure out so far is how to print a backtrace from the python callback. [...]

While you wait, you might try systemtap, wherein there exists support not just for plain C-level backtracing (print_ubacktrace() as for any other program), but also python source-level backtracing (via a tapset function).

https://sourceware.org/systemtap/examples/#general/py2example.stp

- FChE

#5 lore raw
Quoted 9 lines · On Friday 16 May 2014 11:57:02 Frank Ch. Eigler wrote:
Quoted 7 lines · Milian Wolff

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

today I played around with perf-script(-python) and custom tracepoints.
What I could not figure out so far is how to print a backtrace from the
python callback. [...]

Quoted 6 lines

While you wait, you might try systemtap, wherein there exists support not just for plain C-level backtracing (print_ubacktrace() as for any other program), but also python source-level backtracing (via a tapset function).

https://sourceware.org/systemtap/examples/#general/py2example.stp

Hey,

thanks for the hint. But I never got SystemTap to work on any of my machines :-/

For now I'll stick to manual libunwind + libbacktrace + LD_PRELOAD tracing. But I'd love to see this available in perf eventually.

Bye

Signature · 3 lines
Milian Wolff
[email protected]
http://milianw.de
#6 lore raw
Quoted 17 lines · Milian Wolff
Quoted 9 lines · On Friday 16 May 2014 11:57:02 Frank Ch. Eigler wrote:
Quoted 7 lines · Milian Wolff

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

today I played around with perf-script(-python) and custom tracepoints.
What I could not figure out so far is how to print a backtrace from the
python callback. [...]

Quoted 6 lines

While you wait, you might try systemtap, wherein there exists support not just for plain C-level backtracing (print_ubacktrace() as for any other program), but also python source-level backtracing (via a tapset function).

https://sourceware.org/systemtap/examples/#general/py2example.stp

Quoted 8 lines

Hey,

thanks for the hint. But I never got SystemTap to work on any of my machines :-/

For now I'll stick to manual libunwind + libbacktrace + LD_PRELOAD tracing. But I'd love to see this available in perf eventually.

Did you try the patch to perf? Does it give you access to the callchain in python scripts like you want?

David