Bug 139389 - [patch] Change top(1) to display thread IDs
Summary: [patch] Change top(1) to display thread IDs
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Eitan Adler
Depends on:
Reported: 2009-10-07 11:00 UTC by Andrew Brampton
Modified: 2018-06-09 02:15 UTC (History)
2 users (show)

See Also:

file.diff (1.90 KB, patch)
2009-10-07 11:00 UTC, Andrew Brampton
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Brampton 2009-10-07 11:00:15 UTC
The program top(1) does not display thread IDs when listing threads (in "-H" mode). Displaying the thread ID can be very useful when using the tool cpuset, as this takes a thread ID as an argument.

The attached patch adds a new column after PID which displays the Thread ID.

Fix: Patch attached with submission follows:
Comment 1 Sergey Kandaurov freebsd_committer 2011-07-06 14:39:53 UTC
Responsible Changed
From-To: freebsd-bugs->pluknet

I will look at it.
Comment 2 Sergey Kandaurov freebsd_committer 2013-02-25 12:16:41 UTC
Responsible Changed
From-To: pluknet->freebsd-bugs

Back to the pool.  I have no idea how to best fit thread IDs 
(requires 6+1 characters) and not exceed 80 characters terminal.
Comment 3 hoomanfazaeli 2015-10-11 19:42:13 UTC
(In reply to Sergey Kandaurov from comment #2)

What about replacing PID column with TID when -H is specified?
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-06-01 05:53:48 UTC
Comment 5 commit-hook freebsd_committer 2018-06-09 02:15:01 UTC
A commit references this bug:

Author: eadler
Date: Sat Jun  9 02:14:35 UTC 2018
New revision: 334864
URL: https://svnweb.freebsd.org/changeset/base/334864

  top(1): use a different command to toggle tid vs pid

  - By popular demand, implement a different switch ("T") for toggling
  between thread id and process id.
  - Add an assert that the size of command chars is as expected.
  - Also clean up some messiness I found when implementing this.
  - Further document the new flag.

  Requested by:	flo, ronald-lists@klop.ws, bapt
  PR:		139389 (for the record)
  X-MFC-With:	r334474