Module Name:    src
Committed By:   martin
Date:           Tue Mar  6 11:15:33 UTC 2018

Modified Files:
        src/usr.bin/vmstat [netbsd-8]: vmstat.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #606):
        usr.bin/vmstat/vmstat.c: revision 1.218
Don't print "nan" when there is no disk activity.


To generate a diff of this commit:
cvs rdiff -u -r1.216.6.3 -r1.216.6.4 src/usr.bin/vmstat/vmstat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.216.6.3 src/usr.bin/vmstat/vmstat.c:1.216.6.4
--- src/usr.bin/vmstat/vmstat.c:1.216.6.3	Mon Nov  6 09:55:56 2017
+++ src/usr.bin/vmstat/vmstat.c	Tue Mar  6 11:15:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.216.6.3 2017/11/06 09:55:56 snj Exp $ */
+/* $NetBSD: vmstat.c,v 1.216.6.4 2018/03/06 11:15:33 martin Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.216.6.3 2017/11/06 09:55:56 snj Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.216.6.4 2018/03/06 11:15:33 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -1123,8 +1123,11 @@ drvstats(int *ovflwp)
 
 	for (dn = 0; dn < ndrive; ++dn) {
 		/* elapsed time for disk stats */
-		dtime = (double)cur.timestamp[dn].tv_sec +
-			((double)cur.timestamp[dn].tv_usec / (double)1000000);
+		dtime = cur.cp_etime;
+		if (cur.timestamp[dn].tv_sec || cur.timestamp[dn].tv_usec) {
+			dtime = (double)cur.timestamp[dn].tv_sec +
+				((double)cur.timestamp[dn].tv_usec / (double)1000000);
+		}
 
 		if (!drv_select[dn])
 	 		continue;

Reply via email to