top -d1 behavior
Fernando Apesteguía
fernando.apesteguia at gmail.com
Sun Nov 23 17:11:05 UTC 2014
Hi hackers,
While writing a small script for a friend, I run into a peculiar top behavior:
top -d1 shows only one 'iteration' of the information screen, but in
it, the CPU percentages line is not well formed: there are 5 columns
with the '%' symbol, but no values are shown. This only happens for
-d1 and this behavior is deliberately done in the sources (see
'dostates' variable).
Also we are using pc_cp_time from struct pcpu as the output for the
kern.cp_time sysctl (used by top to know the time spent by the cpu in
every state), and we are using the same fields in linprocfs for the
'stat' file in linux emulation (so a linux top version would read and
print out those values).
My point is: why are we doing this? If we remove that constraint, top
would show the values for -d1. I don't know if they would be really
accurate, but not printing anything doesn't seem a nice behavior
either (especially when this is not documented in the man page)
Thanks in advance.
More information about the freebsd-hackers
mailing list