public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: systemtap@sources.redhat.com
Subject: Re: What can I access in return probe
Date: Sat, 17 Dec 2005 23:22:00 -0000	[thread overview]
Message-ID: <20051217230041.GC8314@dmt.cnet> (raw)
In-Reply-To: <1133568441.21429.121.camel@localhost.localdomain>

On Fri, Dec 02, 2005 at 04:07:21PM -0800, Badari Pulavarty wrote:
> Hi,
> 
> I am wondering if I can access arguments in my return probe ?
> And also, how do I access return value ?
>  
> Whats wrong here ?
> 
> # stap -g pagecache.stp
> ERROR: pointer dereference fault near identifier 'page_cache_pages' at
> pagecache.stp:8:2
> 
> 
> Thanks,
> Badari

Hi Badari,

I just tried your script and I wonder why I'm getting negative "nrpages":

mapping = 0xc1115280 nrpages = -1
mapping = 0xc12430c0 nrpages = -1
...

Another issue is that it would be more practical to have actual
bdev+inode number information (which can easily be retrieved from
address_space), to be converted later to real pathname using dcookies
(similar to what oprofile does).

I'm still wondering how to access the "current" task_struct pointer from
a .stp script.


> #! stap
> 
> global page_cache_pages
> 
> function _(n) { return string(n) } 
> 
> probe kernel.function("add_to_page_cache").return {
> 	page_cache_pages[$mapping] = $mapping->nrpages
> }
> 
> probe kernel.function("__remove_from_page_cache") {
> 	page_cache_pages[$page->mapping] = $page->mapping->nrpages
> }
> 
> function report () {
>   foreach (mapping in page_cache_pages) {
> 	print("mapping = " . hexstring(mapping) . 
> 		" nrpages = " . _(page_cache_pages[mapping]) . "\n")
>   }
>   delete page_cache_pages
> }
> 
> probe end {
>   report()
> }

  parent reply	other threads:[~2005-12-17 23:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-03  0:07 Badari Pulavarty
     [not found] ` <4390E8AA.1070105@us.ibm.com>
2005-12-03  0:42   ` Kevin Stafford
2005-12-03  1:35 ` Frank Ch. Eigler
2005-12-17 23:22 ` Marcelo Tosatti [this message]
2005-12-19  4:45   ` Badari Pulavarty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051217230041.GC8314@dmt.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=pbadari@us.ibm.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).