summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use message_set() instead of direct assignment to curr_messagetb2021-02-061-3/+3
| | | | | | to avoid leaking the current help text. from Anindya Mukherjee
* Fix delay parsing by stealing from strtonum and returning a proper error tomartijn2021-01-301-12/+64
| | | | | | | | | | | | | | the user when an invalid value is entered instead of silently falling back to the default 5s. While here I also capped the upper limit to UINT32_MAX / 1000000 to prevent useconds_t overflow. This hard limits us to 4294s, instead of the current soft limit which just make systat go berserk if you go over it. Reported and original diff by Nick Gasson nick <at> nickg <dot> me <dot> uk OK cheloha@ Tweaks and OK bluhm@
* Move defiition of sum variable from header file to avoid issues withmortimer2021-01-182-3/+6
| | | | | | -fno-common ok deraadt@
* kill trailing whitespacejasper2021-01-091-12/+12
|
* print all the rings on a nic without limiting it to the number of mclpoolsdlg2020-12-221-2/+2
| | | | "makes sense" jmatthew@
* pf: Merge NOTES column into NAME columnkn2020-09-141-29/+14
| | | | | | | | | | | | NOTES stays unused unless pf.conf(5) contains "set loginterface ..." in which case it merely amends what can otherwise be part of the NAME column. Merge the constant NOTES values for conditional counters into their NAME values to make the "pf" view look a little nicer and less empty by default; this also saves screen estate for possible future changes, e.g. we could increase column widths. OK tobhe
* POWE9 CPUs provide an energy sensor that accumulates the emount of energykettenis2020-07-151-1/+4
| | | | | | | | used by the processor chip. Although we have a SENSOR_WATTHOUR sensor type its units are not really suitable for this sensor. So add a SENSOR_ENERGY type that uses micro Joules as its unit. ok deraadt@
* Document "s" commandkn2020-06-221-1/+3
| | | | OK jmc
* Remove ^Z mentionkn2020-06-221-5/+2
| | | | | | | | | | Suspending systat with ^Z is done by the shell iff job control is enabled, not systat itself. Try "set +m" to disable job control or start systat in a terminal without a shell, e.g. "xterm -e systat", to confirm ^Z doing nothing in these cases. OK jmc
* print the name of the rings in systat mbuf output too.dlg2020-06-151-14/+17
| | | | useful if you're looking at a nic with a lot of different rings.
* pf(4): use CLOCK_BOOTTIME to get time_uptime(9) in userspacecheloha2020-05-151-2/+2
| | | | | | | | | | | | | | | | In pf(4), the pf_status.since timestamp is set with time_uptime(9). This is a low-res snapshot of nanouptime(9). nanouptime(9) is used to implement CLOCK_BOOTTIME for clock_gettime(2). It is not used to implement CLOCK_UPTIME, though. The names are misleading. Switch to CLOCK_BOOTTIME in places in userspace where we use pf_status.since so we are working with the right clock. Technically CLOCK_MONOTONIC is equivalent, but we shouldn't use that here. CLOCK_MONOTONIC is not necessarily the "time since boot": the standard says its absolute value is meaningless. ok patrick@ bluhm@
* Document uvmexp.nswget without relying on implementation details.mpi2020-04-231-4/+3
| | | | | | Prompted by a question from schwarze@ ok deraadt@, schwarze@, visa@
* mark up a function name with .Fn;schwarze2020-04-221-2/+3
| | | | found with mandoc -Tlint
* correct the description of the top line;schwarze2020-04-221-3/+3
| | | | patch from <clematis at insiberia dot net>
* Usually, -width Fl (which is 10n) is too wide and hence ugly.schwarze2020-01-161-4/+4
| | | | Change several instances, most of them to the usual -width Ds.
* Add support for human readable numbers where applicable.martijn2020-01-124-37/+40
| | | | OK stsp@ and bluhm@
* ks_mapblocks is goneguenther2019-11-281-2/+1
|
* Use -1 to indicate an invalid uid/gid, not UID_MAX and GID_MAX.millert2019-10-171-8/+7
| | | | This is the userland portion. OK deraadt@ sashan@
* pledge() won't work but we can use unveil() to reduce filesystem accessderaadt2019-10-141-1/+6
| | | | | in these 3 related programs (they borrow parts of each other using .PATH) Hopefully no regressions, ktrace checks by myself and mestre
* Make systat flushing output after a page display in rawmode (flags -b or -B)solene2019-07-191-1/+2
| | | | | ok millert@ kurt@ code suggested by otto@
* set ierrs and oerrs titles when changing fails/drops/errs, not ierrs twicedlg2019-07-041-2/+2
|
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-2813-47/+47
| | | | | | 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.
* Use the new sysctl to print systat pf 1. This now works even for unprivedclaudio2019-05-091-8/+6
| | | | | users. OK deraadt@, sashan@
* allow switching to print stats since boot via 'b'.tedu2019-05-082-9/+45
| | | | ok beck deraadt
* expose the interface queue drops in the interface viewdlg2019-03-043-10/+119
| | | | | | | | by default qdrops and errors are combined in a number of failures. the qdrops and errors can be viewed separately by using 'd' and 'e' respectively, or the combined view again with 'f'. ok claudio@ deraadt@
* make title a const char *.dlg2019-03-041-2/+2
|
* Change ps_len of struct pfioc_states and psn_len of structbluhm2019-02-181-38/+38
| | | | | | | | | pfioc_src_nodes to size_t. This avoids integer truncation by casts to unsigned. As the types of DIOCGETSTATES and DIOCGETSRCNODES ioctl(2) arguments change, pfctl(8) and systat(1) should be updated together with the kernel. Calculate number of pf(4) states as size_t in userland. OK sashan@ deraadt@
* don't reuse global between functions; the value is wrong.tedu2019-01-201-3/+5
| | | | reported by Bryan Linton
* use $OpenBSD markerstedu2019-01-175-5/+5
| | | | ok millert mpi
* Add a velocity sensor type (displayed as m/s)landry2018-12-101-2/+5
| | | | | | | Change distance sensor type to be displayed as meters with 3 decimals instead of millimeters. ok mpi@ kettenis@
* Add new KERN_CPUSTATS sysctl(2) so we can identify offline CPUs.cheloha2018-11-172-47/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Revert KERN_CPTIME2 ENODEV changes in kernel and userspace.cheloha2018-10-052-57/+10
| | | | ok kettenis deraadt
* KERN_CPTIME2: set ENODEV if the CPU is offline.cheloha2018-09-262-10/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Fix warnings caused by user_from_uid() and group_from_gid() nowmillert2018-09-131-2/+2
| | | | returning const char *.
* Remove unnused af argument from unmask(), sync with pfctlkn2018-09-071-10/+6
| | | | | | Noted by jca, thanks. OK jca claudio
* Document the spinning time of the CPU in systat(1) and top(1).bluhm2018-07-251-5/+5
| | | | from Marcus MERIGHI; OK deraadt@ jmc@
* iostat shows data in bytes, not kilobytes;jmc2018-07-081-3/+3
| | | | | | from marcus merighi ok benno
* Constrain IPKTS/OPKTS from floating down beyond the rest of thekrw2018-06-222-23/+28
| | | | | | displayed lines. Makes vmstat view in tall windows easier to read. ok sthen@
* Shuffle fields around to eliminate blanks spots resulting fromkrw2018-06-211-58/+40
| | | | removing unused uvmexp fields. Reduces number of lines as well.
* Remove unused variable. Make clang happier.krw2018-06-201-3/+1
|
* Rename some unused fields in struct uvmexp tokrw2018-06-192-35/+15
| | | | | | | | | unusedNN. Missing man page bits pointed out by jmc@. Ports source scan by sthen@. ok deraadt@ guenther@
* Avoid some unnecessary calls to strlen(3) in systat uvm.bluhm2018-06-011-5/+7
| | | | OK krw@
* tweak previous;jmc2018-05-301-12/+13
|
* Add uvm view to show all values being collected in uvmexp.krw2018-05-305-7/+495
| | | | Feedbacks, tweaks, ok bluhm@
* Do not ignore nice time in systat(1). The sum would not be 100%,bluhm2018-05-191-4/+6
| | | | | | | a busy machine would look idle. As %Nic does not fit in the columns, add it to %Usr. Introduce @ for spinning time to keep the characters people are used to. Put %Spn between %Int and %Sys like in top. OK visa@ mpi@
* Stopping counting and reporting CPU time spent spinning on a lock asmpi2018-05-142-18/+21
| | | | | | | | | 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@
* test for failing allocation using the standard idiom; prompted by Nan Xiaootto2018-05-031-2/+4
| | | | ok tb@
* Make sorting in the pcache view work. This allows us to sort on allmartijn2018-02-112-23/+216
| | | | | | | shown columns. There's still parts that could do with a good polishing, but it's an improvement. OK tedu@
* Make pool order on size actually order on size instead of size*inuse.martijn2018-02-081-9/+3
| | | | Prompted by and OK otto@
* Add the order keyword to systat global command interpreter.martijn2018-02-085-7/+60
| | | | | | | | This command shows the available orderings for the current view, which ordering is active, their shortcuts, and if they're in reverse order. manpage nits jmc@ OK tedu@