Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/iostat NetBSD/vax libm now has fmax, use it again.



details:   https://anonhg.NetBSD.org/src/rev/dcd446771328
branches:  trunk
changeset: 760602:dcd446771328
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sun Jan 09 02:40:19 2011 +0000

description:
NetBSD/vax libm now has fmax, use it again.
Also, display average transfer size using dynamic precision too.

diffstat:

 usr.sbin/iostat/iostat.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 2c27a44c4392 -r dcd446771328 usr.sbin/iostat/iostat.c
--- a/usr.sbin/iostat/iostat.c  Sun Jan 09 02:32:13 2011 +0000
+++ b/usr.sbin/iostat/iostat.c  Sun Jan 09 02:40:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $     */
+/*     $NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $     */
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)iostat.c   8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.55 2011/01/08 02:36:52 jakllsch Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.56 2011/01/09 02:40:19 jakllsch Exp $");
 #endif
 #endif /* not lint */
 
@@ -326,7 +326,8 @@
                            1024.0) / (cur.rxfer[dn] + cur.wxfer[dn]);
                else
                        mbps = 0.0;
-               (void)printf(" %5.2f", mbps);
+               (void)printf(" %5.*f ",
+                   MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps))))), mbps);
 
                                        /* average transfers per second. */
                (void)printf(" %4.0f",
@@ -344,7 +345,7 @@
                        mbps = 0;
                mbps /= etime;
                (void)printf(" %5.*f ",
-                   MAX(0,3-(int)floor(log10(fabs(MAX(1.0,mbps))))), mbps);
+                   MAX(0,3-(int)floor(log10(fabs(fmax(1.0,mbps))))), mbps);
        }
 }
 



Home | Main Index | Thread Index | Old Index