Subject: Re: changes to top to print wchan for sleeping procs
To: Hubert Feyrer <email@example.com>
From: Laine Stump <firstname.lastname@example.org>
Date: 01/17/2001 12:43:39
Hubert Feyrer <email@example.com> writes:
> On Wed, 17 Jan 2001, enami tsugutomo wrote:
> > Here is my local mod to top(1) to print wchan for sleeping process.
> > Some of us also likes this change. So, I'd like to commit this. Is
> > there any objection or thoughts? Especially, is it better to have a
> > PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
> > 21958 enami 10 0 748K 1232K wait 0:00 0.67% 0.24% bash
> > 4 root 18 0 0K 24M syncer 16:19 0.15% 0.15% ioflush
> > 21957 root 2 0 268K 1380K select 0:00 0.22% 0.10% sshd
> > 284 enami 2 0 8200K 9520K select 56:17 0.00% 0.00% XFree86
> > 11117 enami 36 4 20M 4K stop 22:14 0.00% 0.00% <emacs>
> > 23502 enami 2 0 712K 4K select 7:28 0.00% 0.00% <slogin>
> > 2863 enami 28 0 1820K 4K stop 3:44 0.00% 0.00% <w3m>
> > 287 enami 2 0 396K 4K select 1:23 0.00% 0.00% <kterm>
> > 166 root 2 0 48K 348K nfsd 1:02 0.00% 0.00% nfsd
Cool! I used to have a top patched to do that, but I lost it when I
upgraded from 1.3.x to 1.4.x. Having wchan available in a top display
makes it much easier to figure out the source of locked processes.
> I think it's confusing as see seem to have a whole bunch of new CPU states
> now. replacing wchan in favour of wchan, and leaving the old state avoids
I'm not sure I understand what "replacing wchan in favour of wchan"
means. Are you suggesting a separate WCHAN column?
Isn't it the case that the STATE column is more or less redundant
when there is anything of interest in WCHAN? After all, it's always
"sleep". And when STATE isn't "sleep", WCHAN is empty - you have two
columns whose information can be completely contained in a single
column. Aside from that, if you put a separate column for WCHAN,
either the display must be wider than 80 columns, or you must get rid of
I like the patch the way it is. The only possible change I might
suggest (and there probably isn't enough room for it on the line
anyway) would be to give some sort of indication *in the same column*
that the process is actually in a sleep state. Maybe, eg, "(S)select",
"S-select", "W-select", "(select)", or something like that.
As far as commandline options for the feature - I guess that at least
depends on if there are any scripts out there using the output of top
(and depending on the contents of the STATE column). If so, then its
default behavior should probably remain the same as much as possible.
Otherwise, I think it would be better for this new behavior to be the
default, since newbies otherwise probably won't find it.