This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Accessing user-space global variables in timer.profile?
- From: Josh Stone <jistone at redhat dot com>
- To: agentzh <agentzh at gmail dot com>
- Cc: David Smith <dsmith at redhat dot com>, systemtap at sourceware dot org
- Date: Mon, 03 Jun 2013 16:19:07 -0700
- Subject: Re: Accessing user-space global variables in timer.profile?
- References: <CAB4Tn6OYi=Vx19H4BLojphuuvjSp2drjvJFd3HxzAGj7=yD5cA at mail dot gmail dot com> <51755D3D dot 6020004 at redhat dot com> <CAB4Tn6OubWF71F9b3hNqXo85h96sr1Rp77-NmZAjmLPt=vAzyA at mail dot gmail dot com> <5175E28B dot 9050500 at redhat dot com> <CAB4Tn6ORHjkv+CuAN90Ju+gKEohSyNvpdvoq-fEsEEdUgAzjgg at mail dot gmail dot com> <CAB4Tn6OrHSPKiuvbuPLQ-TiROzJ2fYWJ8WK5yTrGktypPeBqGQ at mail dot gmail dot com>
On 06/01/2013 12:46 AM, agentzh wrote:
> Hello!
>
> On Wed, May 29, 2013 at 9:00 PM, agentzh wrote:
>> Okay, I've come up with a (naive) patch to implement
>> @var("somevar@somefile", "somemodule") for stap user functions and
>> context-free probe handlers (see below). It works for me on Fedora 17,
>> both in a function or in timer.profile.
>>
>
> Okay, based on this new feature, I've just written a systemtap-based
> tool named pl-sample-bt that can sample and aggregate Perl-land
> backtraces for a specified perl process at the Linux system ticks:
>
> https://github.com/agentzh/perl-systemtap-toolkit#pl-sample-bt
>
> Its output can then be used to render "Perl-land Flame Graphs" by
> Brendan Gregg's FlameGraph tool chain, for example:
>
> http://agentzh.org/misc/flamegraph/perl-test-nginx-socket.svg
>
> Essentially, pl-sample-bt emulates dtrace's jstack() thing for Perl 5.
> And I just ported the Perl_pp_caller function in the perl 5 core over
> to the stap language. The basic approach may well apply to other high
> level languages' VMs :)
Very cool! In fact, if we can tease the script portions of this away
from perl-generation, it would be great to make an example script out of
this. Hey, I'm sure if you're probing perl, then you're perfectly
comfortable writing perl to drive stap, but we need to be kinder in the
examples we present. :)
If I read it correctly, the dynamic pieces of this script are mostly
just to avoid repeating yourself - is that right? I think with a
parameter for $perl_path, you can do the rest with macros. Maybe a
second parameter for the $minor_version variations.
I certainly won't force you to change, but it would make a nice in-tree
showcase for @var-module support. :)