Diff for /wikisrc/tutorials/how_to_enable_and_run_dtrace.mdwn between versions 1.22 and 1.23

version 1.22, 2017/10/13 08:24:18 version 1.23, 2018/05/24 17:37:35
Line 105  Run the hello world script:  Line 105  Run the hello world script: 
       0      1                           :BEGIN   Hello world        0      1                           :BEGIN   Hello world
           
   
 A more complex example that traces the execution of a sleep operation  ## A more complex example
   
   The following script traces the execution of a sleep operation
 in the kernel. Put it in sleep.d:  in the kernel. Put it in sleep.d:
           
     #pragma D option flowindent      #pragma D option flowindent
       
     fbt::syscall:entry      syscall::nanosleep:entry
     /execname == "sleep" && guard++ == 0/      /execname == "sleep" && guard++ == 0/
     {      {
             self->traceme = 1;              self->traceme = 1;
             printf("fd: %d", arg0);  
     }      }
       
     fbt::syscall:entry /self->traceme/ {}      fbt:::
           /self->traceme/
     fbt::syscall:return      {}
   
       syscall::nanosleep:return
     /self->traceme/      /self->traceme/
     {      {
             self->traceme = 0;              self->traceme = 0;
             exit(0);              exit(0);
     }      }
       
   
 Start the script running (dtrace -s sleep.d) and then execute a "sleep 2" in another shell.   Start the script running:
   
       dtrace -s sleep.d
   
   This will take a while as the script instruments every function in the
   kernel. When it's ready, it will print a message like "dtrace: script
   'sleep.d' matched 59268 probes".  Then execute a "sleep 2" in another
   shell.
   
 ## Tools included base  ## Tools included base
   

Removed from v.1.22  
changed lines
  Added in v.1.23


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb