From 5884281637a87a39ed7d26ef0776391846848d3a Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 14 Feb 1998 13:34:59 +0000 Subject: Fix top sorting of idle processes. top used p_cpticks as a tie-breaker but that isn't suitable (it gets zeroed each second apparently). PR: bin/4957 Submitted-by: Dan Nelson --- usr.bin/top/machine.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin/top') diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 82a419d..d715210 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -17,7 +17,7 @@ * Steven Wallace * Wolfram Schneider * - * $Id: machine.c,v 1.7 1997/09/28 00:59:04 peter Exp $ + * $Id: machine.c,v 1.8 1997/10/05 21:20:56 fsmp Exp $ */ @@ -735,8 +735,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 lifetime 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)] - -- cgit v1.1