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 ] [ -h ] [ -I ] [ -l ] [ -R ] [ -r ] [ -s ] [ -t ]
10       [ -U [ username ] ] [ -u ] [ -V ] [ -v ] [ -w  ]  [  -C  comm  ]  [  -G
11       process_name  ] [ --dec={ 0 | 1 | 2 } ] [ --human ] [ -p { pid [,...] |
12       SELF | ALL } ] [ -T { TASK | CHILD | ALL } ] [ interval [ count ]  ]  [
13       -e program args ]
14

DESCRIPTION

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

OPTIONS

40       -C comm
41              Display  only tasks whose command name includes the string comm.
42              This string can be a regular expression.
43
44       -d     Report I/O statistics (kernels 2.6.20 and later only).  The fol‐
45              lowing values may be displayed:
46
47              UID
48                     The  real  user  identification  number of the task being
49                     monitored.
50
51              USER
52                     The name of the real user owning  the  task  being  moni‐
53                     tored.
54
55              PID
56                     The identification number of the task being monitored.
57
58              kB_rd/s
59                     Number  of  kilobytes the task has caused to be read from
60                     disk per second.
61
62              kB_wr/s
63                     Number of kilobytes the task has caused, or  shall  cause
64                     to be written to disk per second.
65
66              kB_ccwr/s
67                     Number  of  kilobytes whose writing to disk has been can‐
68                     celled by the task. This may occur when  the  task  trun‐
69                     cates  some  dirty pagecache. In this case, some IO which
70                     another task has been accounted for will not  be  happen‐
71                     ing.
72
73              iodelay
74                     Block  I/O delay of the task being monitored, measured in
75                     clock ticks. This metric includes the delays spent  wait‐
76                     ing  for  sync  block I/O completion and for swapin block
77                     I/O completion.
78
79              Command
80                     The command name of the task.
81
82       --dec={ 0 | 1 | 2 }
83              Specify the number of decimal places to use  (0  to  2,  default
84              value is 2).
85
86       -e program args
87              Execute  program  with  given arguments args and monitor it with
88              pidstat.  pidstat stops when program terminates.
89
90       -G process_name
91              Display only processes whose command name  includes  the  string
92              process_name.   This  string  can  be  a  regular expression. If
93              option -t is used together  with  option  -G  then  the  threads
94              belonging to that process are also displayed (even if their com‐
95              mand name doesn't include the string process_name).
96
97       -H     Display timestamp in seconds since the epoch.
98
99       -h     Display all activities horizontally on a single  line,  with  no
100              average statistics at the end of the report. This is intended to
101              make it easier to be parsed by other programs.
102
103       --human
104              Print sizes in human readable format  (e.g.  1.0k,  1.2M,  etc.)
105              The units displayed with this option supersede any other default
106              units (e.g.  kilobytes, sectors...) associated with the metrics.
107
108       -I     In an SMP environment, indicate that tasks CPU  usage  (as  dis‐
109              played  by  option -u ) should be divided by the total number of
110              processors.
111
112       -l     Display the process command name and all its arguments.
113
114       -p { pid [,...] | SELF | ALL }
115              Select  tasks  (processes)  for  which  statistics  are  to   be
116              reported.   pid  is  the process identification number. The SELF
117              keyword indicates that statistics are to  be  reported  for  the
118              pidstat  process  itself, whereas the ALL keyword indicates that
119              statistics are to be reported for all the tasks managed  by  the
120              system.
121
122       -R     Report realtime priority and scheduling policy information.  The
123              following values may be displayed:
124
125              UID
126                     The real user identification number  of  the  task  being
127                     monitored.
128
129              USER
130                     The  name  of  the  real user owning the task being moni‐
131                     tored.
132
133              PID
134                     The identification number of the task being monitored.
135
136              prio
137                     The realtime priority of the task being monitored.
138
139              policy
140                     The scheduling policy of the task being monitored.
141
142              Command
143                     The command name of the task.
144
145       -r     Report page faults and memory utilization.
146
147              When reporting statistics for individual  tasks,  the  following
148              values may be displayed:
149
150              UID
151                     The  real  user  identification  number of the task being
152                     monitored.
153
154              USER
155                     The name of the real user owning  the  task  being  moni‐
156                     tored.
157
158              PID
159                     The identification number of the task being monitored.
160
161              minflt/s
162                     Total  number  of minor faults the task has made per sec‐
163                     ond, those which have not required loading a memory  page
164                     from disk.
165
166              majflt/s
167                     Total  number  of major faults the task has made per sec‐
168                     ond, those which have required loading a memory page from
169                     disk.
170
171              VSZ
172                     Virtual  Size: The virtual memory usage of entire task in
173                     kilobytes.
174
175              RSS
176                     Resident Set Size: The non-swapped physical  memory  used
177                     by the task in kilobytes.
178
179              %MEM
180                     The  tasks's  currently  used share of available physical
181                     memory.
182
183              Command
184                     The command name of the task.
185
186              When reporting global statistics for tasks and all  their  chil‐
187              dren, the following values may be displayed:
188
189              UID
190                     The  real user identification number of the task which is
191                     being monitored together with its children.
192
193              USER
194                     The name of the real user owning the task which is  being
195                     monitored together with its children.
196
197              PID
198                     The identification number of the task which is being mon‐
199                     itored together with its children.
200
201              minflt-nr
202                     Total number of minor faults made by the task and all its
203                     children, and collected during the interval of time.
204
205              majflt-nr
206                     Total number of major faults made by the task and all its
207                     children, and collected during the interval of time.
208
209              Command
210                     The command name of the task  which  is  being  monitored
211                     together with its children.
212
213       -s     Report  stack  utilization.   The  following  values may be dis‐
214              played:
215
216              UID
217                     The real user identification number  of  the  task  being
218                     monitored.
219
220              USER
221                     The  name  of  the  real user owning the task being moni‐
222                     tored.
223
224              PID
225                     The identification number of the task being monitored.
226
227              StkSize
228                     The amount of memory in kilobytes reserved for  the  task
229                     as stack, but not necessarily used.
230
231              StkRef
232                     The  amount  of memory in kilobytes used as stack, refer‐
233                     enced by the task.
234
235              Command
236                     The command name of the task.
237
238       -T { TASK | CHILD | ALL }
239              This option specifies what has to be monitored  by  the  pidstat
240              command.  The  TASK  keyword indicates that statistics are to be
241              reported for individual  tasks  (this  is  the  default  option)
242              whereas  the  CHILD  keyword indicates that statistics are to be
243              globally reported for the selected tasks and all their children.
244              The ALL keyword indicates that statistics are to be reported for
245              individual tasks and globally for the selected tasks  and  their
246              children.
247
248              Note: Global statistics for tasks and all their children are not
249              available for all options of pidstat.  Also these statistics are
250              not  necessarily  relevant to current time interval: The statis‐
251              tics of a child process are collected only when it  finishes  or
252              it is killed.
253
254       -t     Also  display  statistics  for  threads associated with selected
255              tasks.
256
257              This option adds the following values to the reports:
258
259              TGID
260                     The identification number of the thread group leader.
261
262              TID
263                     The identification number of the thread being monitored.
264
265       -U [ username ]
266              Display the real user name of the tasks being monitored  instead
267              of the UID.  If username is specified, then only tasks belonging
268              to the specified user are displayed.
269
270       -u     Report CPU utilization.
271
272              When reporting statistics for individual  tasks,  the  following
273              values may be displayed:
274
275              UID
276                     The  real  user  identification  number of the task being
277                     monitored.
278
279              USER
280                     The name of the real user owning  the  task  being  moni‐
281                     tored.
282
283              PID
284                     The identification number of the task being monitored.
285
286              %usr
287                     Percentage of CPU used by the task while executing at the
288                     user level (application), with or without nice  priority.
289                     Note  that this field does NOT include time spent running
290                     a virtual processor.
291
292              %system
293                     Percentage of CPU used by the task while executing at the
294                     system level (kernel).
295
296              %guest
297                     Percentage  of  CPU  spent by the task in virtual machine
298                     (running a virtual processor).
299
300              %wait
301                     Percentage of CPU spent by the task while waiting to run.
302
303              %CPU
304                     Total percentage of CPU time used by the task. In an  SMP
305                     environment,  the task's CPU usage will be divided by the
306                     total number of CPU's if option -I has  been  entered  on
307                     the command line.
308
309              CPU
310                     Processor number to which the task is attached.
311
312              Command
313                     The command name of the task.
314
315              When  reporting  global statistics for tasks and all their chil‐
316              dren, the following values may be displayed:
317
318              UID
319                     The real user identification number of the task which  is
320                     being monitored together with its children.
321
322              USER
323                     The  name of the real user owning the task which is being
324                     monitored together with its children.
325
326              PID
327                     The identification number of the task which is being mon‐
328                     itored together with its children.
329
330              usr-ms
331                     Total  number  of  milliseconds spent by the task and all
332                     its children while executing at the user level  (applica‐
333                     tion),  with or without nice priority, and collected dur‐
334                     ing the interval of time. Note that this field  does  NOT
335                     include time spent running a virtual processor.
336
337              system-ms
338                     Total  number  of  milliseconds spent by the task and all
339                     its children while executing at the  system  level  (ker‐
340                     nel), and collected during the interval of time.
341
342              guest-ms
343                     Total  number  of  milliseconds spent by the task and all
344                     its children in virtual machine (running a  virtual  pro‐
345                     cessor).
346
347              Command
348                     The  command  name  of  the task which is being monitored
349                     together with its children.
350
351       -V     Print version number then exit.
352
353       -v     Report values of some kernel tables. The following values may be
354              displayed:
355
356              UID
357                     The  real  user  identification  number of the task being
358                     monitored.
359
360              USER
361                     The name of the real user owning  the  task  being  moni‐
362                     tored.
363
364              PID
365                     The identification number of the task being monitored.
366
367              threads
368                     Number of threads associated with current task.
369
370              fd-nr
371                     Number of file descriptors associated with current task.
372
373              Command
374                     The command name of the task.
375
376       -w     Report  task switching activity (kernels 2.6.23 and later only).
377              The following values may be displayed:
378
379              UID
380                     The real user identification number  of  the  task  being
381                     monitored.
382
383              USER
384                     The  name  of  the  real user owning the task being moni‐
385                     tored.
386
387              PID
388                     The identification number of the task being monitored.
389
390              cswch/s
391                     Total number of voluntary context switches the task  made
392                     per  second.   A  voluntary  context switch occurs when a
393                     task blocks  because  it  requires  a  resource  that  is
394                     unavailable.
395
396              nvcswch/s
397                     Total  number  of non voluntary context switches the task
398                     made per second.   A  involuntary  context  switch  takes
399                     place  when  a task executes for the duration of its time
400                     slice and then is forced to relinquish the processor.
401
402              Command
403                     The command name of the task.
404

ENVIRONMENT

406       The pidstat command takes into account the following environment  vari‐
407       ables:
408
409
410       S_COLORS
411              When  this  variable  is set, display statistics in color on the
412              terminal.  Possible values for this variable are  never,  always
413              or auto (the latter is the default).
414
415              Please  note  that  the  color (being red, yellow, or some other
416              color) used to display a value is not indicative of any kind  of
417              issue  simply  because of the color. It only indicates different
418              ranges of values.
419
420
421       S_COLORS_SGR
422              Specify the colors and other attributes used to display  statis‐
423              tics  on  the  terminal.  Its value is a colon-separated list of
424              capabilities            that             defaults             to
425              H=31;1:I=32;22:M=35;1:N=34;1:Z=34;22.    Supported  capabilities
426              are:
427
428
429              H=     SGR (Select Graphic Rendition) substring  for  percentage
430                     values greater than or equal to 75%.
431
432
433              I=     SGR  substring  for item values like PID, UID or CPU num‐
434                     ber.
435
436
437              M=     SGR substring for percentage values in the range from 50%
438                     to 75%.
439
440
441              N=     SGR  substring  for  non-zero  statistics  values and for
442                     tasks names.
443
444
445              Z=     SGR substring for zero values and for threads names.
446
447
448       S_TIME_FORMAT
449              If this variable exists and its value is ISO  then  the  current
450              locale  will  be  ignored  when  printing the date in the report
451              header.  The pidstat command will use the ISO 8601 format (YYYY-
452              MM-DD)  instead.   The timestamp will also be compliant with ISO
453              8601 format.
454
455

EXAMPLES

457       pidstat 2 5
458              Display five reports of CPU statistics for every active task  in
459              the system at two second intervals.
460
461       pidstat -r -p 1643 2 5
462              Display  five  reports  of page faults and memory statistics for
463              PID 1643 at two second intervals.
464
465       pidstat -C "fox|bird" -r -p ALL
466              Display global page faults and memory  statistics  for  all  the
467              processes  whose  command  name  includes  the  string  "fox" or
468              "bird".
469
470       pidstat -T CHILD -r 2 5
471              Display five reports of page faults  statistics  at  two  second
472              intervals  for  the  child processes of all tasks in the system.
473              Only child processes with non-zero statistics  values  are  dis‐
474              played.
475

BUGS

477       /proc filesystem must be mounted for the pidstat command to work.
478
479

FILES

481       /proc contains various files with system statistics.
482
483

AUTHOR

485       Sebastien Godard (sysstat <at> orange.fr)
486

SEE ALSO

488       sar(1), top(1), ps(1), mpstat(1), iostat(1), vmstat(8)
489
490       https://github.com/sysstat/sysstat
491
492       http://pagesperso-orange.fr/sebastien.godard/
493
494
495
496Linux                              JULY 2018                        PIDSTAT(1)
Impressum