This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: What can I access in return probe
- From: Marcelo Tosatti <marcelo dot tosatti at cyclades dot com>
- To: Badari Pulavarty <pbadari at us dot ibm dot com>
- Cc: systemtap at sources dot redhat dot com
- Date: Sat, 17 Dec 2005 21:00:41 -0200
- Subject: Re: What can I access in return probe
- References: <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()
> }