Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ps Make %cpu drop the decimal part when reaching 100%, t...
details: https://anonhg.NetBSD.org/src/rev/cb255a488860
branches: trunk
changeset: 756645:cb255a488860
user: njoly <njoly%NetBSD.org@localhost>
date: Tue Jul 27 12:40:48 2010 +0000
description:
Make %cpu drop the decimal part when reaching 100%, to stay in the 5
expected columns.
diffstat:
bin/ps/print.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (32 lines):
diff -r 4c8f36d0bf56 -r cb255a488860 bin/ps/print.c
--- a/bin/ps/print.c Tue Jul 27 08:07:36 2010 +0000
+++ b/bin/ps/print.c Tue Jul 27 12:40:48 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.113 2010/05/31 03:18:33 rmind Exp $ */
+/* $NetBSD: print.c,v 1.114 2010/07/27 12:40:48 njoly Exp $ */
/*
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-__RCSID("$NetBSD: print.c,v 1.113 2010/05/31 03:18:33 rmind Exp $");
+__RCSID("$NetBSD: print.c,v 1.114 2010/07/27 12:40:48 njoly Exp $");
#endif
#endif /* not lint */
@@ -1087,10 +1087,12 @@
{
struct kinfo_proc2 *k;
VAR *v;
+ double dbl;
k = arg;
v = ve->var;
- doubleprintorsetwidth(v, getpcpu(k), 1, mode);
+ dbl = getpcpu(k);
+ doubleprintorsetwidth(v, dbl, (dbl >= 100.0) ? 0 : 1, mode);
}
double
Home |
Main Index |
Thread Index |
Old Index