All proceeds from Ad Clicks goes to the author of this site.

 

Friday, January 21, 2005

My first working dtrace script


#!/usr/sbin/dtrace –s
/* struss v 0.1 by James Dickens */
/* like truss but outputs socket calls as well as syscalls*/

fbt:sockfs::entry
/execname == $$1/
{
printf("sockfs >> arg0=%d , arg1=%d ,arg2=%d",
arg0,arg1,arg2);
}

syscall:::entry
/execname == $$1/
{
printf("syscall >>> arg0=%d, arg1=%d, arg2=%d", arg0,arg1,arg2);
}


in one terminal you start this script

# ./struss wget

then in a second, you run the application that you are monitoring

$ wget http://127.0.0.1/

and here is a bit of sameple output from the script

CPU ID FUNCTION:NAME
0 361 resolvepath:entry syscall >> arg0=134512616, arg1=134509340,arg2=1023
0 361 resolvepath:entry syscall >> arg0=3548371528, arg1=134509340,arg2=1023
0 211 xstat:entry syscall >> arg0=2, arg1=134512616,arg2=134510408
0 15 open:entry syscall >> arg0=3548346916, arg1=0,arg2=0
0 211 xstat:entry syscall >> arg0=2, arg1=3548364600,arg2=134508544
0 211 xstat:entry syscall >> arg0=2, arg1=3548364600,arg2=134508544
0 361 resolvepath:entry syscall >> arg0=3548364600, arg1=134508680,arg2=1023
[.. snipped ...]

well there you have it.. script #1, i will soon be following up with anotther script

0 Comments:

Post a Comment

<< Home