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); } } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"