Date: Thu, 6 Nov 1997 12:16:17 -0600 (CST) From: dnelson@emsphone.com To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/4957: /bin/top doesn't sort idle processes correctly Message-ID: <199711061816.MAA14661@dan.emsphone.com> Resent-Message-ID: <199711061820.KAA03018@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 4957 >Category: bin >Synopsis: /bin/top doesn't sort idle processes correctly >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 6 10:20:02 PST 1997 >Last-Modified: >Originator: Dan Nelson >Organization: Executive Marketing Services, Inc. >Release: FreeBSD 2.2-970701-RELENG i386 >Environment: >Description: /usr/bin/top doesn't sort idle processes by total CPU usage. The current code is sorting by cpticks, which gets zeroed every second; sort of useless for sorting. >How-To-Repeat: Run top; make sure I)dle processes are shown, see that they are not sorted on CPU usage >Fix: Don't sort on cpticks; instead sort on what top actually prints in the TIME column; rtime.tv_sec. Index: machine.c =================================================================== RCS file: /home/ncvs/src/usr.bin/top/machine.c,v retrieving revision 1.3.2.2 diff -b -u -p -r1.3.2.2 machine.c --- machine.c 1997/09/27 21:30:16 1.3.2.2 +++ machine.c 1997/11/06 17:45:17 @@ -726,8 +726,8 @@ struct proc **pp2; /* compare percent cpu (pctcpu) */ if ((lresult = PP(p2, p_pctcpu) - PP(p1, p_pctcpu)) == 0) { - /* use cpticks to break the tie */ - if ((result = PP(p2, p_cpticks) - PP(p1, p_cpticks)) == 0) + /* use CPU usage to break the tie */ + if ((result = PP(p2, p_rtime).tv_sec - PP(p1, p_rtime).tv_sec) == 0) { /* use process state to break the tie */ if ((result = sorted_state[(unsigned char) PP(p2, p_stat)] - >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711061816.MAA14661>