dtrace
Opera で設定の保存をするときが異常に遅いので、何が原因かなーと思って。
設定を変更した・しないに関わらず、「保存」を押してから5秒〜10秒待たないとダイアログが消えないのは明らかに変。
というわけで dtrace ↓を使ってみてる。
まずこれをやってみたが、unlink にしか引っかかってくれない。read、write で遅いわけじゃないのか。
次にこれを発見。
ほかにもシステムコールの統計を知りたい場合は、次のように実行します。
sudo dtrace -n syscall:::entry'/execname == "mdfind"/{@count_table[probefunc] = count()}'
Mac OS Xと戯れる : SpotlightとDtrace - livedoor Blog(ブログ)
おもしろそう。
% sudo dtrace -n syscall:::entry'/execname == "Opera"/{@count_table[probefunc] = count()}' dtrace: description 'syscall:::entry' matched 427 probes ^C __disable_threadsignal 1 bsdthread_create 1 bsdthread_terminate 1 unlink 1 connect 2 fstat 2 getdtablesize 2 getpeername 2 kill 2 lseek 2 posix_spawn 2 sendto_nocancel 2 socket 2 socketpair 2 wait4 2 fcntl_nocancel 4 setsockopt 4 getdirentriesattr 6 getsockopt 6 open 6 recvfrom_nocancel 6 sendto 10 close 11 close_nocancel 11 fstat64 11 getattrlist 11 open_nocancel 11 getuid 13 stat 13 recvfrom 14 access 20 kevent 20 flock 22 select 23 stat64 26 geteuid 39 read_nocancel 51 mmap 204 munmap 278 fcntl 5383
fcntl 5383回? 普通なのこれ? アクセスしてるファイル名を調べるにはどうしたらいいのかな。
追記。
copyinstr(arg0) でいいのか。
% sudo dtrace -n syscall::fcntl:entry'/execname == "Opera"/{trace(copyinstr(arg0))}' Password: dtrace: description 'syscall::fcntl:entry' matched 1 probe dtrace: error on enabled probe ID 1 (ID 17831: syscall::fcntl:entry): invalid address (0x1a5) in action #1 at DIF offset 28 以下同じようなのが多数
意味わかりません。
あった。
DTrace Topics Errors - Siwikiinvalid address (0x...) in action
# dtrace -n 'syscall::open:entry { trace(stringof(arg0)); }' dtrace: description 'syscall::open:entry ' matched 1 probe dtrace: error on enabled probe ID 1 (ID 6329: syscall::open:entry): invalid address (0xd27f7a24) in action #1 dtrace: error on enabled probe ID 1 (ID 6329: syscall::open:entry): invalid address (0xd27fbf38) in action #1This error is caused when DTrace attempts to dereference a memory address which isn't mapped. In the above example, the arg0 variable for the open(2) syscall refers to a user-land address, however DTrace executes in the kernel address space; this example can be fixed by changing stringof to copyinstr. Listing remedies:
- Use either copyin() or copyinstr() to copy the data from user-land into the kernel.
- Attempt to dereference on the return of a function, not the entry. On the entry, an address may be valid but not faulted in.
まったくわからん。
追記。
なんか毎回変わってるみたいだな。
% sudo dtrace -n syscall:::entry'/execname == "Opera"/{@count_table[probefunc] = count()}' dtrace: description 'syscall:::entry' matched 427 probes ^C __disable_threadsignal 1 bsdthread_create 1 bsdthread_terminate 1 write_nocancel 4 unlink 5 close 7 getdirentriesattr 7 open 7 lseek 14 fstat64 15 getattrlist 15 getuid 22 kevent 23 open_nocancel 23 access 27 close_nocancel 28 stat64 30 flock 51 geteuid 67 read_nocancel 71 stat 231 mmap 309 munmap 381 fstat 495