From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18701 invoked by alias); 23 Apr 2013 00:39:14 -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 18689 invoked by uid 89); 23 Apr 2013 00:39:14 -0000 X-Spam-SWARE-Status: No, score=-5.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ob0-f170.google.com (HELO mail-ob0-f170.google.com) (209.85.214.170) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 23 Apr 2013 00:39:11 +0000 Received: by mail-ob0-f170.google.com with SMTP id eh20so61446obb.29 for ; Mon, 22 Apr 2013 17:39:10 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.164.8 with SMTP id ym8mr15560252obb.68.1366677550174; Mon, 22 Apr 2013 17:39:10 -0700 (PDT) Received: by 10.182.1.100 with HTTP; Mon, 22 Apr 2013 17:39:10 -0700 (PDT) In-Reply-To: <51755D3D.6020004@redhat.com> References: <51755D3D.6020004@redhat.com> Date: Tue, 23 Apr 2013 00:39:00 -0000 Message-ID: Subject: Re: Accessing user-space global variables in timer.profile? From: agentzh To: David Smith Cc: systemtap@sourceware.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2013-q2/txt/msg00052.txt.bz2 Hello! On Mon, Apr 22, 2013 at 8:54 AM, David Smith wrote: > > I believe I see what you are asking here, but I'm afraid it just isn't > possible. When we're in a process.* probe, probes run in the context of > a process, so you can access that process' state and memory. When we're > in a timer.* probe, probes don't really run in the context of any > particular user process, they run in kernel context. At that point, any > specific user process can't really be accessed. That specific user > process might have been swapped out for instance. > Because I only sample a process with relatively high CPU usage, the odds of swapping out the pages that I'm interested in should be really small. And I'm fine with getting a runtime warning when the memory page is indeed swapped out, for example. We are already able to fetch the current userspace backtraces in the timer.profile context, for example. And it should be an excellent addition if we can access more data like global variables in the current user process. > So, how to do what you want and be able to sample a user-space global > variable at a timed interval? If the program has any timers itself, the > easiest solution would be to probe the program's timer function. > Thank you for the suggestion but the values of my global variables change *very* frequently and probing on every calls that may change the variables is just a bit too expensive for me because I'm doing online profiling in a production environment where reducing the instrumentation cost means a lot. Thanks! -agentzh