Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jul 2011 20:57:43 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224202 - head/usr.bin/top
Message-ID:  <201107182057.p6IKvhWi039025@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Mon Jul 18 20:57:43 2011
New Revision: 224202
URL: http://svn.freebsd.org/changeset/base/224202

Log:
  Constantly print the command name and if set include the thread
  name in per-thread mode.
  
  Discussed with:	jhb
  Obtained from:	Ed Maste at Sandvine Incorporated
  Sponsored by:	Sandvine Incorporated
  MFC after:	1 week
  Approved by:	re (kib)

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c	Mon Jul 18 20:07:29 2011	(r224201)
+++ head/usr.bin/top/machine.c	Mon Jul 18 20:57:43 2011	(r224202)
@@ -834,7 +834,8 @@ format_next_process(caddr_t handle, char
 	if (!(flags & FMT_SHOWARGS)) {
 		if (ps.thread && pp->ki_flag & P_HADTHREADS &&
 		    pp->ki_tdname[0]) {
-			snprintf(cmdbuf, cmdlengthdelta, "{%s}", pp->ki_tdname);
+			snprintf(cmdbuf, cmdlengthdelta, "%s{%s}", pp->ki_comm,
+			    pp->ki_tdname);
 		} else {
 			snprintf(cmdbuf, cmdlengthdelta, "%s", pp->ki_comm);
 		}
@@ -846,7 +847,7 @@ format_next_process(caddr_t handle, char
 			if (ps.thread && pp->ki_flag & P_HADTHREADS &&
 		    	    pp->ki_tdname[0]) {
 				snprintf(cmdbuf, cmdlengthdelta,
-				    "{%s}", pp->ki_tdname);
+				    "[%s{%s}]", pp->ki_comm, pp->ki_tdname);
 			} else {
 				snprintf(cmdbuf, cmdlengthdelta,
 				    "[%s]", pp->ki_comm);
@@ -890,12 +891,23 @@ format_next_process(caddr_t handle, char
 				dst--;
 			*dst = '\0';
 
-			if (strcmp(cmd, pp->ki_comm) != 0 )
-				snprintf(cmdbuf, cmdlengthdelta,
-				    "%s (%s)",argbuf,  pp->ki_comm);
-			else
-				strlcpy(cmdbuf, argbuf, cmdlengthdelta);
-
+			if (strcmp(cmd, pp->ki_comm) != 0 ) {
+				if (ps.thread && pp->ki_flag & P_HADTHREADS &&
+				    pp->ki_tdname[0])
+					snprintf(cmdbuf, cmdlengthdelta,
+					    "%s (%s){%s}", argbuf, pp->ki_comm,
+					    pp->ki_tdname);
+				else
+					snprintf(cmdbuf, cmdlengthdelta,
+					    "%s (%s)", argbuf, pp->ki_comm);
+			} else {
+				if (ps.thread && pp->ki_flag & P_HADTHREADS &&
+				    pp->ki_tdname[0])
+					snprintf(cmdbuf, cmdlengthdelta,
+					    "%s{%s}", argbuf, pp->ki_tdname);
+				else
+					strlcpy(cmdbuf, argbuf, cmdlengthdelta);
+			}
 			free(argbuf);
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107182057.p6IKvhWi039025>