Dtrace通过分发获得写入大小

时间:2013-04-29 03:04:25

标签: macos dtrace

我正在尝试通过进程获得写入大小分布。我跑了:

sudo dtrace -n 'sysinfo:::writech { @dist[execname] = quantize(arg0); }' 

并收到以下错误:

dtrace: invalid probe specifier sysinfo:::writech...

这是Mac OSX。请帮忙。

1 个答案:

答案 0 :(得分:0)

错误消息告诉您Mac OS X不支持sysinfo:::提供程序。也许你打算使用其中一种?

# dtrace -ln sysinfo::writech:
   ID   PROVIDER            MODULE                          FUNCTION NAME
dtrace: failed to match sysinfo::writech:: No probe matches description
# dtrace -ln sysinfo:::
   ID   PROVIDER            MODULE                          FUNCTION NAME
dtrace: failed to match sysinfo:::: No probe matches description
# dtrace -ln 'syscall::write*:'
   ID   PROVIDER            MODULE                          FUNCTION NAME
  147    syscall                                               write entry
  148    syscall                                               write return
  381    syscall                                              writev entry
  382    syscall                                              writev return
  933    syscall                                      write_nocancel entry
  934    syscall                                      write_nocancel return
  963    syscall                                     writev_nocancel entry
  964    syscall                                     writev_nocancel return

以下脚本适合我:

# dtrace -n 'syscall::write:entry {@dist[execname] = quantize(arg0)}' 
dtrace: description 'syscall::write:entry ' matched 1 probe
^C

  activitymonitor                                   
           value  ------------- Distribution ------------- count    
               2 |                                         0        
               4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
               8 |                                         0        

  Activity Monito                                   
           value  ------------- Distribution ------------- count    
               2 |                                         0        
               4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
               8 |                                         0        
...