From owner-svn-src-stable-8@FreeBSD.ORG Fri Sep 16 17:41:57 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CFB11065675; Fri, 16 Sep 2011 17:41:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C6F28FC15; Fri, 16 Sep 2011 17:41:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8GHfutN031752; Fri, 16 Sep 2011 17:41:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8GHfuVE031750; Fri, 16 Sep 2011 17:41:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109161741.p8GHfuVE031750@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Sep 2011 17:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225620 - stable/8/usr.bin/top X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Sep 2011 17:41:57 -0000 Author: jhb Date: Fri Sep 16 17:41:56 2011 New Revision: 225620 URL: http://svn.freebsd.org/changeset/base/225620 Log: MFC 224062: Revert 130163 and let top use KERN_PROC_PROC when individual threads are not displayed. The KERN_PROC_PROC sysctl was fixed in 188764. 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 Fri Sep 16 17:39:39 2011 (r225619) +++ stable/8/usr.bin/top/machine.c Fri Sep 16 17:41:56 2011 (r225620) @@ -622,7 +622,6 @@ get_process_info(struct system_info *si, int active_procs; struct kinfo_proc **prefp; struct kinfo_proc *pp; - struct kinfo_proc *prev_pp = NULL; /* these are copied out of sel for speed */ int show_idle; @@ -655,7 +654,8 @@ get_process_info(struct system_info *si, } previous_proc_count = nproc; - pbase = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc); + pbase = kvm_getprocs(kd, sel->thread ? KERN_PROC_ALL : KERN_PROC_PROC, + 0, &nproc); if (nproc > onproc) pref = realloc(pref, sizeof(*pref) * (onproc = nproc)); if (pref == NULL || pbase == NULL) { @@ -725,21 +725,8 @@ get_process_info(struct system_info *si, /* skip proc. that don't belong to the selected UID */ continue; - /* - * When not showing threads, take the first thread - * for output and add the fields that we can from - * the rest of the process's threads rather than - * using the system's mostly-broken KERN_PROC_PROC. - */ - if (sel->thread || prev_pp == NULL || - prev_pp->ki_pid != pp->ki_pid) { - *prefp++ = pp; - active_procs++; - prev_pp = pp; - } else { - prev_pp->ki_pctcpu += pp->ki_pctcpu; - prev_pp->ki_runtime += pp->ki_runtime; - } + *prefp++ = pp; + active_procs++; } /* if requested, sort the "interesting" processes */