2.8.1 Example: Displaying the Distribution of Read Sizes Resulting From a Command

As shown in the following example, you can display the distribution of the sizes specified to arg2 of read() calls that were invoked by all instances of find that are running. After running the script, start a search with find in another window, such as find . or find /..

# dtrace -n 'syscall::read:entry /execname=="find"/{@dist["find"]=quantize(arg2);}'
dtrace: description 'syscall::read:entry ' matched 1 probe
^C

   find
            value  ------------- Distribution ------------- count
              256 | 0
              512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6
             1024 | 0
             2048 | 0
             4096 |@@@@@@@@@@ 2
             8192 | 0

If the program is as simple as the program in the previous example, it is often convenient to run it from the command line.