table of contents
PIDSTAT(1) | Linux User's Manual | PIDSTAT(1) |
NAME¶
pidstat - Report statistics for Linux tasks.
SYNOPSIS¶
pidstat [ -d ] [ -h ] [ -I ] [ -l ] [ -r ] [ -s ] [ -t ] [ -U [ username ] ] [ -u ] [ -V ] [ -w ] [ -C comm ] [ -p { pid [,...] | SELF | ALL } ] [ -T { TASK | CHILD | ALL } ] [ interval [ count ] ]
DESCRIPTION¶
The pidstat command is used for monitoring individual tasks currently being managed by the Linux kernel. It writes to standard output activities for every task selected with option -p or for every task managed by the Linux kernel if option -p ALL has been used. Not selecting any tasks is equivalent to specifying -p ALL but only active tasks (tasks with non-zero statistics values) will appear in the report.
The pidstat command can also be used for monitoring the child processes of selected tasks. Read about option -T below.
The interval parameter specifies the amount of time in seconds between each report. A value of 0 (or no parameters at all) indicates that tasks statistics are to be reported for the time since system startup (boot). The count parameter can be specified in conjunction with the interval parameter if this one is not set to zero. The value of count determines the number of reports generated at interval seconds apart. If the interval parameter is specified without the count parameter, the pidstat command generates reports continuously.
You can select information about specific task activities using flags. Not specifying any flags selects only CPU activity.
OPTIONS¶
- -C comm
- Display only tasks whose command name includes the string comm. This string can be a regular expression.
- -d
- Report I/O statistics (kernels 2.6.20 and later only). The following
values may be displayed:
UID
USER
PID
kB_rd/s
kB_wr/s
kB_ccwr/s
Command
- -h
- Display all activities horizontally on a single line. This is intended to make it easier to be parsed by other programs.
- -I
- In an SMP environment, indicate that tasks CPU usage (as displayed by option -u ) should be divided by the total number of processors.
- -l
- Display the process command name and all its arguments.
- -p { pid [,...] | SELF | ALL }
- Select tasks (processes) for which statistics are to be reported. pid is the process identification number. The SELF keyword indicates that statistics are to be reported for the pidstat process itself, whereas the ALL keyword indicates that statistics are to be reported for all the tasks managed by the system.
- -r
- Report page faults and memory utilization.
When reporting statistics for individual tasks, the following values may be displayed:
UID
USER
PID
minflt/s
majflt/s
VSZ
RSS
%MEM
Command
When reporting global statistics for tasks and all their children, the following values may be displayed:
UID
USER
PID
minflt-nr
majflt-nr
Command
- -s
- Report stack utilization. The following values may be displayed:
UID
USER
PID
StkSize
StkRef
Command
- -T { TASK | CHILD | ALL }
- This option specifies what has to be monitored by the pidstat
command. The TASK keyword indicates that statistics are to be
reported for individual tasks (this is the default option) whereas the
CHILD keyword indicates that statistics are to be globally reported
for the selected tasks and all their children. The ALL keyword
indicates that statistics are to be reported for individual tasks and
globally for the selected tasks and their children.
Note: Global statistics for tasks and all their children are not available for all options of pidstat. Also these statistics are not necessarily relevant to current time interval: The statistics of a child process are collected only when it finishes or it is killed.
- -t
- Also display statistics for threads associated with selected tasks.
This option adds the following values to the reports:
TGID
TID
- -U [ username ]
- Display the real user name of the tasks being monitored instead of the UID. If username is specified, then only tasks belonging to the specified user are displayed.
- -u
- Report CPU utilization.
When reporting statistics for individual tasks, the following values may be displayed:
UID
USER
PID
%usr
%system
%guest
%CPU
CPU
Command
When reporting global statistics for tasks and all their children, the following values may be displayed:
UID
USER
PID
usr-ms
system-ms
guest-ms
Command
- -V
- Print version number then exit.
- -w
- Report task switching activity (kernels 2.6.23 and later only). The
following values may be displayed:
UID
USER
PID
cswch/s
nvcswch/s
Command
ENVIRONMENT¶
The pidstat command takes into account the following environment variable:
- S_TIME_FORMAT
- If this variable exists and its value is ISO then the current locale will be ignored when printing the date in the report header. The pidstat command will use the ISO 8601 format (YYYY-MM-DD) instead.
EXAMPLES¶
pidstat 2 5
pidstat -r -p 1643 2 5
pidstat -C "fox|bird" -r -p ALL
pidstat -T CHILD -r 2 5
BUGS¶
/proc filesystem must be mounted for the pidstat command to work.
FILES¶
/proc contains various files with system statistics.
AUTHOR¶
Sebastien Godard (sysstat <at> orange.fr)
SEE ALSO¶
MARCH 2013 | Linux |