Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/systat Extend "systat vm" output to provide better i...
details: https://anonhg.NetBSD.org/src/rev/2055b1be41c0
branches: trunk
changeset: 995507:2055b1be41c0
user: sevan <sevan%NetBSD.org@localhost>
date: Wed Dec 26 01:47:37 2018 +0000
description:
Extend "systat vm" output to provide better insight about buffercache and
document it.
>From Greg A. Woods in PR bin/36542
diffstat:
usr.bin/systat/bufcache.c | 8 +-
usr.bin/systat/cmdtab.c | 7 +-
usr.bin/systat/main.c | 26 ++++----
usr.bin/systat/systat.1 | 106 +++++++++++++++++++++++++++++++-----
usr.bin/systat/systat.h | 1 -
usr.bin/systat/vmstat.c | 133 +++++++++++++++++++++++++++++++++++----------
6 files changed, 214 insertions(+), 67 deletions(-)
diffs (truncated from 534 to 300 lines):
diff -r c9e707f72853 -r 2055b1be41c0 usr.bin/systat/bufcache.c
--- a/usr.bin/systat/bufcache.c Tue Dec 25 21:26:31 2018 +0000
+++ b/usr.bin/systat/bufcache.c Wed Dec 26 01:47:37 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bufcache.c,v 1.28 2017/06/09 00:13:29 chs Exp $ */
+/* $NetBSD: bufcache.c,v 1.29 2018/12/26 01:47:37 sevan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: bufcache.c,v 1.28 2017/06/09 00:13:29 chs Exp $");
+__RCSID("$NetBSD: bufcache.c,v 1.29 2018/12/26 01:47:37 sevan Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -117,8 +117,8 @@
wmove(wnd, i, 0);
wclrtoeol(wnd);
}
- mvwaddstr(wnd, PAGEINFO_ROWS + 1, 0, "File System Bufs used"
- " % kB in use % Bufsize kB % Util %");
+ mvwaddstr(wnd, PAGEINFO_ROWS + 1, 0,
+"File System Bufs used % kB in use % Bufsize kB % Util %");
wclrtoeol(wnd);
}
diff -r c9e707f72853 -r 2055b1be41c0 usr.bin/systat/cmdtab.c
--- a/usr.bin/systat/cmdtab.c Tue Dec 25 21:26:31 2018 +0000
+++ b/usr.bin/systat/cmdtab.c Wed Dec 26 01:47:37 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cmdtab.c,v 1.25 2016/08/02 15:56:09 scole Exp $ */
+/* $NetBSD: cmdtab.c,v 1.26 2018/12/26 01:47:37 sevan Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: cmdtab.c,v 1.25 2016/08/02 15:56:09 scole Exp $");
+__RCSID("$NetBSD: cmdtab.c,v 1.26 2018/12/26 01:47:37 sevan Exp $");
#endif /* not lint */
#include "systat.h"
@@ -52,6 +52,7 @@
{ "quit", global_quit, "exit systat"},
{ "start", global_interval, "restart updating display"},
{ "stop", global_stop, "stop updating display"},
+ { "?", global_help, "show help"},
{ .c_name = NULL }
};
@@ -114,7 +115,7 @@
{ "names", netstat_names, "show names instead of addresses"},
{ "numbers", netstat_numbers, "show addresses instead of names"},
{ "reset", netstat_reset, "return to default display"},
- { "show", netstat_show, "show current display/ignore settings"},
+ { "show", netstat_show, "show current display/ignore settings"},
{ "tcp", netstat_tcp, "show only tcp connections"},
{ "udp", netstat_udp, "show only udp connections"},
{ .c_name = NULL }
diff -r c9e707f72853 -r 2055b1be41c0 usr.bin/systat/main.c
--- a/usr.bin/systat/main.c Tue Dec 25 21:26:31 2018 +0000
+++ b/usr.bin/systat/main.c Wed Dec 26 01:47:37 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.53 2017/11/22 02:52:42 snj Exp $ */
+/* $NetBSD: main.c,v 1.54 2018/12/26 01:47:37 sevan Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: main.c,v 1.53 2017/11/22 02:52:42 snj Exp $");
+__RCSID("$NetBSD: main.c,v 1.54 2018/12/26 01:47:37 sevan Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -66,7 +66,7 @@
sig_t sigtstpdfl;
double avenrun[3];
int col;
-double naptime = 5;
+double naptime = 1;
int verbose = 1; /* to report kvm read errs */
int hz, stathz, maxslp;
char c;
@@ -173,10 +173,8 @@
(void)setegid(egid);
kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
- if (kd == NULL) {
- error("%s", errbuf);
- exit(1);
- }
+ if (kd == NULL)
+ errx(1, "%s", errbuf);
/* Get rid of privs for now. */
if (nlistf == NULL && memf == NULL)
@@ -194,19 +192,24 @@
* routines to minimize update work by curses.
*/
if (initscr() == NULL)
- {
- warnx("couldn't initialize screen");
- exit(0);
- }
+ errx(1, "couldn't initialize screen");
CMDLINE = LINES - 1;
wnd = (*curmode->c_open)();
if (wnd == NULL) {
+ move(CMDLINE, 0);
+ clrtoeol();
+ refresh();
+ endwin();
warnx("couldn't initialize display");
die(0);
}
wload = newwin(1, 0, 3, 20);
if (wload == NULL) {
+ move(CMDLINE, 0);
+ clrtoeol();
+ refresh();
+ endwin();
warnx("couldn't set up load average window");
die(0);
}
@@ -411,7 +414,6 @@
move(CMDLINE, 0);
clrtoeol();
refresh();
- sleep(5);
endwin();
exit(1);
}
diff -r c9e707f72853 -r 2055b1be41c0 usr.bin/systat/systat.1
--- a/usr.bin/systat/systat.1 Tue Dec 25 21:26:31 2018 +0000
+++ b/usr.bin/systat/systat.1 Wed Dec 26 01:47:37 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: systat.1,v 1.48 2017/07/03 21:34:21 wiz Exp $
+.\" $NetBSD: systat.1,v 1.49 2018/12/26 01:47:37 sevan Exp $
.\"
.\" Copyright (c) 1985, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)systat.1 8.2 (Berkeley) 12/30/93
.\"
-.Dd November 16, 2016
+.Dd December 26, 2018
.Dt SYSTAT 1
.Os
.Sh NAME
@@ -454,7 +454,22 @@
The upper left quadrant of the screen shows the number
of users logged in and the load average over the last one, five,
and fifteen minute intervals.
-Below this is a list of the
+Below this are statistics on memory utilization.
+The first row of the table reports memory usage only among
+active processes, that is processes that have run in the previous
+twenty seconds.
+The second row reports on memory usage of all processes.
+The first column reports on the number of physical pages
+claimed by processes.
+The second column reports the number of physical pages that
+are devoted to read only text pages.
+The third and fourth columns report the same two figures for
+virtual pages, that is the number of pages that would be
+needed if all processes had all of their pages.
+Finally the last column shows the number of physical pages
+on the free list.
+.Pp
+Below the memory display is a list of the
average number of processes (over the last refresh interval)
that are runnable (`r'), in page wait (`p'),
in disk wait other than paging (`d'), sleeping (`s').
@@ -465,9 +480,9 @@
.Pp
To the right of the process statistics is a column that
lists the average number of context switches (`Csw'),
-traps (`Trp'; includes page faults), system calls (`Sys'), interrupts (`Int'),
-network software interrupts (`Sof'),
-page faults (`Flt').
+traps (`Traps'; includes page faults), system calls (`SysCa'), interrupts (`Intr'),
+network software interrupts (`Soft'),
+page faults (`Fault').
.Pp
Below this are statistics on memory utilization.
The first row of the table reports memory usage only among
@@ -509,16 +524,75 @@
number of pages transferred per second over the last refresh interval.
.Pp
Below the paging statistics is another columns of paging data.
-From top to bottom, these represent average numbers of copy on write faults
-(`cow'), object cache lookups (`objlk'), object cache hits (`objht'),
-pages zero filled on demand (`zfodw'), number zfod's created (`nzfod'),
-percentage of zfod's used (`%zfod'), number of kernel pages (`kern'),
-number of wired pages (`wire'), number of active pages (`act'), number
-of inactive pages (`inact'), number of free pages (`free'), pages freed
-by daemon (`daefr'), pages freed by exiting processes (`prcfr'), number
-of pages reactivated from freelist (`react'), scans in page out daemon
-(`scan'), revolutions of the hand (`hdrev'), and in-transit blocking page
-faults (`intrn'), per second over the refresh period.
+From top to bottom, these represent:
+.Pp
+.Bl -tag -width Fl -compact
+.It Ic Sq forks
+number of fork() calls
+.It Ic Sq fkppw
+number of fork() calls where parent waits
+.It Ic Sq fksvm
+number of fork() calls where vmspace is shared
+.It Ic Sq pwait
+number of times fault had to wait on a page
+.It Ic Sq relck
+number of times uvmfault_relock() is called
+.It Ic Sq rlkok
+number of times uvmfault_relock() is a success
+.It Ic Sq noram
+number of times fault was out of RAM
+.It Ic Sq ndcpy
+number of times fault clears ``needs copy''
+.It Ic Sq fltcp
+number of times fault promotes with copy (2b)
+.It Ic Sq zfod
+number of times fault promotes with zerofill (2b)
+.It Ic Sq cow
+number of times faulted for anonymous for Copy-On-Write (case 1b)
+.It Ic Sq fmin
+min number of free pages
+.It Ic Sq ftarg
+target number of free pages
+.It Ic Sq itarg
+target number of inactive pages
+.\".It Ic Sq objlk
+.\"object cache lookups
+.\".It Ic Sq objht
+.\"object cache hits
+.\".It Ic Sq zfodw
+.\"pages zero filled on demand
+.\".It Ic Sq nzfod
+.\"number of zfod's created
+.\".It Ic Sq %zfod
+.\"percentage of zfod's used
+.\".It Ic Sq kern
+.\"number of kernel pages
+.It Ic Sq flnan
+number of times fault was out of anonymous pages
+.\".It Ic Sq act
+.\"number of active pages
+.\".It Ic Sq inact
+.\"number of inactive pages
+.\".It Ic Sq free
+.\"number of free pages
+.\".It Ic Sq daefr
+.\"pages freed by daemon
+.\".It Ic Sq prcfr
+.\"pages freed by exiting processes
+.\".It Ic Sq react
+.\"number of pages reactivated from freelist
+.\".It Ic Sq scan
+.\"scans in page out daemon
+.\".It Ic Sq hdrev
+.\"revolutions of the hand
+.\".It Ic Sq intrn
+.\"in-transit blocking page faults per second over the refresh period.
+.It Ic Sq pdfre
+number of pages daemon freed since boot
+.It Ic Sq pdscn
+number of pages daemon scaned since boot
+.El
+.Pp
Note that the `%zfod' percentage is usually less than 100%,
however it may exceed 100% if a large number of requests
are actually used long after they were set up during a
diff -r c9e707f72853 -r 2055b1be41c0 usr.bin/systat/systat.h
--- a/usr.bin/systat/systat.h Tue Dec 25 21:26:31 2018 +0000
+++ b/usr.bin/systat/systat.h Wed Dec 26 01:47:37 2018 +0000
@@ -61,4 +61,3 @@
#define NVAL(indx) namelist[(indx)].n_value
#define NPTR(indx) (void *)NVAL((indx))
#define NREAD(indx, buf, len) kvm_ckread(NPTR((indx)), (buf), (len), # indx)
-#define LONG (sizeof (long))
diff -r c9e707f72853 -r 2055b1be41c0 usr.bin/systat/vmstat.c
--- a/usr.bin/systat/vmstat.c Tue Dec 25 21:26:31 2018 +0000
+++ b/usr.bin/systat/vmstat.c Wed Dec 26 01:47:37 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.82 2017/07/15 08:22:23 mlelstv Exp $ */
+/* $NetBSD: vmstat.c,v 1.83 2018/12/26 01:47:37 sevan Exp $ */
/*-
* Copyright (c) 1983, 1989, 1992, 1993
@@ -34,7 +34,7 @@
Home |
Main Index |
Thread Index |
Old Index