top -d1 behavior
Fernando Apesteguía
fernando.apesteguia at gmail.com
Wed Dec 17 22:27:42 UTC 2014
On Tue, Dec 16, 2014 at 6:03 PM, John Baldwin <jhb at freebsd.org> wrote:
> On Sunday, November 23, 2014 4:57:33 pm Fernando Apesteguía wrote:
>> > Neither seem like what the user would expect.
>>
>> Agreed. But this is mostly unexpected (and can lead scripts to fail):
>
> Actually, I think having it output the states since boot would be more
> consistent with other tools like iostat/vmstat/etc. They report states
> on the first iteration that are states since boot. For example:
>
> % iostat 1
> tty ada0 ada1 cd0 cpu
> tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id
> 8 225 20.41 12 0.24 20.56 12 0.24 2.79 0 0.00 3 0 2 0 95
> 0 6230 60.00 6 0.35 64.80 10 0.62 0.00 0 0.00 9 0 91 0 0
> 0 6195 64.00 5 0.31 51.43 7 0.35 0.00 0 0.00 11 0 89 0 1
>
> Can you test this test patch to see if it gives you what you expect from
> top -d1?
Yes it does.
I thought however that the discussion was over :) so I filed a PR[1]
to at least warn in the man page about the special behavior for this
case.
I would rather fix top and leave the man page as it is.
Cheers.
[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195717
>
> Index: contrib/top/top.c
> ===================================================================
> --- top.c (revision 275828)
> +++ top.c (working copy)
> @@ -176,7 +176,7 @@ char *argv[];
> int preset_argc = 0;
> char **av;
> int ac;
> - char dostates = No;
> + char dostates = Yes;
> char do_unames = Yes;
> char interactive = Maybe;
> char warnings = 0;
>
> --
> John Baldwin
More information about the freebsd-hackers
mailing list