Commit Graph

43 Commits

Author SHA1 Message Date
Warner Losh
22054f8891 Report I/O stats from the CAM_IOSCHED_DYNAMIC extension
Report, on a periodic basis, the I/O latencies the CAM I/O scheduler
computes. These times are only for the hardware portion of the I/O as
measured from the time the operation is scheduled with the SIM using
xpt_action() until the SIM reports it has completed with xpt_dine(). Any
time the I/O operation spends in a software queue is no included.

The P50 (median), P90, P99 and P99.9 statistics about the latency of
each of the read, write and trim operations that completed during the
polling interval are reported. If there are fewer than 2, 10, 100 or
1000 operations during the polling interval, no statistic is reported
and a single dash '-' is displayed.

The read, write and trim commands (either on the command line or at run
time) toggle display of these operations. The color command toggles
color (it defaults to on, like gstat). When color is enabled, unknown
statistics are reported in blue, high latency for a statistics is
reported in red, medium in magenta and low in green (as with gstat). The
med= and hi= commands can set these latency thresholds.

Limitations: The entire sysctl space for all the devices is walked for
each polling period. This should be optimized to remember the OIDs and
only do such polling with the xpt generation changes. There is also no
way to filter devices displayed. This command only works on physical
devies that are connected to SCSI, ATA or NVME sims as those are the
only ones that are instrumented in the CAM I/O scheduler (the
CAM_IOSCHED_DYNAMIC option must be in the kernel, and the dynamic
scheduler can't be disabled).

MFC After:		1 month
Relnotes:		yes
Sponsored by:		Netflix
Reviewed by:		pauamma_gundo.com, chs
Differential Revision:	https://reviews.freebsd.org/D34259
2022-02-28 10:44:47 -07:00
Mateusz Guzik
6d88f9fed6 systat: mostly clean up warns
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-11-01 23:11:16 +00:00
Michael Reifenberger
6648383803 systat: Handle SIGWINCH to properly window resizing and adjust
-swap disk stat based on new size.

Display corrupts after resizing a window.
Process SIGWINCH to redraw all window.

Submitted by:   Yoshihiro Ota ota@j.email.ne.jp
Differential Revision:  https://reviews.freebsd.org/D29337
2021-04-21 20:31:58 +02:00
Michael Reifenberger
4bde63536c Patch systat -zarc to display cumulative rate and round down large numbers by SI units
PR:		237664
Submitted by:	ota@j.email.ne.jp
MFC after:	2 weeks
2020-05-11 20:34:52 +00:00
Cy Schubert
61bbe5bf9f Chasing r337661, fix systat after arc accounting change. 2018-08-12 07:47:44 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Marcelo Araujo
4c59a8860a Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-08-16 15:52:10 +00:00
Marcelo Araujo
1e8b591f62 Use macro MIN() from sys/param.h.
MFC after:	2 weeks.
2016-04-27 02:26:31 +00:00
Xin LI
05212689bb Use _PATH_DEVNULL instead of direct hardcoding.
MFC after:	2 weeks
2015-09-28 18:19:22 +00:00
Michael Reifenberger
27aa47691e Add support to systat to display zfs arc cache status/info
PR:		195460
Submitted by:	ota
2015-09-27 09:15:54 +00:00
Baptiste Daroussin
a2ca3324e2 Remove unused variable 2015-06-06 13:08:31 +00:00
Brooks Davis
525e2a83f6 Revert r261296. This removes the WITHOUT_NCURSESW option.
It was the wrong direction.  We will instead remove use of the
non-wide-character supporting libncurses.
2014-05-15 16:44:25 +00:00
Alexander V. Chernikov
6052df8ef8 Allow systat(1) interactive dispay-specific commands to
be specified via command line.

Submitted by:	vsevolod
MFC after:	2 weeks
2014-05-09 16:20:55 +00:00
Brooks Davis
38e233371c Merge from CheriBSD:
commit c1acf022c5
Author: Brooks Davis <brooks@one-eyed-alien.net>
Date:   Fri Jan 17 21:46:44 2014 +0000

    Add an option WITHOUT_NCURSESW to suppress building and linking to
    libncursesw.  While wide character support it useful we'd like to
    only need one ncurses library on embedded systems.

MFC after:	4 weeks
Sponsored by:	DARPA, AFRL
2014-01-30 21:08:36 +00:00
Philippe Charnier
00c31a91ef Remove old-style function definition 2013-02-19 12:57:07 +00:00
Alexander V. Chernikov
8b3daf895a Make systat(1) accept fractional number of seconds.
Make old alarm(3)-based code use select(2).

MFC after:	2 weeks
2012-09-17 13:36:47 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Hajimu UMEMOTO
347c7f559c Use ncursesw to output the date field of vmstat display
with multi-byte string, correctly.
2009-11-13 03:59:44 +00:00
Jaakko Heinonen
c2dbb0de27 - Catch SIGHUP to perform cleanup before exiting.
- Exit if getch() returns with an error other than EINTR. Otherwise
  systat(1) may get stuck in an infinite loop if it doesn't receive
  SIGHUP when terminal closes. [1]
- Remove attempt to clear stdio error indicators. getch() doesn't use
  stdio, making it useless. [2]
- Remove unneeded masking of getch() return value. [2]

PR:		bin/107171
Reviewed by:	bde
Approved by:	trasz (mentor)
Obtained from:	OpenBSD [1]
Suggested by:	bde [2]
MFC after:	1 month
2009-10-11 12:32:25 +00:00
Xin LI
93b9f50404 ANSIfy and remove register.
Resulting binary verified with strip(1)+md5(1).
2008-01-16 19:27:43 +00:00
Bruce Evans
a9a3dcd64f Remove trailing whitespace.
Submitted by:	Se=E1n Farley <sean-freebsd at farley dot org>
PR:		bin/81874
2006-04-30 04:47:23 +00:00
Bruce Evans
8aa22952a9 Show the load average in the tcp display (it was already shown, perhaps
not very usefully, in all other displays).  This was the original point
of the PR.

Move the load average up by 2 so that it starts in row 0 for all windows
(2 lines above it were wasted for all other windows except vmstat).
Move everything below it up by 2 or 3 (3 for icmp and icmp6 which had
an extra blank line due from not compensating for the foot-shooting in
note (3); only ip and ip6 compensated).  Reduce the magic numbers related
to this.

Notes by the submitter:
%%%
1. All the subwin() calls are identical using #define MAINWIN_ROW 3
    (systat.h).
2. The load average is at the top of the window.
3. Each display starts on the fourth line.  I made changes to those
    displays that shifted the start line (i.e., icmp).  This entailed a
    lot of changes within the comments at the top of those displays.
4. For ip6, I shifted the "Input next-header histogram" column down one
    row to separate it from "IPv6 Output".  I raised "bad scope packets"
    and "address selection failed" up one row to stay with "IPv6 Input"
    (valid?).  They were down one row to probably line up at the bottom,
    but I think they should stick with their fellow items in a column.
5. I condensed ifstat a bit.  It had a lot of empty rows.
%%%

Submitted by:	Se=E1n Farley <sean-freebsd at farley dot org>
PR:		bin/81874
2006-04-30 04:26:46 +00:00
David Malone
33dc549136 Fix the easy warnings:
1) Avoid shadowing index.
2) Constness.
3) Missing prototype for ifcmd.
4) Missing include of string.h.
5) Avoid shadowing error function.
6) ANSI definition for main.
2004-03-09 11:57:28 +00:00
Warner Losh
bbf5c743d2 unifdef __STDC__ 2002-03-23 23:37:07 +00:00
Mark Murray
9ff712b0f5 WARNS=2 fixes with NO_WERROR set, as there are some header issues
with namelists. use __FBSDID().
2001-12-12 00:13:37 +00:00
Thomas Moestl
5a3c3d039a Fix the error buffer passed to kvm_openfiles to have a length of
_POSIX2_LINE_MAX as required.
While being there, wrap an overly long line.

MFC after:	3 days
2001-05-25 23:10:27 +00:00
Thomas Moestl
342e2faa09 Get rid of setgid kmem for systat, and while being there, fix some bugs
and compiler warnings.
The data for network statistics are still obtained via the kvm interface
if systat was started with the needed privileges, otherwise sysctls are
used. The reason for this is that with really many open sockets, the
sysctl method is probably slower, but it systat -netstat is probably not
really usable in either mode under these conditions.

Approved by:	rwatson
2001-03-23 03:58:25 +00:00
Robert Watson
48c193e183 o Fix up includes which built due to excessive nested including in the
base system, but not in BruceBSD.
o Fix up style violations of various sorts.
o Remove redundant normalization of hertz variable, as the sysctl handler
  does this work (unlike when kread was used).

Submitted by:	bde
2000-12-17 18:43:28 +00:00
Robert Watson
7ace4e618a o Make systat use sysctl() to retrieve hz and stathz, instead of
using kmem.
2000-11-25 03:46:45 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
David E. O'Brien
d22889b821 Quiet many compiler warnings. 1998-10-08 09:56:10 +00:00
Bruce Evans
81a4459b5f Fixed type mismatches which were fatal when sizeof(long) > sizeof(int). 1998-07-06 22:08:00 +00:00
Warner Losh
448b84a0e4 o Use snprintf rather than sprintf
o Add more checks for buffer overflows
o Use snprintf rather than strcat/cpy and have better checks for max
  length exceeded.

Most of these changes are not exploitable buffer overruns, but it never
hurts to be safe.

Inspired by and obtained from: OpenBSD
1998-06-09 04:17:29 +00:00
Philippe Charnier
014927909d Main() returns int. 1997-08-26 11:08:24 +00:00
Philippe Charnier
d8793dfac3 Use err(3). /sys/dkstat.h -> /usr/include/sys/dkstat.h 1997-08-13 06:45:11 +00:00
Andrey A. Chernov
daab85586e Localize time 1996-03-31 16:39:26 +00:00
Poul-Henning Kamp
c3f4fea40c Don't use curses until initialized. 1995-03-12 01:47:08 +00:00
Bruce Evans
3544ae54e2 extern.h, iostat.c, main.c, vmstat.c:
Use the correct value of hz (stathz if it is nonzero) for
	interpretion of dk_time[] and cp_time[] in iostat.c.  Avoid
	multiple conversions of this value in iostat.c and vmstat.c

iostat.c:
	Implement the display of cp_time[CP_INTR].  Fix the display
	of cp_time[CP_IDLE] (the display was always null because
	cp_time[CP_INTR] == 0 was displayed instead).

systat.1:
	Document the display of cp_time[CP_INTR].

vmstat.c:
	Implement the display of cp_time[CP_INTR].
1994-12-03 10:06:40 +00:00
Andrey A. Chernov
dc5c110e4a Prevents segm. fault on unknown option 1994-10-19 05:10:06 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00