Source-Changes-HG archive

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

[src/trunk]: src/bin/ps simplify logic; there must be no CPU usage when p_swt...



details:   https://anonhg.NetBSD.org/src/rev/dd7ce9c4fbe7
branches:  trunk
changeset: 349867:dd7ce9c4fbe7
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Dec 26 20:52:39 2016 +0000

description:
simplify logic; there must be no CPU usage when p_swtime is zero

diffstat:

 bin/ps/ps.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 87254aac8cf4 -r dd7ce9c4fbe7 bin/ps/ps.c
--- a/bin/ps/ps.c       Mon Dec 26 20:28:00 2016 +0000
+++ b/bin/ps/ps.c       Mon Dec 26 20:52:39 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ps.c,v 1.87 2016/12/02 21:59:03 christos Exp $ */
+/*     $NetBSD: ps.c,v 1.88 2016/12/26 20:52:39 rin Exp $      */
 
 /*
  * Copyright (c) 2000-2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 #if 0
 static char sccsid[] = "@(#)ps.c       8.4 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: ps.c,v 1.87 2016/12/02 21:59:03 christos Exp $");
+__RCSID("$NetBSD: ps.c,v 1.88 2016/12/26 20:52:39 rin Exp $");
 #endif
 #endif /* not lint */
 
@@ -611,8 +611,7 @@
                pi[i].ki = &ki[i];
                if (!calc_pcpu)
                        continue;
-               if (ki[i].p_realstat == SZOMB ||
-                   (!rawcpu && ki[i].p_swtime == 0)) {
+               if (ki[i].p_swtime == 0 || ki[i].p_realstat == SZOMB) {
                        pi[i].pcpu = 0.0;
                        continue;
                }



Home | Main Index | Thread Index | Old Index