Actions
Bug #12604
closedw needs to use line name instead of pid
Start date:
Due date:
% Done:
100%
Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
Description
Currently w does the following to calculate the JCPU/PCPU values and find most interesting process for the terminal:
1. Get the records from utmpx.
2. For every entry, use the recorded PID to find all children and calculate the values.
This fails in e.g. tmux (with libutempter) or screen case as the PID will be the same for all terminals under the program control. To fix this, we should match the actual terminal processes belong to instead.
Updated by Yuri Pankov almost 2 years ago
To test this I used tmux built with utempter support, and checked that `w` output corresponds to what is actually running in tmux panes.
Updated by Joshua M. Clulow almost 2 years ago
From Yuri:
Output before the change:¶
$ sudo ~/ws/tosol/proto/root_i386/usr/bin/w 15:11:40 up 3 day(s), 2:42, 1 user, load average: 0.04, 0.12, 0.07 User tty login@ idle JCPU PCPU what ypankov pts/1 10:01:57 0 1 1 tmux at ypankov pts/2 Sat 12:33 5:10 5:43:15 5:18 /home/ypankov/ws/tosol/proto/roo ypankov pts/3 Sat 12:34 0 0 0 /home/ypankov/ws/tosol/proto/roo ypankov pts/4 Sun 11:56 0:46:14 0 0 /home/ypankov/ws/tosol/proto/roo ypankov pts/5 Sun 14:15 0:43:15 0 0 /home/ypankov/ws/tosol/proto/roo ypankov pts/6 Sun 16:16 0:43:00 0 0 /home/ypankov/ws/tosol/proto/roo ypankov pts/7 Sun 18:08 0:40:54 0 0 /home/ypankov/ws/tosol/proto/roo ypankov pts/8 Sun 18:11 0:43:13 0 0 /home/ypankov/ws/tosol/proto/roo ypankov pts/9 Sun 18:58 0:44:13 0 0 /home/ypankov/ws/tosol/proto/roo ypankov pts/10 Sun 22:17 27:24 0 0 /home/ypankov/ws/tosol/proto/roo
Output after the change:¶
$ w 15:11:51 up 3 day(s), 2:42, 1 user, load average: 0.04, 0.12, 0.07 User tty login@ idle JCPU PCPU what ypankov pts/1 10:01:57 0 0 0 tmux at ypankov pts/2 Sat 12:33 5:10 2:17 2:17 irssi ypankov pts/3 Sat 12:34 0 1:21:50 11 w ypankov pts/4 Sun 11:56 0:46:14 2 0 -zsh ypankov pts/5 Sun 14:15 0:43:15 3:51:24 2 /bin/zsh ypankov pts/6 Sun 16:16 0:43:01 7 0 -zsh ypankov pts/7 Sun 18:08 0:40:54 4:48 2 /bin/zsh ypankov pts/8 Sun 18:11 0:43:13 11 0 less -ins ypankov pts/9 Sun 18:58 0:44:13 0 0 less -ins ypankov pts/10 Sun 22:17 27:25 11:35 6 vim usr.bin/make/suff.c
Updated by Electric Monk almost 2 years ago
- Status changed from In Progress to Closed
- % Done changed from 10 to 100
git commit 3f764e121447070c490c9637dd5791f8c8823ee4
commit 3f764e121447070c490c9637dd5791f8c8823ee4 Author: Yuri Pankov <ypankov@tintri.com> Date: 2020-06-30T00:56:55.000Z 12604 w needs to use line name instead of pid Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Dan McDonald <danmcd@joyent.com>
Actions