From owner-svn-src-head@freebsd.org Fri Jun 1 05:51:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDFA8EF3749; Fri, 1 Jun 2018 05:51:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E0767D1CC; Fri, 1 Jun 2018 05:51:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66CD424C58; Fri, 1 Jun 2018 05:51:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w515pfYj090928; Fri, 1 Jun 2018 05:51:41 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w515pfoB090926; Fri, 1 Jun 2018 05:51:41 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806010551.w515pfoB090926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 1 Jun 2018 05:51:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334474 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2018 05:51:42 -0000 Author: eadler Date: Fri Jun 1 05:51:40 2018 New Revision: 334474 URL: https://svnweb.freebsd.org/changeset/base/334474 Log: top(1): Display of TID when using 'H' flag Some users prefer seeing the TID when viewing individual threads. This makes sense as the PID will be the same for multiple entries. An attempt was made to include both, but there is insufficient room. As such, using the TID. While here, rename the header variables to be more understandable. Discussed with: mmacy Reported on: 2009-10-07 Modified: head/usr.bin/top/machine.c head/usr.bin/top/top.1 Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Fri Jun 1 05:48:28 2018 (r334473) +++ head/usr.bin/top/machine.c Fri Jun 1 05:51:40 2018 (r334474) @@ -97,18 +97,18 @@ static char io_header[] = #define io_Proc_format \ "%5d%*s %-*.*s %6ld %6ld %6ld %6ld %6ld %6ld %6.2f%% %.*s" -static char smp_header_thr[] = +static char smp_header_thr_and_pid[] = " PID%*s %-*.*s THR PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; -static char smp_header[] = - " PID%*s %-*.*s " "PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; +static char smp_header_tid_only[] = + " THR%*s %-*.*s " "PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; #define smp_Proc_format \ "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s %2d%7s %6.2f%% %.*s" -static char up_header_thr[] = +static char up_header_thr_and_pid[] = " PID%*s %-*.*s THR PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; -static char up_header[] = - " PID%*s %-*.*s " "PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; +static char up_header_tid_only[] = + " THR%*s %-*.*s " "PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; #define up_Proc_format \ "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s%.0d%7s %6.2f%% %.*s" @@ -436,8 +436,8 @@ format_header(char *uname_field) * separate lines). */ prehead = smpmode ? - (ps.thread ? smp_header : smp_header_thr) : - (ps.thread ? up_header : up_header_thr); + (ps.thread ? smp_header_tid_only : smp_header_thr_and_pid) : + (ps.thread ? up_header_tid_only : up_header_thr_and_pid); snprintf(Header, sizeof(Header), prehead, jidlength, ps.jail ? " JID" : "", namelength, namelength, uname_field, @@ -1145,7 +1145,7 @@ format_next_process(caddr_t xhandle, char *(*get_useri (int)(sizeof(thr_buf) - 2), pp->ki_numthreads); snprintf(fmt, sizeof(fmt), proc_fmt, - pp->ki_pid, + (ps.thread) ? pp->ki_tid : pp->ki_pid, jidlength, jid_buf, namelength, namelength, (*get_userid)(pp->ki_ruid), thr_buf, Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Fri Jun 1 05:48:28 2018 (r334473) +++ head/usr.bin/top/top.1 Fri Jun 1 05:51:40 2018 (r334474) @@ -331,6 +331,7 @@ command. .TP .B H Toggle the display of threads. +Also toggles the display of PID or TID. .TP .B i (or