Ok,

Here is a quick introduction to DTrace, with one line scripts. This can be
used as basic troubleshooting to point out problems in max 3 commands :-)

1. Find process asking for system calls (it generates system time):

# *dtrace -n 'syscall:::entry { @[probefunc]=count(); }'*
dtrace: description 'syscall:::entry ' matched 237 probes
^C [wait 10 secs]
[...]
  semsys                                           1140
  read                                             1826
  pollsys                                          3340
  ioctl                                            5398
  yield                                           23179

2. Once you find the system call heavily used, let's see which is the
process is asking for it. As Gerald is interested in the IOs, let's check
the ioctl.

# *dtrace -n 'syscall::ioctl:entry { @[execname,pid]=count();}'
*dtrace: description 'syscall::ioctl:entry ' matched 1 probe
^C  [wait 10 secs]
[...]
  Xorg                             636              404
  compiz-bin                       715              423
  soffice.bin                     1057              456
  firefox-bin                      816             3004

3. OK, it's my firefoy the one doing a lot of IOs. Let's see to which
file/connection.

#  *dtrace -n 'syscall::ioctl:entry / pid==816 / { @[arg0]=count();}'
*dtrace: description 'syscall::ioctl:entry ' matched 1 probe
^C

                4             2760

4. If you are only interested in the reads/writes, you can monitor them for
a given process:

# *dtrace -n 'syscall::read*:entry,syscall::write*:entry /pid==816/ {
@[probefunc,arg0]=count();} '*
dtrace: description 'syscall::read*:entry,syscall::write*:entry ' matched 5
probes
^C
[...]
  write                             51             1323
  write                              4             2832
  read                              22             3178
  write                             23             3178
  read                              54             6483
  read                               4             6578

# *pfiles 816*
816:    /usr/lib/firefox/firefox-bin
  Current rlimit: 1024 file descriptors
   4: S_IFSOCK mode:0666 dev:324,0 ino:33179 uid:0 gid:0 size:0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
    SOCK_STREAM
    SO_SNDBUF(16384),SO_RCVBUF(5120)
    sockname: AF_UNIX
    peername: AF_UNIX /tmp/.X11-unix/X0
  22: S_IFIFO mode:0000 dev:313,0 ino:606 uid:101 gid:10 size:0
      O_RDWR|O_NONBLOCK
  23: S_IFIFO mode:0000 dev:313,0 ino:606 uid:101 gid:10 size:0
      O_RDWR|O_NONBLOCK
  51: S_IFSOCK mode:0666 dev:324,0 ino:50064 uid:0 gid:0 size:0
      O_RDWR|O_NONBLOCK
    SOCK_STREAM
    SO_SNDBUF(49152),SO_RCVBUF(49680)
    sockname: AF_INET 192.168.200.167  port: 35980
    peername: AF_INET 74.125.39.19  port: 443
  54: S_IFSOCK mode:0666 dev:324,0 ino:43204 uid:0 gid:0 size:0
      O_RDWR|O_NONBLOCK
    SOCK_STREAM
    SO_SNDBUF(49152),SO_RCVBUF(49680)
    sockname: AF_INET 192.168.200.167  port: 44800
    peername: AF_INET 204.152.191.104  port: 80

--> In my case, a part from the usual internal stuff of firefox to draw the
X window, the connection generating the more IOs is a read from
204.152.191.104 (a download from rsync.genunix.org).

Gerald, if you need something more precisely, let me know.

Cheers,

Javi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.opensolaris.org/pipermail/ug-chosug/attachments/20091208/7a7bce65/attachment.html>

Reply via email to