Age | Commit message (Collapse) | Author |
|
ok miod@ millert@
|
|
exposed in a new field returned by sysctl(KERN_PROC). Update
pthread_{get,set}_name_np(3) to use the syscalls. Show them, when
set, in ps -H and top -H output.
libc and libpthread minor bumps
ok mpi@, mvs@, deraadt@
|
|
If hw.smt is toggled while top(1) is running in "combined" mode the
CPU count on the CPU state line is incorrect.
We always need to recount the number of online CPUs.
|
|
millert@ removed most of the "last pid" support from top(1) in 1997.
See, e.g. top/machine.c,v1.7:
http://cvsweb.openbsd.org/src/usr.bin/top/machine.c?rev=1.7&content-type=text/x-cvsweb-markup
Let's remove the rest of it:
- Eliminate system_info.last_pid.
- Remove mpid parameter and "last pid" printing code from i_loadave().
Link: https://marc.info/?l=openbsd-tech&m=166277253606823&w=2
ok millert@
|
|
1. It's sometimes useful to know the system uptime with more precision
than one minute.
So, this patch changes top(1) to print seconds of uptime in addition
to minutes, hours, and days.
2. It's *always* annoying when the information you want on a realtime
display is not shown in the same place in a consistent format.
So, this patch also changes top(1) to always print the uptime like
this:
up D days HH:MM:SS
This is much easier to read at a glance. In particular, it requires
no additional thought on my part to figure out whether the machine has
been up less than one day.
Maybe of note is that these changes make top(1)'s output different
from that of uptime(1). I don't think this matters very much. top(1)
is a realtime display, so it isn't likely to be parsed. uptime(1) is
a different story.
Link: https://marc.info/?l=openbsd-tech&m=160046282400892&w=2
Positive feedback from kn@.
ok gnezdo@ bluhm@ millert@
|
|
jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.
ok jmc@
|
|
from sys/param.h include lines, or remove the include lines entirely if
it this was the least requirement.
ok millert
|
|
person. Rewrite or use singular they.
ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@
|
|
|
|
|
|
Swap the WAIT column with RTABLE (and vice versa); WAIT is wide enough to
fit RTABLE, somewhat adds additional value to STATE and seems therefore most
appropiate to hide in favour of RTABLE.
Filtering rtables with "T" does not toggle the column, just like filtering
users with "u" does not toggle between user and thread id.
Feedback jmc
OK remi
|
|
No functional change, the rename is for consistency and the buffer
handling reduces churn in an upcoming diff.
|
|
"-T-0" for processes outside the default routing table, "-T3" for those in
a specific one; same semantics as with other filters.
Manual wording and command line flag taken from pgrep(1) being the only way
to identify processes by routing table; After netstat(1)'s recent addition
of "-R", filtering in top makes for handy tooling around rtable(4).
"looks good to me" millert
OK remi
|
|
Simpliy mdoc(7) markup for "n|# count" while here.
Positive manual feedback jmc
No objections millert
|
|
No object change.
|
|
The order of commands is not in sync between help page and manual, but I
refrained from reordering to avoid churn.
OK millert
|
|
Those are global variables are (zero) initialised as such already and
machine_init() is called only once upon startup.
OK mvs
|
|
Only ever set or decremented since import with machine.c r1.1 (1997);
While here, simplify the skip semantics behind the scroll functionality.
OK millert
|
|
Those were removed in r1.39 in 2004.
|
|
There is no code anymore that puts angle brackets around swapped out
processes, machine.c r1.54 removed this in 2006.
Typo in first diff spotted by Matthew Martin,
OK jmc (who also pointed out the CVS commit)
|
|
For the sake of simplicity and to reflect that the process list is always
sorted (default is "cpu"), even if not explicitly requested; this makes it
easier to argue about the code around sort order and its selection.
OK millert
|
|
|
|
Planned improvements: scroll position displaying, using arrow/pgup/pgdown keys.
okay tedu@
|
|
KERN_PROC_SHOW_THREADS and have been rendered superfluous by it.
Similarly, some P_SYSTEM tests can be deleted or pushed to the
kernel by using KERN_PROC_ALL instead of KERN_PROC_KTHREAD.
ok visa@ mpi@
|
|
The manual has it, complete the help screen.
OK millert
|
|
Instead of always passing the threads flag which decides whether other
function arguments are used or not, make callers pass those arguments or
NULL depending on the threads flag.
This reflects better how thread IDs are shown in place of user names/IDs.
OK millert
|
|
Be consistent with other programs in base and unify variable usage as
follows to improve readability:
bool = (bool == No) ? Yes : No -> bool = !bool
if (bool == Yes) -> if (bool)
if (bool == No) -> if (!bool)
bool = Maybe -> bool = -1
OK millert
|
|
get_process_info() returns a pointer to the global handle later only be
used in format_next_process(); treat this struct handle as such without
casting the pointer to caddr_t and back again.
No object change.
OK millert deraadt
|
|
SETORDER() can assign from function arguments directly without additional
identical structs in each function.
No object change.
OK millert
|
|
|
|
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
|
|
Prefixing the field with a dash will sort processes in reverse order.
`o -pid' will therefore list PID 1 on top.
"looks good" tedu, improvements and OK cheloha
|
|
Because of hw.smt we need a way to determine whether a given CPU is "online"
or "offline" from userspace. KERN_CPTIME2 is an array, and so cannot be
cleanly extended for this purpose, so add a new sysctl(2) KERN_CPUSTATS
with an extensible struct. At the moment it's just KERN_CPTIME2 with a
flags member, but it can grow as needed.
KERN_CPUSTATS appears to have been defined by BSDi long ago, but there are
few (if any) packages in the wild still using the symbol so breakage in ports
should be near zero. No other system inherited the symbol from BSDi, either.
Then, use the new sysctl(2) in systat(1) and top(1):
- systat(1) draws placeholder marks ('-') instead of percentages for
offline CPUs in the cpu view.
- systat(1) omits offline CPU ticks when drawing the "big bar" in
the vmstat view. The upshot is that the bar isn't half idle when
half your logical CPUs are disabled.
- top(1) does not draw lines for offline CPUs; if CPUs toggle on or
offline in interactive mode we redraw the display to expand/reduce
space for the new/missing CPUs. This is consistent with what some
top(1) implementations do on Linux.
- top(1) omits offline CPUs from the totals when CPU totals are
combined into a single line (the '-1' flag).
Originally prompted by deraadt@. Discussed endlessly with deraadt@,
ketennis@, and sthen@. Tested by jmc@ and jca@. Earlier versions also
discussed with jca@. Earlier versions tested by jmc@, tb@, and many
others.
docs ok jmc@, kernel bits ok ketennis@, everything ok sthen@,
"Is your stuff in yet?" deraadt@
|
|
This makes `top -U 0' and "u-1000" work.
Feedback and "that looks right" tedu, OK millert, manual bits and OK jmc
|
|
This introduces filteruser() and filterpid(), where the first one can now
easily be extended to support matching numeric UIDs. The latter one is now
used by the `highlight` command as well.
No change in behaviour or output.
Feedback and OK millert
|
|
ok kettenis deraadt
|
|
This lets userspace distinguish between idle CPUs and those that are
not schedulable because hw.smt=0.
A subsequent commit probably needs to add documentation for this
to sysctl.2 (and perhaps elsewhere) after the dust settles.
Also included here are changes to systat(1) and top(1) that account
for the ENODEV case and adjust behavior accordingly:
- systat(1)'s cpu view prints placeholder marks ('-') instead of
percentages for each state if the given CPU is offline.
- systat(1)'s vmstat view checks for offline CPUs when computing the
machine state total and excludes them, so the CPU usage graph
only represents the states for online CPUs.
- top(1) does not draw CPU rows for offline CPUs when the view is
redrawn. If CPUs "go offline", percentages for each state are
replaced by placeholder marks ('-'); the view will need to be
redrawn to remove these rows. If CPUs "go online" the view will
need to be redrawn to show these new CPUs. In "combined CPU" mode,
the count and the state totals only represent online CPUs.
Ports using KERN_CPTIME2 will need to be updated. The changes
described above to make systat(1) and top(1) aware of the ENODEV
case *and* gracefully handle a changing HW_NCPUONLINE while the
application is running are not necessarily appropriate for each
and every port.
The changes described above are so extensive in part to demonstrate
one way a program *might* be made robust to changing CPU availability.
In particular, changing hw.smt after boot is an extremely rare event,
and this needs to be weighed when updating ports.
The logic needed to account for the KERN_CPTIME2 ENODEV case is
very roughly:
if (sysctl(...) == -1) {
if (errno != ENODEV) {
/* Actual error occurred. */
} else {
/* CPU is offline. */
}
} else {
/* CPU is online and CPU states were set by sysctl(2). */
}
Prompted by deraadt@. Basic idea for ENODEV from kettenis@. Discussed at
length with kettenis@. Additional testing by tb@.
No complaints from hackers@ after a week.
ok kettenis@, "I think you should commit [now]" deraadt@
|
|
|
|
in username.c are now so simple there is no longer a good reason
to use them. OK deraadt@
|
|
ok deraadt@
|
|
userid().
|
|
do repeated lookups. OK tb@
|
|
returning const char *.
|
|
files ever again, so we can re-pledge tighter.
|
|
from Marcus MERIGHI; OK deraadt@ jmc@
|
|
system time.
Introduce a new CP_SPIN "scheduler state" and modify userland tools
to display the % of timer a CPU spents spinning.
Based on a diff from jmatthew@, ok pirofti@, bluhm@, visa@, deraadt@
|
|
|
|
and put it to use in userspace in lieu of the kern.boottime
sysctl.
Its absolute value is the time that has elapsed since the
system booted, i.e., the system uptime.
Use in top(1), w(1), and snmpd(8) eliminates a race with
settimeofday(2), adjtime(2), etc. inherent to deriving the
system uptime via the kern.boottime sysctl.
Product of a great deal of discussion/revision with jca@, tb@,
and guenther@.
ok tb@ jca@ guenther@ dlg@ mlarkin@ tom@
|
|
|
|
|