dtrace translators

March 30th, 2009 | Categories: Boring | Tags:

摘录translator诞生的原因。

A translator is a collection of D assignment statements provided by the supplier of an interface that can be used to translate an input expression into an object of struct type. Like any D statements, the body of the translator can refer directly to kernel types and kernel global data structures, as well as other DTrace variables.

刚学到的就是返回fileinfo_tfds translator了.

#!/usr/sbin/dtrace -s
#
syscall::read:entry
/arg0!=0/
{
trace(execname);
trace(fds[arg0].fi_pathname);
trace(fds[arg0].fi_fs);
}

可以快捷的得到哪个程序在读取哪个文件。

CPU ID FUNCTION:NAME
28 1512 read:entry sshd sockfs
28 1512 read:entry sshd /devices/pseudo/clone@0:ptm specfs
8 1512 read:entry cat /oracle/DB1/home/binzhang/t.d vxfs
8 1512 read:entry cat /oracle/DB1/home/binzhang/tcp.d vxfs

Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪 ViVi 365Key 网摘 天极网摘 和讯网摘 博拉网 POCO 网摘 饭否 QQ 书签 Digbuzz 我挖网 Mister Wong
No comments yet.