| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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@
|
|
|
|
| |
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@
|
|
|
|
| |
returning const char *.
|
|
|
|
|
|
|
|
|
| |
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@
|
| |
|
| |
|
|
|
|
| |
calls. if we need a big space once, we'll likely need a big space again.
|
|
|
|
|
|
| |
OK tedu@, deraadt@, and with input from Michal Mazurek.
Thanks
|
|
|
|
| |
ok krw millert
|
|
|
|
|
|
|
|
|
|
|
|
| |
is used.
The rationnal is that when you're looking at threads you're generally
already filtereing by PID and this allow you to see which thread is a
pig.
Written some time ago with mikeb@
ok sthen@, krw@, guenther@
|
|
|
|
|
| |
There's no need for crazy casts of p_pctcpu in ORDERKEY_PCTCPU
since kinfo_proc exports it as uint32_t. OK deraadt@
|
|
|
|
|
| |
the header version
ok guenther
|
|
|
|
|
|
|
|
|
| |
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)
|
|
|
|
|
|
| |
you passed -1 on the command line).
ok kettenis@ tedu@
|
|
|
|
|
|
|
|
|
|
| |
related to disk stastics for almost 17 years, and the remaining
userland-visible defines duplicate those found in <sys/sched.h>.
Move the remaining _KERNEL defines to <sys/tty.h> where they belong, and
update all users to cope with this.
ok kettenis@
|
|
|
|
|
|
|
|
|
|
|
| |
PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's
thread data. This eliminates the need for the thread-level SDEAD state.
Change kvm_getprocs() (both the sysctl() and kvm backends) to report the
"most active" scheduler state for the process's threads.
tweaks kettenis@
feedback and ok matthew@
|
|
|
|
|
|
|
| |
include <sys/vmmeter.h> where it is needed instead of relying on
it being included by <uvm/uvm_extern.h>.
miod@ likes it, ok guenther@
|
|
|
|
|
|
| |
(wmesg hasn't itself been a pointer since conversion to kinfo_proc.)
noticed by sthen.
ok deraadt jsing millert sthen
|
|
|
|
|
|
|
| |
is no direct need for sys/proc.h or sys/resource.h. Some consumers
of kinfo_proc need these for the proc flags and rlimit defines like
RLIM_INF so add the appropriate includes to them.
OK deraadt@ sthen@
|
|
|
|
|
| |
in a fire. Start by removing the definitions, before we clean the
headers later.
|
|
|
|
| |
feedback & ok lum@
|
|
|
|
|
|
| |
This lets new binaries work (at least w/o the -H option) with old kernels.
ok pirofti@ deraadt@
|
|
|
|
|
|
|
|
|
|
|
|
| |
thread information.
Add a KERN_PROC_SHOW_THREADS flag that has to be set in order to get the
thread info and make it off by default. This creates backwards compatibility
for applications that relied on a given size/number of items to be returned.
Modify ps(1) and top(1) accordingly.
Okay guenther@.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This expands the already bloated FILL_KPROC macro to take an extra
parameter that indicates if the callee is a thread or a process.
The userland bits are adjusted accordingly and ps(1) and top(1) now
display per thread usage times when -H is used.
Also pkill(1) had to be adjusted so that duplicates don't pop up.
libkvm does basically the same thing as the kernel bits.
Okay guenther@.
|
| |
|
|
|
|
|
|
| |
that we've got name we want for the API we want
"ZAP!" deraadt@
|
| |
|
|
|
|
|
| |
top(1) and ps(1) now display the same info.
ok tedu@ millert@ otto@ and tested on sparc64 by landry@
|
|
|
|
| |
ok jmc otto
|
| |
|
| |
|
|
|
|
| |
inspired by zinovik@cs.karelia.ru
|
|
|
|
|
| |
Enables nice things like process highlighting without hurting the brain.
ok deraadt@
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
command name. ok deraadt@
|
|
|
|
| |
do not link with libm. ok ray@
|
| |
|
| |
|
|
|
|
|
| |
better style here; plus it prevents bogus data to show up on first display.
report + ok pedro@
|
|
|
|
| |
OK deraadt@
|
|
|
|
| |
ok brad, hints from jmc
|
|
|
|
| |
with Jared Yanovich; ok deraadt
|
|
|
|
| |
Based on work by todd@ at the hackathon.
|
| |
|