From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 3 17:07:58 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 075E468A; Mon, 3 Jun 2013 17:07:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EDF081AED; Mon, 3 Jun 2013 17:07:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53H7vVG082275; Mon, 3 Jun 2013 17:07:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53H7v7K082274; Mon, 3 Jun 2013 17:07:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306031707.r53H7v7K082274@svn.freebsd.org> From: John Baldwin Date: Mon, 3 Jun 2013 17:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r251312 - stable/8/usr.bin/top X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 17:07:58 -0000 Author: jhb Date: Mon Jun 3 17:07:57 2013 New Revision: 251312 URL: http://svnweb.freebsd.org/changeset/base/251312 Log: MFC 248167: Fix the 'C' field for a running thread to match the behavior described in the manpage by having it display the current CPU (ki_oncpu) rather than the previously used CPU (ki_lastcpu). ki_lastcpu is still used for all other thread states. Modified: stable/8/usr.bin/top/machine.c Directory Properties: stable/8/usr.bin/top/ (props changed) Modified: stable/8/usr.bin/top/machine.c ============================================================================== --- stable/8/usr.bin/top/machine.c Mon Jun 3 17:07:34 2013 (r251311) +++ stable/8/usr.bin/top/machine.c Mon Jun 3 17:07:57 2013 (r251312) @@ -796,7 +796,7 @@ format_next_process(caddr_t handle, char double pct; struct handle *hp; char status[16]; - int state; + int cpu, state; struct rusage ru, *rup; long p_tot, s_tot; char *proc_fmt, thr_buf[6], jid_buf[6]; @@ -995,6 +995,13 @@ format_next_process(caddr_t handle, char } /* format this entry */ + if (smpmode) { + if (state == SRUN && pp->ki_oncpu != 0xff) + cpu = pp->ki_oncpu; + else + cpu = pp->ki_lastcpu; + } else + cpu = 0; proc_fmt = smpmode ? smp_Proc_format : up_Proc_format; if (ps.thread != 0) thr_buf[0] = '\0'; @@ -1012,7 +1019,7 @@ format_next_process(caddr_t handle, char format_k2(PROCSIZE(pp)), format_k2(pagetok(pp->ki_rssize)), status, - smpmode ? pp->ki_lastcpu : 0, + cpu, format_time(cputime), ps.wcpu ? 100.0 * weighted_cpu(pct, pp) : 100.0 * pct, screen_width > cmdlengthdelta ? screen_width - cmdlengthdelta : 0,