NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to see disk I/O per process in NetBSD?



bartosz%maciejewski.org@localhost (Bartosz Maciejewski) writes:

>Is there any way to see which process is doing read and writes on file 
>system?

I/O isn't strictly connected to individual processes, so you cannot
perfectly identify which process caused a particular I/O operation.


>I need something similiar to iotop from Linux, or sorting option 'm' 
>from FreeBSD ( top -m io -o total)

>Even glances doesn't show proper I/O - everything is 0/0

Each process counts input and output operations, but this is only
done for I/O passing the old buffer cache, not for I/O done by
the VM system. So the values are mostly zero. E.g.:

% /usr/bin/time -l find /usr >/dev/null
        0.35 real         0.06 user         0.13 sys
      2640  maximum resident set size
         1  average shared memory size
         0  average unshared data size
       136  average unshared stack size
       407  page reclaims
         0  page faults
         0  swaps
      2160  block input operations                   <---------------
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
      2154  voluntary context switches
         4  involuntary context switches

You see that walking a directory causes buffer cache operations
that are counted.

% find /usr | /usr/bin/time -l cpio -o > /dev/null
7308724 blocks
       20.99 real         1.83 user        12.58 sys
      3536  maximum resident set size
         0  average shared memory size
         0  average unshared data size
         1  average unshared stack size
       398  page reclaims
         0  page faults
         0  swaps
      1448  block input operations              <-----------------
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
     53230  voluntary context switches
      1275  involuntary context switches

Actually reading files adds some more operations (for reading
file metadata). But the bulk of I/O operations for reading file
data isn't counted at all. Repeating the last yields:

% find /usr | /usr/bin/time -l cpio -o > /dev/null
7308724 blocks
       12.70 real         1.91 user        10.78 sys
      3604  maximum resident set size
         0  average shared memory size
         0  average unshared data size
         0  average unshared stack size
       400  page reclaims
         0  page faults
         0  swaps
         0  block input operations               <------------------
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
        16  voluntary context switches
        30  involuntary context switches

as all meta-data is already cached while data is still read, but you
don't see it in th statistics.

If that gets fixed, it would still be a per-process summary. You wouldn't
see to which device the particular I/O requests are sent to.

-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index