Diff for /wikisrc/tutorials/how_to_enable_and_run_dtrace.mdwn between versions 1.5 and 1.14

version 1.5, 2014/04/03 11:55:12 version 1.14, 2017/03/22 15:33:08
Line 7  DTrace is a Dynamic Tracing framework de Line 7  DTrace is a Dynamic Tracing framework de
 DTrace is a work-in-progress effort and it is for x86 systems and some arm boards.  DTrace is a work-in-progress effort and it is for x86 systems and some arm boards.
 * i386 and amd64  * i386 and amd64
 * evbarm  * earm* (evbarm and armv4 based ports (armv4 side requires further testing but system is built with CTF)
 ## Supported providers  ## Supported providers
 * SDT: Statically Defined Tracing  * SDT: Statically Defined Tracing
 * FBT: Function Boundary Tracing  * FBT: Function Boundary Tracing
   * Lockstat: Kernel Lock Statistics
   * Profile: Time based interrupt event source for Profiling
   * Syscall: System Calls
   * Syscall Linux (32bit & 64 bit): System calls via the Linux binary emulation layer
 You can currently run a hello world DScript.   ## TODO for netbsd-7
   * Measure effect of `options KDTRACE_HOOKS` on system performance.
   * Determine whether the profile module works and list it here.
   * Integrate [[riz|users/riz]]'s syscall provider patch.
   ## TODO for netbsd-6
   Need to identify changes to pull up to netbsd-6 and pull them up.
   * Profile provider.
 # How to use  # How to use
Line 23  You can currently run a hello world DScr Line 37  You can currently run a hello world DScr
 You need the following options in your kernel:   You need the following options in your kernel: 
     options         INSECURE      options         KDTRACE_HOOKS   # kernel DTrace hooks
     options         KDTRACE_HOOKS   # DTrace support  
     options         MODULAR      options         MODULAR
 You also need to build distribution with the options MKMODULAR=yes and MKDTRACE=yes.   Optionally:
       options         INSECURE   # permit modules to loaded from user space once system has gone multiuser and securelevel has been raised.
 ##  Running hello world   A Distribution needs to be built with the options `MKDTRACE=yes` and `MKCTF=yes`, this is taken care of automatically and doesn't need to be specified manually. The list of platforms it is applied to automatically is set in `src/share/mk/bsd.own.mk`
 Load the solaris and dtrace modules, and the SDT (Statically Defined Tracing) and FBT (Function Boundary Tracing) modules:   Set the system to load the solaris and dtrace related modules in `/etc/modules.conf`, for a list of available modules, see `/stand/$MACHINE/$VERSION/modules/`
     modload solaris      solaris
     modload dtrace      dtrace
     modload sdt      dtrace_sdt
     modload fbt      dtrace_fbt
   A `dtrace` device node is created automatically in `/dev/dtrace` when the modules are loaded into place.
 Make the dtrace device node:   
     mkdir /dev/dtrace  
     mknod /dev/dtrace/dtrace c dtrace 0  
 List the dtrace probes   List the dtrace probes 
     dtrace -l      dtrace -l
Line 68  List the dtrace probes  Line 79  List the dtrace probes 
         .          .
     29140       proc                                                     lwp_start      29140       proc                                                     lwp_start
     29141       proc                                                     lwp_exit      29141       proc                                                     lwp_exit
   ##  Running hello world 
 Put the following into the file hello.d   Put the following into the file hello.d:
     BEGIN      BEGIN
     {      {
Line 91  Run the hello world script:  Line 101  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 in the kernel:   A more complex example that traces the execution of a sleep operation
   in the kernel. Put it in sleep.d:
     #pragma D option flowindent      #pragma D option flowindent
Line 102  A more complex example that traces the e Line 113  A more complex example that traces the e
             printf("fd: %d", arg0);              printf("fd: %d", arg0);
     }      }
     fbt:::      fbt::syscall:entry /self->traceme/ {}
     fbt::syscall:return      fbt::syscall:return
     /self->traceme/      /self->traceme/
Line 114  A more complex example that traces the e Line 123  A more complex example that traces the e
     }      }
 Start the script running (dtrace -s <scriptname.d>) and then execute a sleep 2 in another shell.   Start the script running (dtrace -s sleep.d) and then execute a "sleep 2" in another shell. 

Removed from v.1.5  
changed lines
  Added in v.1.14

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