如何在dtrace中找到参数的意思 [英] how to find arguments mean in dtrace
问题描述
代码
dtrace -n 'syscall::read:entry /execname != "dtrace"/ { @reads[execname, fds[arg0].fi_pathname] = count(); }'
dtrace: description 'syscall::read:entry ' matched 1 probe
^C
bash /proc/1709/psinfo 1
loader /zp/space/f2 1
nscd /etc/user_attr 1
bash /export/home/mauroj/.bash_history 2
loader /zp/space/f3 2
nscd /etc/group 2
su /etc/default/su 8
su /devices/pseudo/sy@0:tty 9
bash /dev/pts/5 66
Xorg /devices/pseudo/conskbd@0:kbd 152
gnome-terminal /devices/pseudo/clone@0:ptm 254
dtrace代码fds[arg0].fi_pathname
如何查看dtrace调用参数是什么意思,我尝试使用
how to see the dtrace call arguments what's mean,i try to use
trace -lv 'syscall:fds:read:entry' |head
ID PROVIDER MODULE FUNCTION NAME
1 dtrace BEGIN
Probe Description Attributes
Identifier Names: Stable
Data Semantics: Stable
Dependency Class: Common
Argument Attributes
Identifier Names: Stable
但是找不到参数?
怎么看这些装饰物的意思呢?
例如fds[arg0].fi_pathname
but can't find the arguments?
how see these argements mean?
eg fds[arg0].fi_pathname
举另一个例子:
dtrace -n 'io:::start { @bytes = quantize(args[0]->b_bcount); }'
如何知道args [0]-> b_count表示系统调用字节
how to known the args[0]->b_count meant syscall bytes
推荐答案
As the documentation explains, for the syscall provider's entry probes, arg0
, arg1
etc. are the system call's arguments themselves. For syscall::read:entry
, then, looking at the read(2)
man page shows
ssize_t read(int fildes, void *buf, size_t nbyte);
,因此arg0
是fildes
的值.
不幸的是,fds[]
似乎没有在官方文档中进行描述. fds[]
与DTrace提供给将文件描述符翻译成 fileinfo_t
一个>. fileinfo_t
是一种稳定的结构,可提供有关文件的有用信息,而不会向用户公开实现细节.
Unfortunately, fds[]
doesn't appear to be described in the official documentation. fds[]
is something, similar to a subroutine, that DTrace provides to translate a file descriptor into a fileinfo_t
. The fileinfo_t
is a stable structure that provides useful information about a file without exposing the implementation details to the user.
io提供程序的文档指出: ,对于io:::start
,args[0]
是指向struct buf
的指针.这是另一个文档错误:实际上是指向struct bufinfo
的指针,该指针在同一页面上进行了描述.
The documentation for the io provider states that, for io:::start
, args[0]
is a pointer to a struct buf
. This is another documentation bug: it's actually a pointer to a struct bufinfo
, which is described on the same page.
这篇关于如何在dtrace中找到参数的意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!