1PIDSTAT(1) Linux User's Manual PIDSTAT(1)
2
3
4
6 pidstat - Report statistics for Linux tasks.
7
9 pidstat [ -C comm ] [ -d ] [ -h ] [ -I ] [ -l ] [ -p { pid [,...] |
10 SELF | ALL } ] [ -r ] [ -t ] [ -T { TASK | CHILD | ALL } ] [ -u ] [ -V
11 ] [ -w ] [ interval [ count ] ]
12
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
38 -C comm
39 Display only tasks whose command name includes the string comm.
40
41 -d Report I/O statistics (kernels 2.6.20 and later only). The fol‐
42 lowing values are displayed:
43
44 PID
45 The identification number of the task being monitored.
46
47 kB_rd/s
48 Number of kilobytes the task has caused to be read from
49 disk per second.
50
51 kB_wr/s
52 Number of kilobytes the task has caused, or shall cause
53 to be written to disk per second.
54
55 kB_ccwr/s
56 Number of kilobytes whose writing to disk has been can‐
57 celled by the task. This may occur when the task trun‐
58 cates some dirty pagecache. In this case, some IO which
59 another task has been accounted for will not be happen‐
60 ing.
61
62 Command
63 The command name of the task.
64
65 -h Display all activities horizontally on a single line. This is
66 intended to make it easier to be parsed by other programs.
67
68 -I In an SMP environment, indicate that tasks CPU usage (as dis‐
69 played by option -u ) should be divided by the total number of
70 processors.
71
72 -l Display the process command name and all its arguments.
73
74 -p { pid [,...] | SELF | ALL }
75 Select tasks (processes) for which statistics are to be
76 reported. pid is the process identification number. The SELF
77 keyword indicates that statistics are to be reported for the
78 pidstat process itself, whereas the ALL keyword indicates that
79 statistics are to be reported for all the tasks managed by the
80 system.
81
82 -r Report page faults and memory utilization.
83
84 When reporting statistics for individual tasks, the following
85 values are displayed:
86
87 PID
88 The identification number of the task being monitored.
89
90 minflt/s
91 Total number of minor faults the task has made per sec‐
92 ond, those which have not required loading a memory page
93 from disk.
94
95 majflt/s
96 Total number of major faults the task has made per sec‐
97 ond, those which have required loading a memory page from
98 disk.
99
100 VSZ
101 Virtual Size: The virtual memory usage of entire task in
102 kilobytes.
103
104 RSS
105 Resident Set Size: The non-swapped physical memory used
106 by the task in kilobytes.
107
108 Command
109 The command name of the task.
110
111 When reporting global statistics for tasks and all their chil‐
112 dren, the following values are displayed:
113
114 PID
115 The identification number of the task which is being mon‐
116 itored together with its children.
117
118 minflt-nr
119 Total number of minor faults made by the task and all its
120 children, and collected during the interval of time.
121
122 majflt-nr
123 Total number of major faults made by the task and all its
124 children, and collected during the interval of time.
125
126 Command
127 The command name of the task which is being monitored
128 together with its children.
129
130 -t Also display statistics for threads associated with selected
131 tasks.
132
133 This option adds the following values to the reports:
134
135 TGID
136 The identification number of the thread group leader.
137
138 TID
139 The identification number of the thread being monitored.
140
141 -T { TASK | CHILD | ALL }
142 This option specifies what has to be monitored by the pidstat
143 command. The TASK keyword indicates that statistics are to be
144 reported for individual tasks (this is the default option)
145 whereas the CHILD keyword indicates that statistics are to be
146 globally reported for the selected tasks and all their children.
147 The ALL keyword indicates that statistics are to be reported for
148 individual tasks and globally for the selected tasks and their
149 children.
150
151 Note: Global statistics for tasks and all their children are not
152 available for all options of pidstat. Also these statistics are
153 not necessarily relevant to current time interval: The statis‐
154 tics of a child process are collected only when it finishes or
155 it is killed.
156
157 -u Report CPU utilization.
158
159 When reporting statistics for individual tasks, the following
160 values are displayed:
161
162 PID
163 The identification number of the task being monitored.
164
165 %usr
166 Percentage of CPU used by the task while executing at the
167 user level (application), with or without nice priority.
168 Note that this field does NOT include time spent running
169 a virtual processor.
170
171 %system
172 Percentage of CPU used by the task while executing at the
173 system level (kernel).
174
175 %guest
176 Percentage of CPU spent by the task in virtual machine
177 (running a virtual processor).
178
179 %CPU
180 Total percentage of CPU time used by the task. In an SMP
181 environment, the task's CPU usage will be divided by the
182 total number of CPU's if option -I has been entered on
183 the command line.
184
185 CPU
186 Processor number to which the task is attached.
187
188 Command
189 The command name of the task.
190
191 When reporting global statistics for tasks and all their chil‐
192 dren, the following values are displayed:
193
194 PID
195 The identification number of the task which is being mon‐
196 itored together with its children.
197
198 usr-ms
199 Total number of milliseconds spent by the task and all
200 its children while executing at the user level (applica‐
201 tion), with or without nice priority, and collected dur‐
202 ing the interval of time. Note that this field does NOT
203 include time spent running a virtual processor.
204
205 system-ms
206 Total number of milliseconds spent by the task and all
207 its children while executing at the system level (ker‐
208 nel), and collected during the interval of time.
209
210 guest-ms
211 Total number of milliseconds spent by the task and all
212 its children in virtual machine (running a virtual pro‐
213 cessor).
214
215 Command
216 The command name of the task which is being monitored
217 together with its children.
218
219 -V Print version number then exit.
220
221 -w Report task switching activity (kernels 2.6.23 and later only).
222 The following values are displayed:
223
224 PID
225 The identification number of the task being monitored.
226
227 cswch/s
228 Total number of voluntary context switches the task made
229 per second. A voluntary context switch occurs when a
230 task blocks because it requires a resource that is
231 unavailable.
232
233 nvcswch/s
234 Total number of non voluntary context switches the task
235 made per second. A involuntary context switch takes
236 place when a task executes for the duration of its time
237 slice and then is forced to relinquish the processor.
238
239 Command
240 The command name of the task.
241
243 The pidstat command takes into account the following environment vari‐
244 able:
245
246
247 S_TIME_FORMAT
248 If this variable exists and its value is ISO then the current
249 locale will be ignored when printing the date in the report
250 header. The pidstat command will use the ISO 8601 format (YYYY-
251 MM-DD) instead.
252
253
255 pidstat 2 5
256 Display five reports of CPU statistics for every active task in
257 the system at two second intervals.
258
259 pidstat -r -p 1643 2 5
260 Display five reports of page faults and memory statistics for
261 PID 1643 at two second intervals.
262
263 pidstat -T CHILD -r 2 5
264 Display five reports of page faults statistics at two second
265 intervals for the child processes of all tasks in the system.
266 Only child processes with non-zero statistics values are dis‐
267 played.
268
270 /proc filesystem must be mounted for the pidstat command to work.
271
272
274 /proc contains various files with system statistics.
275
276
278 Sebastien Godard (sysstat <at> orange.fr)
279
281 sar(1), top(1), ps(1), mpstat(1), iostat(1), vmstat(8)
282
283 http://pagesperso-orange.fr/sebastien.godard/
284
285
286
287Linux DECEMBER 2008 PIDSTAT(1)