1PIDSTAT(1)                    Linux User's Manual                   PIDSTAT(1)
2
3
4

NAME

6       pidstat - Report statistics for Linux tasks.
7

SYNOPSIS

9       pidstat  [  -d ] [ -h ] [ -I ] [ -l ] [ -r ] [ -s ] [ -t ] [ -U [ user‐
10       name ] ] [ -u ] [ -V ] [ -w ] [ -C comm ] [ -p { pid [,...]  |  SELF  |
11       ALL } ] [ -T { TASK | CHILD | ALL } ] [ interval [ count ] ]
12

DESCRIPTION

14       The  pidstat  command is used for monitoring individual tasks currently
15       being managed by the Linux kernel.  It writes to standard output activ‐
16       ities  for every task selected with option -p or for every task managed
17       by the Linux kernel if option -p ALL has been used. Not  selecting  any
18       tasks  is  equivalent to specifying -p ALL but only active tasks (tasks
19       with non-zero statistics values) will appear in the report.
20
21       The pidstat command can also be used for monitoring the child processes
22       of selected tasks.  Read about option -T below.
23
24       The  interval parameter specifies the amount of time in seconds between
25       each report.  A value of 0 (or no parameters  at  all)  indicates  that
26       tasks  statistics  are to be reported for the time since system startup
27       (boot).  The count parameter can be specified in conjunction  with  the
28       interval  parameter  if this one is not set to zero. The value of count
29       determines the number of reports generated at interval  seconds  apart.
30       If the interval parameter is specified without the count parameter, the
31       pidstat command generates reports continuously.
32
33       You can select information about specific task activities using  flags.
34       Not specifying any flags selects only CPU activity.
35
36

OPTIONS

38       -C comm
39              Display  only tasks whose command name includes the string comm.
40              This string can be a regular expression.
41
42       -d     Report I/O statistics (kernels 2.6.20 and later only).  The fol‐
43              lowing values may be displayed:
44
45              UID
46                     The  real  user  identification  number of the task being
47                     monitored.
48
49              USER
50                     The name of the real user owning  the  task  being  moni‐
51                     tored.
52
53              PID
54                     The identification number of the task being monitored.
55
56              kB_rd/s
57                     Number  of  kilobytes the task has caused to be read from
58                     disk per second.
59
60              kB_wr/s
61                     Number of kilobytes the task has caused, or  shall  cause
62                     to be written to disk per second.
63
64              kB_ccwr/s
65                     Number  of  kilobytes whose writing to disk has been can‐
66                     celled by the task. This may occur when  the  task  trun‐
67                     cates  some  dirty pagecache. In this case, some IO which
68                     another task has been accounted for will not  be  happen‐
69                     ing.
70
71              Command
72                     The command name of the task.
73
74       -h     Display  all  activities  horizontally on a single line. This is
75              intended to make it easier to be parsed by other programs.
76
77       -I     In an SMP environment, indicate that tasks CPU  usage  (as  dis‐
78              played  by  option -u ) should be divided by the total number of
79              processors.
80
81       -l     Display the process command name and all its arguments.
82
83       -p { pid [,...] | SELF | ALL }
84              Select  tasks  (processes)  for  which  statistics  are  to   be
85              reported.   pid  is  the process identification number. The SELF
86              keyword indicates that statistics are to  be  reported  for  the
87              pidstat  process  itself, whereas the ALL keyword indicates that
88              statistics are to be reported for all the tasks managed  by  the
89              system.
90
91       -r     Report page faults and memory utilization.
92
93              When  reporting  statistics  for individual tasks, the following
94              values may be displayed:
95
96              UID
97                     The real user identification number  of  the  task  being
98                     monitored.
99
100              USER
101                     The  name  of  the  real user owning the task being moni‐
102                     tored.
103
104              PID
105                     The identification number of the task being monitored.
106
107              minflt/s
108                     Total number of minor faults the task has made  per  sec‐
109                     ond,  those which have not required loading a memory page
110                     from disk.
111
112              majflt/s
113                     Total number of major faults the task has made  per  sec‐
114                     ond, those which have required loading a memory page from
115                     disk.
116
117              VSZ
118                     Virtual Size: The virtual memory usage of entire task  in
119                     kilobytes.
120
121              RSS
122                     Resident  Set  Size: The non-swapped physical memory used
123                     by the task in kilobytes.
124
125              %MEM
126                     The tasks's currently used share  of  available  physical
127                     memory.
128
129              Command
130                     The command name of the task.
131
132              When  reporting  global statistics for tasks and all their chil‐
133              dren, the following values may be displayed:
134
135              UID
136                     The real user identification number of the task which  is
137                     being monitored together with its children.
138
139              USER
140                     The  name of the real user owning the task which is being
141                     monitored together with its children.
142
143              PID
144                     The identification number of the task which is being mon‐
145                     itored together with its children.
146
147              minflt-nr
148                     Total number of minor faults made by the task and all its
149                     children, and collected during the interval of time.
150
151              majflt-nr
152                     Total number of major faults made by the task and all its
153                     children, and collected during the interval of time.
154
155              Command
156                     The  command  name  of  the task which is being monitored
157                     together with its children.
158
159       -s     Report stack utilization.  The  following  values  may  be  dis‐
160              played:
161
162              UID
163                     The  real  user  identification  number of the task being
164                     monitored.
165
166              USER
167                     The name of the real user owning  the  task  being  moni‐
168                     tored.
169
170              PID
171                     The identification number of the task being monitored.
172
173              StkSize
174                     The  amount  of memory in kilobytes reserved for the task
175                     as stack, but not necessarily used.
176
177              StkRef
178                     The amount of memory in kilobytes used as  stack,  refer‐
179                     enced by the task.
180
181              Command
182                     The command name of the task.
183
184       -T { TASK | CHILD | ALL }
185              This  option  specifies  what has to be monitored by the pidstat
186              command. The TASK keyword indicates that statistics  are  to  be
187              reported  for  individual  tasks  (this  is  the default option)
188              whereas the CHILD keyword indicates that statistics  are  to  be
189              globally reported for the selected tasks and all their children.
190              The ALL keyword indicates that statistics are to be reported for
191              individual  tasks  and globally for the selected tasks and their
192              children.
193
194              Note: Global statistics for tasks and all their children are not
195              available for all options of pidstat.  Also these statistics are
196              not necessarily relevant to current time interval:  The  statis‐
197              tics  of  a child process are collected only when it finishes or
198              it is killed.
199
200       -t     Also display statistics for  threads  associated  with  selected
201              tasks.
202
203              This option adds the following values to the reports:
204
205              TGID
206                     The identification number of the thread group leader.
207
208              TID
209                     The identification number of the thread being monitored.
210
211       -U [ username ]
212              Display  the real user name of the tasks being monitored instead
213              of the UID.  If username is specified, then only tasks belonging
214              to the specified user are displayed.
215
216       -u     Report CPU utilization.
217
218              When  reporting  statistics  for individual tasks, the following
219              values may be displayed:
220
221              UID
222                     The real user identification number  of  the  task  being
223                     monitored.
224
225              USER
226                     The  name  of  the  real user owning the task being moni‐
227                     tored.
228
229              PID
230                     The identification number of the task being monitored.
231
232              %usr
233                     Percentage of CPU used by the task while executing at the
234                     user  level (application), with or without nice priority.
235                     Note that this field does NOT include time spent  running
236                     a virtual processor.
237
238              %system
239                     Percentage of CPU used by the task while executing at the
240                     system level (kernel).
241
242              %guest
243                     Percentage of CPU spent by the task  in  virtual  machine
244                     (running a virtual processor).
245
246              %CPU
247                     Total  percentage of CPU time used by the task. In an SMP
248                     environment, the task's CPU usage will be divided by  the
249                     total  number  of  CPU's if option -I has been entered on
250                     the command line.
251
252              CPU
253                     Processor number to which the task is attached.
254
255              Command
256                     The command name of the task.
257
258              When reporting global statistics for tasks and all  their  chil‐
259              dren, the following values may be displayed:
260
261              UID
262                     The  real user identification number of the task which is
263                     being monitored together with its children.
264
265              USER
266                     The name of the real user owning the task which is  being
267                     monitored together with its children.
268
269              PID
270                     The identification number of the task which is being mon‐
271                     itored together with its children.
272
273              usr-ms
274                     Total number of milliseconds spent by the  task  and  all
275                     its  children while executing at the user level (applica‐
276                     tion), with or without nice priority, and collected  dur‐
277                     ing  the  interval of time. Note that this field does NOT
278                     include time spent running a virtual processor.
279
280              system-ms
281                     Total number of milliseconds spent by the  task  and  all
282                     its  children  while  executing at the system level (ker‐
283                     nel), and collected during the interval of time.
284
285              guest-ms
286                     Total number of milliseconds spent by the  task  and  all
287                     its  children  in virtual machine (running a virtual pro‐
288                     cessor).
289
290              Command
291                     The command name of the task  which  is  being  monitored
292                     together with its children.
293
294       -V     Print version number then exit.
295
296       -w     Report  task switching activity (kernels 2.6.23 and later only).
297              The following values may be displayed:
298
299              UID
300                     The real user identification number  of  the  task  being
301                     monitored.
302
303              USER
304                     The  name  of  the  real user owning the task being moni‐
305                     tored.
306
307              PID
308                     The identification number of the task being monitored.
309
310              cswch/s
311                     Total number of voluntary context switches the task  made
312                     per  second.   A  voluntary  context switch occurs when a
313                     task blocks  because  it  requires  a  resource  that  is
314                     unavailable.
315
316              nvcswch/s
317                     Total  number  of non voluntary context switches the task
318                     made per second.   A  involuntary  context  switch  takes
319                     place  when  a task executes for the duration of its time
320                     slice and then is forced to relinquish the processor.
321
322              Command
323                     The command name of the task.
324

ENVIRONMENT

326       The pidstat command takes into account the following environment  vari‐
327       able:
328
329
330       S_TIME_FORMAT
331              If  this  variable  exists and its value is ISO then the current
332              locale will be ignored when printing  the  date  in  the  report
333              header.  The pidstat command will use the ISO 8601 format (YYYY-
334              MM-DD) instead.
335
336

EXAMPLES

338       pidstat 2 5
339              Display five reports of CPU statistics for every active task  in
340              the system at two second intervals.
341
342       pidstat -r -p 1643 2 5
343              Display  five  reports  of page faults and memory statistics for
344              PID 1643 at two second intervals.
345
346       pidstat -C "fox|bird" -r -p ALL
347              Display global page faults and memory  statistics  for  all  the
348              processes  whose  command  name  includes  the  string  "fox" or
349              "bird".
350
351       pidstat -T CHILD -r 2 5
352              Display five reports of page faults  statistics  at  two  second
353              intervals  for  the  child processes of all tasks in the system.
354              Only child processes with non-zero statistics  values  are  dis‐
355              played.
356

BUGS

358       /proc filesystem must be mounted for the pidstat command to work.
359
360

FILES

362       /proc contains various files with system statistics.
363
364

AUTHOR

366       Sebastien Godard (sysstat <at> orange.fr)
367

SEE ALSO

369       sar(1), top(1), ps(1), mpstat(1), iostat(1), vmstat(8)
370
371       http://pagesperso-orange.fr/sebastien.godard/
372
373
374
375Linux                             MARCH 2013                        PIDSTAT(1)
Impressum