This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What can I access in return probe


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()
> }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]