DTrace for FreeBSD - Status Update

John Birrell jb at what-creek.com
Wed May 24 23:55:12 PDT 2006


It's nearly 8 weeks since I started porting DTrace to FreeBSD and I
thought I would post a status update including today's significant
emotional event. 8-)

For those who don't know what DTrace is or which company designed it,
here are a few links:

The BigAdmin: <http://www.sun.com/bigadmin/content/dtrace/>
A Blurb: <http://www.sun.com/2004-0518/feature/index.html>
The Guide: <http://docs.sun.com/app/docs/doc/817-6223>
My FreeBSD Project Page: <http://people.freebsd.org/~jb/dtrace/index.html>

Much of the basic DTrace infrastructure is in place now. Of the 1039
DTrace tests that Sun runs on Solaris, 793 now pass on FreeBSD.

We've got the following providers:

- dtrace
- profile
- syscall
- sdt
- fbt

As of today, loading those providers on a GENERIC kernel gives 32,519 probes.

Today's significant emotional event added over 30,000 of those, thanks
to the Function Boundary Tracing (fbt) provider. It provides the
instrumentation of the entry and return of every (non-leaf) function
in the kernel and (non-DTrace provider) modules.

Here is an example of what fbt can do.... The following script creates
a probe on the entry to the kernel malloc() function. It dereferences 
the second argument to the malloc_type structure and then quantizes the
size of the mallocs being made according to the malloc type name.

The script:

fbt:kernel:malloc:entry
{
        mt = (struct malloc_type *) arg1;
        @[stringof(mt->ks_shortdesc)] = quantize(arg0)
}


The output:


  vmem                                              
           value  ------------- Distribution ------------- count    
               2 |                                         0        
               4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 56       
               8 |                                         0        

  ufs_dirhash                                       
           value  ------------- Distribution ------------- count    
               4 |                                         0        
               8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              6        
              16 |                                         0        
              32 |                                         0        
              64 |                                         0        
             128 |                                         0        
             256 |@@@@@@@@@@@@@                            3        
             512 |                                         0        

  UMAHash                                           
           value  ------------- Distribution ------------- count    
             512 |                                         0        
            1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
            2048 |                                         0        

  vnodemarker                                       
           value  ------------- Distribution ------------- count    
             128 |                                         0        
             256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
             512 |                                         0        

  Unitno                                            
           value  ------------- Distribution ------------- count    
               8 |                                         0        
              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 130      
              32 |                                         0        

  sysctl                                            
           value  ------------- Distribution ------------- count    
               4 |                                         0        
               8 |@@@@@@@@@@@@@@@@@@                       77       
              16 |@@@@@@@@@@@@@@@@@@@@@@                   95       
              32 |                                         0        

  DEVFS3                                            
           value  ------------- Distribution ------------- count    
              32 |                                         0        
              64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 56       
             128 |                                         0        

  plimit                                            
           value  ------------- Distribution ------------- count    
              64 |                                         0        
             128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 28       
             256 |                                         0        

  proc-args                                         
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@                   48       
              64 |@@@@@@@@@@@@@@@@@@                       38       
             128 |                                         0        

  zombie                                            
           value  ------------- Distribution ------------- count    
              32 |                                         0        
              64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 86       
             128 |                                         0        

  kmem                                              
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@             24       
              64 |                                         0        
             128 |                                         0        
             256 |                                         0        
             512 |@@@@@@@@@@@@                             10       
            1024 |                                         0        

  sysctltmp                                         
           value  ------------- Distribution ------------- count    
               2 |                                         0        
               4 |@@@@@                                    28       
               8 |@@@@@@@@@@                               56       
              16 |@@@@@@@@@@                               56       
              32 |@@@@@@@@@@                               56       
              64 |                                         0        
             128 |@@@@@                                    28       
             256 |                                         0        

  filedesc                                          
           value  ------------- Distribution ------------- count    
              64 |                                         0        
             128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 86       
             256 |                                         0        

  nfsclient_req                                     
           value  ------------- Distribution ------------- count    
              32 |                                         0        
              64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 213      
             128 |                                         0        

  DEVFS1                                            
           value  ------------- Distribution ------------- count    
              64 |                                         0        
             128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 112      
             256 |                                         0        

  ioctlops                                          
           value  ------------- Distribution ------------- count    
               2 |                                         0        
               4 |@@@@@@@@@@@@@@@@@@@@                     573      
               8 |@                                        30       
              16 |@@                                       60       
              32 |@@@@@@@@@                                264      
              64 |@@                                       60       
             128 |                                         0        
             256 |@@@@@@                                   175      
             512 |                                         0        

  soname                                            
           value  ------------- Distribution ------------- count    
               8 |                                         0        
              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8991     
              32 |                                         0        

  subproc                                           
           value  ------------- Distribution ------------- count    
            1024 |                                         0        
            2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 86       
            4096 |                                         0        

  cred                                              
           value  ------------- Distribution ------------- count    
              32 |                                         0        
              64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10403    
             128 |                                         0        

  nfsserver_srvdesc                                 
           value  ------------- Distribution ------------- count    
               4 |                                         0        
               8 |@@@@@@@@@@@@@@@@@@@@                     8991     
              16 |                                         0        
              32 |                                         0        
              64 |                                         0        
             128 |@@@@@@@@@@@@@@@@@@@@                     8991     
             256 |                                         0        

  temp                                              
           value  ------------- Distribution ------------- count    
               4 |                                         0        
               8 |@@@@@@@@@@@@@                            935      
              16 |@@                                       151      
              32 |@@@                                      184      
              64 |@                                        66       
             128 |@                                        97       
             256 |                                         30       
             512 |                                         22       
            1024 |                                         13       
            2048 |                                         4        
            4096 |                                         28       
            8192 |@@@@@@@@@@@@@@@@@@@                      1359     
           16384 |                                         0        

  dtrace                                            
           value  ------------- Distribution ------------- count    
               0 |                                         0        
               1 |@                                        23       
               2 |                                         19       
               4 |@@@                                      118      
               8 |@@@@@                                    182      
              16 |@@@@@                                    211      
              32 |@@@@@@@@@@@@@@@@@                        689      
              64 |@                                        31       
             128 |@                                        29       
             256 |@@                                       99       
             512 |@                                        24       
            1024 |@@@                                      135      
            2048 |                                         5        
            4096 |                                         0        
            8192 |                                         0        
           16384 |                                         0        
           32768 |                                         0        
           65536 |                                         0        
          131072 |                                         0        
          262144 |                                         0        
          524288 |                                         0        
         1048576 |                                         10       
         2097152 |                                         0        
         4194304 |@                                        20       
         8388608 |                                         0        

There is still a lot of work to do and while that goes on, the code has
to remain in the FreeBSD perforce server. It isn't ready to get merged
into CVS-current yet.

I have asked the perforce-admins to mirror the project out to CVS (via
cvsup10.freebsd.org), but I'm not sure what the hold-up there is.

I had hoped that one or two of the Google SoC students would contribute
to this, but I only received one proposal and that wasn't for anything
that would help get DTrace/FreeBSD completed.

There are things people can do to help. Some of them are build related;
some are build tool related; some are user-land DTrace specific; and the
rest are kernel related. Speak up if you are interested in working on
this!

--
John Birrell


More information about the freebsd-current mailing list