Updated procstat(1)

Skip Ford skip at menantico.com
Wed Nov 28 04:35:40 PST 2007


Skip Ford wrote:
> Robert Watson wrote:
>> On Wed, 28 Nov 2007, Skip Ford wrote:
>> 
>>>>- "-a" now means "all processes",
>>>
>>>Thanks. :-)  I'm a little surprised.  You seemed pretty dedicated to a 
>>>per-process tool.
>> 
>> I was, but then I read your e-mail and became convinced that the first 
>> patch that would be submitted against procstat(1) would be a "-a" patch. :-)
> 
> Yep, would've happened.  Now the first patch submitted will be a
> "-w interval" patch... :-)

I couldn't resist implementing a crude interval arg just for kicks.
Here's the output of find(1) every second.  This is so cool:

$ procstat -k -w 1 948
  PID	 TID COMM		  KSTACK
  948 100099 find		  mi_switch thread_suspend_check userret syscall Xint0x80_syscall
  948 100099 find		  mi_switch sleepq_switch sleepq_wait _sleep bwait bufwait breadn bread ffs_read VOP_READ_APV ufs_readdir VOP_READDIR_APV getdirentries syscall Xint0x80_syscall
  948 100099 find		  mi_switch turnstile_wait _mtx_lock_sleep fdalloc falloc kern_open open syscall Xint0x80_syscall
  948 100099 find		  mi_switch sleepq_switch sleepq_wait _sleep bwait bufwait breadn bread ffs_read VOP_READ_APV ufs_readdir VOP_READDIR_APV getdirentries syscall Xint0x80_syscall
  948 100099 find		  mi_switch critical_exit intr_execute_handlers atpic_handle_intr Xatpic_intr0
  948 100099 find		  mi_switch ast doreti_ast
  948 100099 find		  mi_switch sleepq_switch sleepq_wait _sleep bwait bufwait breadn bread ffs_read VOP_READ_APV ufs_readdir VOP_READDIR_APV getdirentries syscall Xint0x80_syscall
  948 100099 find		  mi_switch turnstile_wait _mtx_lock_sleep fdalloc falloc kern_open open syscall Xint0x80_syscall
  948 100099 find		  mi_switch critical_exit intr_execute_handlers atpic_handle_intr Xatpic_intr0 priv_check vn_stat vn_statfile kern_fstat fstat syscall Xint0x80_syscall
  948 100099 find		  mi_switch sleepq_switch sleepq_wait _sleep bwait bufwait breadn bread ffs_vget ufs_lookup VOP_CACHEDLOOKUP_APV vfs_cache_lookup VOP_LOOKUP_APV lookup namei kern_lstat lstat syscall
  948 100099 find		  mi_switch sleepq_switch sleepq_wait _sleep bwait bufwait breadn bread ffs_read VOP_READ_APV ufs_readdir VOP_READDIR_APV getdirentries syscall Xint0x80_syscall

For someone who isn't intimately familiar with the kernel, this is really
a nice feature for this tool.

I'm attaching the very crude interval patch just because it seems rude
not to, but you probably either don't want it or will do it differently
and either is perfectly fine.  If you do implement it on your own, don't
bother printing a header per screenful since it would be most useful for
kstacks and that output usually spills over to multiple lines anyway.

-- 
Skip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: procstat_interval.diff
Type: text/x-diff
Size: 1083 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20071128/b619e8b3/procstat_interval.bin


More information about the freebsd-hackers mailing list