cvs commit: src/usr.bin/top machine.c

Bruce Evans bde at zeta.org.au
Mon Apr 18 15:19:36 PDT 2005


On Mon, 18 Apr 2005, Giorgos Keramidas wrote:

> On 2005-04-18 15:57, Bruce Evans <bde at zeta.org.au> wrote:
>> On Sun, 17 Apr 2005, Giorgos Keramidas wrote:
>>> On 2005-04-17 23:01, Bruce Evans <bde at zeta.org.au> wrote:
>>>> Just removing the CPU column doesn't seem right.  ps has a -C flag
>>>> to switch between WCPU and CPU.
>>>
>>> We can add a new toggle command to top, i.e. 'C', that toggles
>>> between displaying WCPU or CPU.  This should regain us a lot of the
>>> space lost from COMMAND after I added THR.
>>
>> I like that.
>
> Unfortunately, David has already said he doesn't, so making such a
> chance wouldn't be good enough, but thanks :)

I think he doesn't really mean that.

> ...
> I'll add the C option to the right place in my local copy.  Moving H too
> is an option, but that should probably be done as part of a different
> style-sweep of top, which has an amazing number of style bugs already.

Note that it is not in KNF, so most changes towords KNF in it would be
style bugs, and it's hard to tell what the style is.

>> I thought that you would have to change the sorting method to switch
>> between WCPU and CPU, but the existing sorting is only on CPU.  It is
>> just more bogus to sort on CPU while only displaying WCPU.
>
> Ah, yes.  Good point.  I thought about it for a while, but was
> undecided.  Changing the sort order needs a new sorting method,
> but it's definitely something I can easily add.

Maybe you can just change ki_pctcpu to the value that will be displayed,
and not change the sorting method.  (Maybe use an extension of the
struct or a spare member of the struct to avoid abusing ki_pctcpu.)

I sometimes want to look at ki_estcpu, which is an even rawer version of
ki_pctcpu.  (This is given by the CPU header and cpu keyword in ps.  It's
confusing that top has different headers -- its WCPU corresponds to ps's
%CPU header and %cpu keyword, except with the C toggle in ps, its CPU
corresponds to those.)  The toggle is not so good for switching between
more than 2 variants of CPU.

Bruce


More information about the cvs-all mailing list