diff options
author | rwatson <rwatson@FreeBSD.org> | 2007-12-03 21:21:15 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2007-12-03 21:21:15 +0000 |
commit | 6d8cbbd3e81479009deff9e2b5aff6c731225a92 (patch) | |
tree | bcacf317381c82efea001ac774a2f3be8b4a4afe /usr.bin/procstat/procstat_threads.c | |
parent | 33c8c2ef9f896225425077f937727fa0e3372aac (diff) | |
download | FreeBSD-src-6d8cbbd3e81479009deff9e2b5aff6c731225a92.zip FreeBSD-src-6d8cbbd3e81479009deff9e2b5aff6c731225a92.tar.gz |
Display per-thread command line in TDNAME field for -k and -t; if
no per-thread name is available or the name is identical to the
process name, display "-" instead. Very slightly shrink the COMM
entry to make a bit more room, although this doesn't help with
stack traces much.
Suggested by: thompsa
Diffstat (limited to 'usr.bin/procstat/procstat_threads.c')
-rw-r--r-- | usr.bin/procstat/procstat_threads.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/procstat/procstat_threads.c b/usr.bin/procstat/procstat_threads.c index dbfde79..a1cd6e5 100644 --- a/usr.bin/procstat/procstat_threads.c +++ b/usr.bin/procstat/procstat_threads.c @@ -47,8 +47,8 @@ procstat_threads(pid_t pid, struct kinfo_proc *kipp) size_t len; if (!hflag) - printf("%5s %6s %-20s %2s %4s %-7s %-9s\n", "PID", "TID", - "COMM", "CPU", "PRI", "STATE", "WCHAN"); + printf("%5s %6s %-16s %-16s %2s %4s %-7s %-9s\n", "PID", + "TID", "COMM", "TDNAME", "CPU", "PRI", "STATE", "WCHAN"); /* * We need to re-query for thread information, so don't use *kipp. @@ -82,8 +82,11 @@ procstat_threads(pid_t pid, struct kinfo_proc *kipp) kipp = &kip[i]; printf("%5d ", pid); printf("%6d ", kipp->ki_tid); - printf("%-20s ", strlen(kipp->ki_comm) ? + printf("%-16s ", strlen(kipp->ki_comm) ? kipp->ki_comm : "-"); + printf("%-16s ", (strlen(kipp->ki_ocomm) && + (strcmp(kipp->ki_comm, kipp->ki_ocomm) != 0)) ? + kipp->ki_ocomm : "-"); if (kipp->ki_oncpu != 255) printf("%3d ", kipp->ki_oncpu); else if (kipp->ki_lastcpu != 255) |