Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/usr.bin/vmstat Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/8fa7e0a40ab6
branches:  netbsd-8
changeset: 434710:8fa7e0a40ab6
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Mar 06 11:15:33 2018 +0000

description:
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.

diffstat:

 usr.bin/vmstat/vmstat.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 9a7c41f5ed92 -r 8fa7e0a40ab6 usr.bin/vmstat/vmstat.c
--- a/usr.bin/vmstat/vmstat.c   Tue Mar 06 11:12:40 2018 +0000
+++ b/usr.bin/vmstat/vmstat.c   Tue Mar 06 11:15:33 2018 +0000
@@ -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 @@
 #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 @@
 
        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;



Home | Main Index | Thread Index | Old Index