From: Sebastien GODARD Date: Fri, 2 Apr 2021 14:31:22 +0000 (+0200) Subject: Merge branch 'parthsl-master' X-Git-Tag: v12.5.4~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8a22f2c32f5705319ff64c83c6b4cdccd3fdc27;p=sysstat Merge branch 'parthsl-master' --- d8a22f2c32f5705319ff64c83c6b4cdccd3fdc27 diff --cc pidstat.c index 076e664,0f827f8..c7c3c35 --- a/pidstat.c +++ b/pidstat.c @@@ -2363,18 -2363,17 +2363,20 @@@ void rw_pidstat_loop(int dis_hdr, int r read_proc_meminfo(); } -- if (!interval) { ++ if (!interval && !EXEC_PGM(pidflag)) { /* Display since boot time */ ps_tstamp[1] = ps_tstamp[0]; + write_stats(0, DISP_HDR); + exit(0); } /* Set a handler for SIGALRM */ memset(&alrm_act, 0, sizeof(alrm_act)); alrm_act.sa_handler = alarm_handler; sigaction(SIGALRM, &alrm_act, NULL); - alarm(interval); - if (interval) ++ if (interval) { + alarm(interval); ++ } /* Save the first stats collected. Will be used to compute the average */ ps_tstamp[2] = ps_tstamp[0]; @@@ -2544,7 -2543,7 +2546,7 @@@ int main(int argc, char **argv if (!argv[++opt]) { usage(argv[0]); } -- pidflag |= P_D_PID; ++ pidflag |= P_D_PID + P_F_EXEC_PGM; add_list_pid(&pid_list, exec_pgm(argc - opt, argv + opt), 0); break; } diff --cc pidstat.h index ac7a6a0,ac7a6a0..b4f9758 --- a/pidstat.h +++ b/pidstat.h @@@ -70,6 -70,6 +70,7 @@@ #define P_F_PROCSTR 0x0400 #define P_D_UNIT 0x0800 #define P_D_SEC_EPOCH 0x1000 ++#define P_F_EXEC_PGM 0x2000 #define DISPLAY_PID(m) (((m) & P_D_PID) == P_D_PID) #define DISPLAY_ALL_PID(m) (((m) & P_D_ALL_PID) == P_D_ALL_PID) @@@ -84,6 -84,6 +85,7 @@@ #define PROCESS_STRING(m) (((m) & P_F_PROCSTR) == P_F_PROCSTR) #define DISPLAY_UNIT(m) (((m) & P_D_UNIT) == P_D_UNIT) #define PRINT_SEC_EPOCH(m) (((m) & P_D_SEC_EPOCH) == P_D_SEC_EPOCH) ++#define EXEC_PGM(m) (((m) & P_F_EXEC_PGM) == P_F_EXEC_PGM) /* Per-process flags */ #define F_NO_PID_IO 0x01