hogs

List the processes that are hogging the CPU

Syntax:

hogs [options] [pids ...]

Options:

-i iter
Limit the output to the specified number of iterations (default: no limit).
-m [e][t][p][s]
Specify the type of memory mappings to include in the memory total for each process:
  • eMAP_ELF mappings
  • tMAP_STACK mappings
  • sMAP_SHARED mappings
  • pMAP_PRIVATE mappings (the default)

You can concatenate these types; for example, -msp gives memory for both shared and private mappings.

-n
Show the names of processes (hogs always displays the process IDs).
-p priority
Run hogs at the given priority (default: the same as the parent process).
-S [c|m|p]
Sort by:
  • c — CPU (the default)
  • m — memory
  • p — process ID
-s sec
Sleep this long between updates (default: 3 seconds).
-% num [c|m]
Show only processes that consume this percentage or more CPU (c, the default) or memory (m). You can use this option to reduce the amount of output.

Description:

The hogs utility displays a list of processes in descending order by percentage of CPU usage (i.e. it shows who's hogging the processor). It loops forever, sleeping between updates.

The format of the output is tabular, and includes:

PID
The ID of the process being reported.
NAME
The name of the process (included only if you specify the -n option).
MSEC
The number of milliseconds for which this process has been running since the last iteration.
PIDS
The amount of time that the process ran in this iteration, as a percentage of the times of all the other processes running.
SYS
The amount of time that the process ran in this iteration, as a percentage of the iteration time.
MEMORY
The amount of memory that the process used. The types of mappings included depend on the -m option.

  • The SYS column is incorrect on multicore systems; the numbers in this column will add up to (roughly) the number of processors times 100%.
  • The numbers from hogs are approximate.

Examples:

Display the processes that are using 10% or more of the CPU. Include the name of the processes:

$ hogs -n -% 10c

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus