Blame SOURCES/procps-ng-3.3.15-vmstat-omit-first-report.patch

c19d75
diff --git a/vmstat.8 b/vmstat.8
c19d75
index fa0938c..fd1078f 100644
c19d75
--- a/vmstat.8
c19d75
+++ b/vmstat.8
c19d75
@@ -87,6 +87,9 @@ Display version information and exit.
c19d75
 .TP
c19d75
 \fB\-h\fR, \fB\-\-help\fR
c19d75
 Display help and exit.
c19d75
+.TP
c19d75
+\fB\-y\fR, \fB\-\-no-first\fR
c19d75
+Omits first report with statistics since system boot.
c19d75
 .PD
c19d75
 .SH "FIELD DESCRIPTION FOR VM MODE"
c19d75
 .SS
c19d75
diff --git a/vmstat.c b/vmstat.c
c19d75
index f2aa2f4..07496cd 100644
c19d75
--- a/vmstat.c
c19d75
+++ b/vmstat.c
c19d75
@@ -75,6 +75,9 @@ static int a_option;
c19d75
 /* "-w" means "wide output" */
c19d75
 static int w_option;
c19d75
 
c19d75
+/* "-y" means "skip first output" */
c19d75
+static int y_option;
c19d75
+
c19d75
 /* "-t" means "show timestamp" */
c19d75
 static int t_option;
c19d75
 
c19d75
@@ -104,6 +107,7 @@ static void __attribute__ ((__noreturn__))
c19d75
 	fputs(_(" -S, --unit <char>      define display unit\n"), out);
c19d75
 	fputs(_(" -w, --wide             wide output\n"), out);
c19d75
 	fputs(_(" -t, --timestamp        show timestamp\n"), out);
c19d75
+	fputs(_(" -y, --no-first         skips first line of output\n"), out);
c19d75
 	fputs(USAGE_SEPARATOR, out);
c19d75
 	fputs(USAGE_HELP, out);
c19d75
 	fputs(USAGE_VERSION, out);
c19d75
@@ -304,43 +308,47 @@ static void new_format(void)
c19d75
 		cpu_zzz, pgpgin, pgpgout, pswpin, pswpout, intr, ctxt, &running,
c19d75
 		&blocked, &dummy_1, &dummy_2);
c19d75
 
c19d75
-	if (t_option) {
c19d75
-		(void) time( &the_time );
c19d75
-		tm_ptr = localtime( &the_time );
c19d75
-		strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
c19d75
-	}
c19d75
+	if (y_option == 0) {
c19d75
+		if (t_option) {
c19d75
+			(void) time( &the_time );
c19d75
+			tm_ptr = localtime( &the_time );
c19d75
+			 strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
c19d75
+		}
c19d75
 
c19d75
-	duse = *cpu_use + *cpu_nic;
c19d75
-	dsys = *cpu_sys + *cpu_xxx + *cpu_yyy;
c19d75
-	didl = *cpu_idl;
c19d75
-	diow = *cpu_iow;
c19d75
-	dstl = *cpu_zzz;
c19d75
-	Div = duse + dsys + didl + diow + dstl;
c19d75
-	if (!Div) Div = 1, didl = 1;
c19d75
-	divo2 = Div / 2UL;
c19d75
-	printf(w_option ? wide_format : format,
c19d75
-	       running, blocked,
c19d75
-	       unitConvert(kb_swap_used), unitConvert(kb_main_free),
c19d75
-	       unitConvert(a_option?kb_inactive:kb_main_buffers),
c19d75
-	       unitConvert(a_option?kb_active:kb_main_cached),
c19d75
-	       (unsigned)( (unitConvert(*pswpin  * kb_per_page) * hz + divo2) / Div ),
c19d75
-	       (unsigned)( (unitConvert(*pswpout * kb_per_page) * hz + divo2) / Div ),
c19d75
-	       (unsigned)( (*pgpgin		   * hz + divo2) / Div ),
c19d75
-	       (unsigned)( (*pgpgout		   * hz + divo2) / Div ),
c19d75
-	       (unsigned)( (*intr		   * hz + divo2) / Div ),
c19d75
-	       (unsigned)( (*ctxt		   * hz + divo2) / Div ),
c19d75
-	       (unsigned)( (100*duse			+ divo2) / Div ),
c19d75
-	       (unsigned)( (100*dsys			+ divo2) / Div ),
c19d75
-	       (unsigned)( (100*didl			+ divo2) / Div ),
c19d75
-	       (unsigned)( (100*diow			+ divo2) / Div ),
c19d75
-	       (unsigned)( (100*dstl			+ divo2) / Div )
c19d75
-	);
c19d75
+		duse = *cpu_use + *cpu_nic;
c19d75
+		dsys = *cpu_sys + *cpu_xxx + *cpu_yyy;
c19d75
+		didl = *cpu_idl;
c19d75
+		diow = *cpu_iow;
c19d75
+		dstl = *cpu_zzz;
c19d75
+		Div = duse + dsys + didl + diow + dstl;
c19d75
+		if (!Div) Div = 1, didl = 1;
c19d75
+		divo2 = Div / 2UL;
c19d75
+		printf(w_option ? wide_format : format,
c19d75
+		       running, blocked,
c19d75
+		       unitConvert(kb_swap_used), unitConvert(kb_main_free),
c19d75
+		       unitConvert(a_option?kb_inactive:kb_main_buffers),
c19d75
+		       unitConvert(a_option?kb_active:kb_main_cached),
c19d75
+		       (unsigned)( (unitConvert(*pswpin  * kb_per_page) * hz + divo2) / Div ),
c19d75
+		       (unsigned)( (unitConvert(*pswpout * kb_per_page) * hz + divo2) / Div ),
c19d75
+		       (unsigned)( (*pgpgin		   * hz + divo2) / Div ),
c19d75
+		       (unsigned)( (*pgpgout		   * hz + divo2) / Div ),
c19d75
+		       (unsigned)( (*intr		   * hz + divo2) / Div ),
c19d75
+		       (unsigned)( (*ctxt		   * hz + divo2) / Div ),
c19d75
+		       (unsigned)( (100*duse			+ divo2) / Div ),
c19d75
+		       (unsigned)( (100*dsys			+ divo2) / Div ),
c19d75
+		       (unsigned)( (100*didl			+ divo2) / Div ),
c19d75
+		       (unsigned)( (100*diow			+ divo2) / Div ),
c19d75
+		       (unsigned)( (100*dstl			+ divo2) / Div )
c19d75
+		);
c19d75
 
c19d75
-	if (t_option) {
c19d75
-		printf(" %s", timebuf);
c19d75
-	}
c19d75
+		if (t_option) {
c19d75
+			printf(" %s", timebuf);
c19d75
+		}
c19d75
 
c19d75
-	printf("\n");
c19d75
+		printf("\n");
c19d75
+	}
c19d75
+	else
c19d75
+		num_updates++;
c19d75
 
c19d75
 	/* main loop */
c19d75
 	for (i = 1; infinite_updates || i < num_updates; i++) {
c19d75
@@ -865,6 +873,7 @@ int main(int argc, char *argv[])
c19d75
 		{"timestamp", no_argument, NULL, 't'},
c19d75
 		{"help", no_argument, NULL, 'h'},
c19d75
 		{"version", no_argument, NULL, 'V'},
c19d75
+		{"no-first", no_argument, NULL, 'y'},
c19d75
 		{NULL, 0, NULL, 0}
c19d75
 	};
c19d75
 
c19d75
@@ -877,7 +886,7 @@ int main(int argc, char *argv[])
c19d75
 	atexit(close_stdout);
c19d75
 
c19d75
 	while ((c =
c19d75
-		getopt_long(argc, argv, "afmnsdDp:S:wthV", longopts,
c19d75
+		getopt_long(argc, argv, "afmnsdDp:S:wthVy", longopts,
c19d75
 			    NULL)) != EOF)
c19d75
 		switch (c) {
c19d75
 		case 'V':
c19d75
@@ -946,6 +955,11 @@ int main(int argc, char *argv[])
c19d75
 		case 't':
c19d75
 			t_option = 1;
c19d75
 			break;
c19d75
+		case 'y':
c19d75
+			/* Don't display stats since system restart */
c19d75
+			y_option = 1;
c19d75
+			break;
c19d75
+
c19d75
 		default:
c19d75
 			/* no other aguments defined yet. */
c19d75
 			usage(stderr);