pidstat displays statistics since system startup when the interval and
count parameters are not set on the command line (eg. entering "pidstat
-d" will display I/O statistics for all processes that have had I/O
activity since boot time). But pidstat couldn't display those stats when
some PID numbers were entered on the command line (eg. "pidstat -d -p
1234" to display I/O stats since system startup for process 1234).
This patch makes it possible now.
Signed-off-by: Sebastien GODARD <sysstat@orange.fr.fake>
else if (DISPLAY_PID(pidflag)) {
*pstp = st_pid_list[prev] + p;
-
- if (!(*pstp)->pid)
- /* PID no longer exists */
- return 0;
+ if (!(*pstp)->pid) {
+ if (interval)
+ /* PID no longer exists */
+ return 0;
+ else {
+ /*
+ * If interval is null, then we are trying to
+ * display stats for a given process since boot time.
+ */
+ *pstp = &st_pid_null;
+ }
+ }
}
if (COMMAND_STRING(pidflag)) {