hog
Section: User Commands (1C)
Updated: CMD
Index
Return to Main Contents
NAME
memhog - memory hog analyser
cpuhog - cpu hog analyser
iohog - I/O hog analyser
SYNOPSIS
memhog
[
-p
num
] [
-c
cols
] [
-l
lines
] [
-w
] [
-t
] [
-i
interval
] [
-s
smooth
] [
-D
] [
-T
] [
-V
]
iohog
[
-p
num
] [
-c
cols
] [
-l
lines
] [
-w
] [
-t
] [
-i
interval
] [
-s
smooth
] [
-d
char | swap
] [
-D
] [
-T
] [
-V
]
cpuhog
[
-p
num
] [
-c
cols
] [
-l
lines
] [
-w
] [
-t
] [
-i
interval
] [
-s
smooth
] [
-d
system | user | load
] [
-V
] [
-%
] [
-D
] [
-T
]
DESCRIPTION
The
hog
commands analyse resource use by processes.
The
hog
commands all work in the same basic way, but observe the consumption
of different resources.
memhog
examines memory use,
cpuhog
examines processor use,
and
iohog
examines I/O use.
In the following discussion,
hog
means one of the
possible invocations (e.g., memhog), and
resource
refers to the resource in which that
hog
is interested.
hog
runs in a loop.
Each time it loops,
the
resource
consumption for each process is obtained from the kernel,
and a ``hog'' value computed,
based on a
resource-specific
algorithm.
The algorithm
is intended to measure the overall impact of a process
on the
resource.
After the ``hog'' values are computed,
the processes are displayed in descending ``hog'' order.
Thus, the process at the top if of the display is using the most
resource.
Note that a process with a ``hog'' value of zero will not be
displayed.
hog
is terminated by sending it SIGINT.
Each process is represented in the display by a single line,
with the pid and uid associated with the process on the left,
and the command
being executed on the right.
In the middle are
resource-specific
numbers.
The top line of the display contains a legend, and possibly some
overall system statistics relating to
resource.
General Flags
- -p
-
num
specifies the number of processes to consider for display
[default 20].
- -c
-
cols
specifies the number of columns to use for the display window
[default 80].
- -l
-
lines
specifies the number of lines to use for the display window
[default 24].
- -w
-
specifies that a curses window should not be used, the lines
are simply written to standard output.
- -t
-
specifies that a timestamp should be displayed.
- -i
-
interval
specifies the sampling interval, in seconds [default 5].
(Actually,
hog
sleeps for this long between scans).
- -s
-
smooth
specifies the number of observations to use in the smoothing
algorithm [default 1 (no smoothing)].
- -d
-
Specifies a
resource-specific
detail
string that is used to specify that output should be sorted on a different
``hog'' value.
The available options are discussed in the individual
hog
command sections below.
- -V
-
Specifies that actual resource use should be shown, not
percentages.
This is the default.
- -%
-
Specifies that percentage resource use should be shown, not
actual values.
This is only available for certain resources, see above.
- -D
-
Specifies that ``delta'' resource consumption should
be shown, not totals.
The ``delta'' is the (possibly smoothed) consumption since the
the last sample.
It shows recent resource consumption.
- -T
-
Specifies that total resource consumption should be
shown, not delta.
This shows the total resource consumed since the process
started.
This is the default for
memhog.
memhog
memhog
examines memory use.
It examines the regions attached to a process, and examines the
memory usage of each region.
It sums the statistics for each region to produce totals for
the process:
- vsize
-
The sum of the virtual sizes of the regions: the virtual size of
the process.
- shrd
-
The sum of the number of valid (i.e., resident) real pages for regions
that are shareable.
- priv
-
The sum of number of valid real pages for regions that are private.
- wtd
-
For each sharable region, compute the valid real pages divided by
the reference count.
Each process is deemed to be ``responsible'' for this much of the
region's real memory use.
wtd
is the sum over all shareable regions attached to the process.
- total
-
is the sum of priv and wtd, and is intended to represent the real
memory impact of this process.
memhog
also shows the current values for:
freemem,
availrmem,
and
availsmem.
iohog
iohog
examines I/O use by processes.
It examines the u-area of the process and computes:
- swap
-
is based on u_iosw and is the number of blocks transferred to or from
a swap device on behalf of this process.
- char
-
is based on u_ioch, and is the number of bytes read or written by
this process.
- read
-
is based on u_ior and is the number of blocks read by this process.
- write
-
is based on u_iow and is the number of blocks written on behalf of
this process.
Note that a process is charged when a block is written to the disk,
not to the buffer cache.
Therefore, a process that writes a block and gets a cache hit is
not charged for a write.
A process that issues a read that causes a dirty cache block to
be written is charged for the write, even if it did not write
the block into the cache originally.
- total
-
is the sum of the read and write values.
The
-d
option can specify that the
swap
or
character
value should be considered the ``hog'' value (and
thus be used for sorting).
The default
is to use ``total''.
cpuhog
cpuhog
examines CPU use.
- user
-
is the user cpu time.
- system
-
is the system cpu time.
- total
-
is the total user + system time.
- smpl
-
(on the top line) shows the number of clock ticks between successive
samples.
- idle
-
(on the top line) shows the CPU idle time, as recorded in sysinfo.
- wait
-
(on the top line) shows the CPU wait-idle (i.e., idle waiting for
I/O completions), as recorded in sysinfo.
The
-%
option can be used to display percentages instead of actual
clock ticks.
The percentages are percentages of elapsed time.
The
-d
option can be used to specify that sorting should be done
on
system
or
user
time.
It cannot be used in conjunction with
-%.
The
-d
option
load
is experimental and should not be used.
BUGS
The program takes a snapshot of several dynamic kernel data structures
from user mode.
As such, the information is sometimes inconsistent.
It does the best it can under such circumstances.
SEE ALSO
sar, showreg
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- General Flags
-
- memhog
-
- iohog
-
- cpuhog
-
- BUGS
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 04:06:40 GMT, December 02, 2024