From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17611 invoked by alias); 3 Jun 2013 23:19:11 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 17602 invoked by uid 89); 3 Jun 2013 23:19:10 -0000 X-Spam-SWARE-Status: No, score=-7.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 03 Jun 2013 23:19:10 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r53NJ8lM006087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 Jun 2013 19:19:08 -0400 Received: from [10.3.113.151] (ovpn-113-151.phx2.redhat.com [10.3.113.151]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r53NJ7se019305; Mon, 3 Jun 2013 19:19:07 -0400 Message-ID: <51AD246B.3060402@redhat.com> Date: Mon, 03 Jun 2013 23:19:00 -0000 From: Josh Stone User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: agentzh CC: David Smith , systemtap@sourceware.org Subject: Re: Accessing user-space global variables in timer.profile? References: <51755D3D.6020004@redhat.com> <5175E28B.9050500@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-q2/txt/msg00229.txt.bz2 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. :)