Add a mode to display ICMP statistics.
Inspired by: IRIX netstat -C
This commit is contained in:
parent
1ed24bcde4
commit
03e00a72c6
@ -3,7 +3,7 @@
|
||||
PROG= systat
|
||||
CFLAGS+=-I${.CURDIR}/../../sys -I${.CURDIR}/../vmstat
|
||||
SRCS= cmds.c cmdtab.c disks.c fetch.c iostat.c keyboard.c vmstat.c main.c \
|
||||
mbufs.c netcmds.c netstat.c pigs.c swap.c
|
||||
mbufs.c netcmds.c netstat.c pigs.c swap.c icmp.c mode.c
|
||||
DPADD= ${LIBCURSES} ${LIBTERMCAP} ${LIBM} ${LIBKVM}
|
||||
LDADD= -lcurses -ltermcap -lm -lkvm
|
||||
BINGRP= kmem
|
||||
|
@ -32,31 +32,39 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "systat.h"
|
||||
#include "extern.h"
|
||||
#include "mode.h"
|
||||
|
||||
struct cmdtab cmdtab[] = {
|
||||
{ "pigs", showpigs, fetchpigs, labelpigs,
|
||||
initpigs, openpigs, closepigs, 0,
|
||||
CF_LOADAV },
|
||||
0, CF_LOADAV },
|
||||
{ "swap", showswap, fetchswap, labelswap,
|
||||
initswap, openswap, closeswap, 0,
|
||||
CF_LOADAV },
|
||||
0, CF_LOADAV },
|
||||
{ "mbufs", showmbufs, fetchmbufs, labelmbufs,
|
||||
initmbufs, openmbufs, closembufs, 0,
|
||||
CF_LOADAV },
|
||||
0, CF_LOADAV },
|
||||
{ "iostat", showiostat, fetchiostat, labeliostat,
|
||||
initiostat, openiostat, closeiostat, cmdiostat,
|
||||
CF_LOADAV },
|
||||
0, CF_LOADAV },
|
||||
{ "vmstat", showkre, fetchkre, labelkre,
|
||||
initkre, openkre, closekre, cmdkre,
|
||||
0 },
|
||||
0, 0 },
|
||||
{ "netstat", shownetstat, fetchnetstat, labelnetstat,
|
||||
initnetstat, opennetstat, closenetstat, cmdnetstat,
|
||||
CF_LOADAV },
|
||||
0, CF_LOADAV },
|
||||
{ "icmp", showicmp, fetchicmp, labelicmp,
|
||||
initicmp, openicmp, closeicmp, cmdmode,
|
||||
reseticmp, CF_LOADAV },
|
||||
{ 0 }
|
||||
};
|
||||
struct cmdtab *curcmd = &cmdtab[0];
|
||||
|
@ -63,6 +63,7 @@ struct inpcb;
|
||||
int checkhost __P((struct inpcb *));
|
||||
int checkport __P((struct inpcb *));
|
||||
void closeiostat __P((WINDOW *));
|
||||
void closeicmp __P((WINDOW *));
|
||||
void closekre __P((WINDOW *));
|
||||
void closembufs __P((WINDOW *));
|
||||
void closenetstat __P((WINDOW *));
|
||||
@ -78,12 +79,14 @@ void display __P((int));
|
||||
int dkinit __P((void));
|
||||
int dkcmd __P((char *, char *));
|
||||
void error __P((const char *fmt, ...));
|
||||
void fetchicmp __P((void));
|
||||
void fetchiostat __P((void));
|
||||
void fetchkre __P((void));
|
||||
void fetchmbufs __P((void));
|
||||
void fetchnetstat __P((void));
|
||||
void fetchpigs __P((void));
|
||||
void fetchswap __P((void));
|
||||
int initicmp __P((void));
|
||||
int initiostat __P((void));
|
||||
int initkre __P((void));
|
||||
int initmbufs __P((void));
|
||||
@ -92,6 +95,7 @@ int initpigs __P((void));
|
||||
int initswap __P((void));
|
||||
int keyboard __P((void));
|
||||
int kvm_ckread __P((void *, void *, int));
|
||||
void labelicmp __P((void));
|
||||
void labeliostat __P((void));
|
||||
void labelkre __P((void));
|
||||
void labelmbufs __P((void));
|
||||
@ -102,6 +106,7 @@ void labelswap __P((void));
|
||||
void load __P((void));
|
||||
int netcmd __P((char *, char *));
|
||||
void nlisterr __P((struct nlist []));
|
||||
WINDOW *openicmp __P((void));
|
||||
WINDOW *openiostat __P((void));
|
||||
WINDOW *openkre __P((void));
|
||||
WINDOW *openmbufs __P((void));
|
||||
@ -109,6 +114,8 @@ WINDOW *opennetstat __P((void));
|
||||
WINDOW *openpigs __P((void));
|
||||
WINDOW *openswap __P((void));
|
||||
int prefix __P((char *, char *));
|
||||
void reseticmp __P((void));
|
||||
void showicmp __P((void));
|
||||
void showiostat __P((void));
|
||||
void showkre __P((void));
|
||||
void showmbufs __P((void));
|
||||
|
283
usr.bin/systat/icmp.c
Normal file
283
usr.bin/systat/icmp.c
Normal file
@ -0,0 +1,283 @@
|
||||
/*-
|
||||
* Copyright (c) 1980, 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
/* From:
|
||||
static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char rcsid[] =
|
||||
"Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/icmp_var.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <paths.h>
|
||||
#include "systat.h"
|
||||
#include "extern.h"
|
||||
#include "mode.h"
|
||||
|
||||
static struct icmpstat icmpstat, initstat, oldstat;
|
||||
|
||||
/*-
|
||||
--0 1 2 3 4 5 6 7
|
||||
--0123456789012345678901234567890123456789012345678901234567890123456789012345
|
||||
01 ICMP Input ICMP Output
|
||||
02999999999 total messages 999999999 total messages
|
||||
03999999999 with bad code 999999999 errors generated
|
||||
04999999999 with bad length 999999999 suppressed - original too short
|
||||
05999999999 with bad checksum 999999999 suppressed - original was ICMP
|
||||
06999999999 with insufficient data 999999999 responses sent
|
||||
07 999999999 suppressed - multicast echo
|
||||
08 999999999 suppressed - multicast tstamp
|
||||
09
|
||||
10 Input Histogram Output Histogram
|
||||
11999999999 echo response 999999999 echo response
|
||||
12999999999 echo request 999999999 echo request
|
||||
13999999999 destination unreachable 999999999 destination unreachable
|
||||
14999999999 redirect 999999999 redirect
|
||||
15999999999 time-to-live exceeded 999999999 time-to-line exceeded
|
||||
16999999999 parameter problem 999999999 parameter problem
|
||||
17999999999 router advertisement 999999999 router solicitation
|
||||
18
|
||||
19
|
||||
--0123456789012345678901234567890123456789012345678901234567890123456789012345
|
||||
--0 1 2 3 4 5 6 7
|
||||
*/
|
||||
|
||||
WINDOW *
|
||||
openicmp(void)
|
||||
{
|
||||
return (subwin(stdscr, LINES-5-1, 0, 5, 0));
|
||||
}
|
||||
|
||||
void
|
||||
closeicmp(w)
|
||||
WINDOW *w;
|
||||
{
|
||||
if (w == NULL)
|
||||
return;
|
||||
wclear(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
}
|
||||
|
||||
void
|
||||
labelicmp(void)
|
||||
{
|
||||
wmove(wnd, 0, 0); wclrtoeol(wnd);
|
||||
#define L(row, str) mvwprintw(wnd, row, 10, str)
|
||||
#define R(row, str) mvwprintw(wnd, row, 45, str);
|
||||
L(1, "ICMP Input"); R(1, "ICMP Output");
|
||||
L(2, "total messages"); R(2, "total messages");
|
||||
L(3, "with bad code"); R(3, "errors generated");
|
||||
L(4, "with bad length"); R(4, "suppressed - original too short");
|
||||
L(5, "with bad checksum"); R(5, "suppressed - original was ICMP");
|
||||
L(6, "with insufficient data"); R(6, "responses sent");
|
||||
; R(7, "suppressed - multicast echo");
|
||||
; R(8, "suppressed - multicast tstamp");
|
||||
L(10, "Input Histogram"); R(10, "Output Histogram");
|
||||
#define B(row, str) L(row, str); R(row, str)
|
||||
B(11, "echo response");
|
||||
B(12, "echo request");
|
||||
B(13, "destination unreachable");
|
||||
B(14, "redirect");
|
||||
B(15, "time-to-live exceeded");
|
||||
B(16, "parameter problem");
|
||||
L(17, "router advertisement"); R(17, "router solicitation");
|
||||
#undef L
|
||||
#undef R
|
||||
#undef B
|
||||
}
|
||||
|
||||
static void
|
||||
domode(struct icmpstat *ret)
|
||||
{
|
||||
const struct icmpstat *sub;
|
||||
int i, divisor = 1;
|
||||
|
||||
switch(currentmode) {
|
||||
case display_RATE:
|
||||
sub = &oldstat;
|
||||
divisor = naptime;
|
||||
break;
|
||||
case display_DELTA:
|
||||
sub = &oldstat;
|
||||
break;
|
||||
case display_SINCE:
|
||||
sub = &initstat;
|
||||
break;
|
||||
default:
|
||||
*ret = icmpstat;
|
||||
return;
|
||||
}
|
||||
#define DO(stat) ret->stat = (icmpstat.stat - sub->stat) / divisor
|
||||
DO(icps_error);
|
||||
DO(icps_oldshort);
|
||||
DO(icps_oldicmp);
|
||||
for (i = 0; i <= ICMP_MAXTYPE; i++) {
|
||||
DO(icps_outhist[i]);
|
||||
}
|
||||
DO(icps_badcode);
|
||||
DO(icps_tooshort);
|
||||
DO(icps_checksum);
|
||||
DO(icps_badlen);
|
||||
DO(icps_reflect);
|
||||
for (i = 0; i <= ICMP_MAXTYPE; i++) {
|
||||
DO(icps_inhist[i]);
|
||||
}
|
||||
DO(icps_bmcastecho);
|
||||
DO(icps_bmcasttstamp);
|
||||
#undef DO
|
||||
}
|
||||
|
||||
void
|
||||
showicmp(void)
|
||||
{
|
||||
struct icmpstat stats;
|
||||
u_long totalin, totalout;
|
||||
int i;
|
||||
|
||||
memset(&stats, 0, sizeof stats);
|
||||
domode(&stats);
|
||||
for (i = totalin = totalout = 0; i <= ICMP_MAXTYPE; i++) {
|
||||
totalin += stats.icps_inhist[i];
|
||||
totalout += stats.icps_outhist[i];
|
||||
}
|
||||
totalin += stats.icps_badcode + stats.icps_badlen +
|
||||
stats.icps_checksum + stats.icps_tooshort;
|
||||
mvwprintw(wnd, 2, 0, "%9lu", totalin);
|
||||
mvwprintw(wnd, 2, 35, "%9lu", totalout);
|
||||
|
||||
#define DO(stat, row, col) \
|
||||
mvwprintw(wnd, row, col, "%9lu", stats.stat)
|
||||
|
||||
DO(icps_badcode, 3, 0);
|
||||
DO(icps_badlen, 4, 0);
|
||||
DO(icps_checksum, 5, 0);
|
||||
DO(icps_tooshort, 6, 0);
|
||||
DO(icps_error, 3, 35);
|
||||
DO(icps_oldshort, 4, 35);
|
||||
DO(icps_oldicmp, 5, 35);
|
||||
DO(icps_reflect, 6, 35);
|
||||
DO(icps_bmcastecho, 7, 35);
|
||||
DO(icps_bmcasttstamp, 8, 35);
|
||||
#define DO2(type, row) DO(icps_inhist[type], row, 0); DO(icps_outhist[type], \
|
||||
row, 35)
|
||||
DO2(ICMP_ECHOREPLY, 11);
|
||||
DO2(ICMP_ECHO, 12);
|
||||
DO2(ICMP_UNREACH, 13);
|
||||
DO2(ICMP_REDIRECT, 14);
|
||||
DO2(ICMP_TIMXCEED, 15);
|
||||
DO2(ICMP_PARAMPROB, 16);
|
||||
DO(icps_inhist[ICMP_ROUTERADVERT], 17, 0);
|
||||
DO(icps_outhist[ICMP_ROUTERSOLICIT], 17, 35);
|
||||
#undef DO
|
||||
#undef DO2
|
||||
}
|
||||
|
||||
int
|
||||
initicmp(void)
|
||||
{
|
||||
size_t len;
|
||||
int name[4];
|
||||
|
||||
name[0] = CTL_NET;
|
||||
name[1] = PF_INET;
|
||||
name[2] = IPPROTO_ICMP;
|
||||
name[3] = ICMPCTL_STATS;
|
||||
|
||||
len = 0;
|
||||
if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
|
||||
error("sysctl getting icmpstat size failed");
|
||||
return 0;
|
||||
}
|
||||
if (len > sizeof icmpstat) {
|
||||
error("icmpstat structure has grown--recompile systat!");
|
||||
return 0;
|
||||
}
|
||||
if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
|
||||
error("sysctl getting icmpstat size failed");
|
||||
return 0;
|
||||
}
|
||||
oldstat = initstat;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
reseticmp(void)
|
||||
{
|
||||
size_t len;
|
||||
int name[4];
|
||||
|
||||
name[0] = CTL_NET;
|
||||
name[1] = PF_INET;
|
||||
name[2] = IPPROTO_ICMP;
|
||||
name[3] = ICMPCTL_STATS;
|
||||
|
||||
len = sizeof initstat;
|
||||
if (sysctl(name, 4, &initstat, &len, 0, 0) < 0) {
|
||||
error("sysctl getting icmpstat size failed");
|
||||
}
|
||||
oldstat = initstat;
|
||||
}
|
||||
|
||||
void
|
||||
fetchicmp(void)
|
||||
{
|
||||
int name[4];
|
||||
size_t len;
|
||||
|
||||
oldstat = icmpstat;
|
||||
name[0] = CTL_NET;
|
||||
name[1] = PF_INET;
|
||||
name[2] = IPPROTO_ICMP;
|
||||
name[3] = ICMPCTL_STATS;
|
||||
len = sizeof icmpstat;
|
||||
|
||||
if (sysctl(name, 4, &icmpstat, &len, 0, 0) < 0)
|
||||
return;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
"$Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -42,6 +42,7 @@ static const char rcsid[] =
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <paths.h>
|
||||
@ -182,5 +183,5 @@ fetchmbufs()
|
||||
len = sizeof *mb;
|
||||
|
||||
if (sysctl(name, 3, mb, &len, 0, 0) < 0)
|
||||
return;
|
||||
printw("sysctl: %s", strerror(errno));
|
||||
}
|
||||
|
97
usr.bin/systat/mode.c
Normal file
97
usr.bin/systat/mode.c
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 1997 Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby
|
||||
* granted, provided that both the above copyright notice and this
|
||||
* permission notice appear in all copies, that both the above
|
||||
* copyright notice and this permission notice appear in all
|
||||
* supporting documentation, and that the name of M.I.T. not be used
|
||||
* in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission. M.I.T. makes
|
||||
* no representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
|
||||
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
||||
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* mode.c - mechanisms for dealing with SGI-style modal displays.
|
||||
*
|
||||
* There are four generally-understood useful modes for status displays
|
||||
* of the sort exemplified by the IRIX ``netstat -C'' and ``osview''
|
||||
* programs. We try to follow their example, although the user interface
|
||||
* and terminology slightly differ.
|
||||
*
|
||||
* RATE - the default mode - displays the precise rate of change in
|
||||
* each statistic in units per second, regardless of the actual display
|
||||
* update interval.
|
||||
*
|
||||
* DELTA - displays the change in each statistic over the entire
|
||||
* display update interval (i.e., RATE * interval).
|
||||
*
|
||||
* SINCE - displays the total change in each statistic since the module
|
||||
* was last initialized or reset.
|
||||
*
|
||||
* ABSOLUTE - displays the current value of each statistic.
|
||||
*
|
||||
* In the SGI programs, these modes are selected by the single-character
|
||||
* commands D, W, N, and A. In systat, they are the slightly-harder-to-type
|
||||
* ``mode delta'', etc. The initial value for SINCE mode is initialized
|
||||
* when the module is first started and can be reset using the ``reset''
|
||||
* command (as opposed to the SGI way where changing modes implicitly
|
||||
* resets). A ``mode'' command with no arguments displays the current
|
||||
* mode in the command line.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "systat.h"
|
||||
#include "extern.h"
|
||||
#include "mode.h"
|
||||
|
||||
enum mode currentmode = display_RATE;
|
||||
|
||||
static const char *const modes[] = { "rate", "delta", "since", "absolute" };
|
||||
|
||||
int
|
||||
cmdmode(char *cmd, char *args)
|
||||
{
|
||||
if (prefix(cmd, "mode")) {
|
||||
if (args[0] == '\0') {
|
||||
move(CMDLINE, 0);
|
||||
clrtoeol();
|
||||
printw("%s", modes[currentmode]);
|
||||
} else if (prefix(args, "rate")) {
|
||||
currentmode = display_RATE;
|
||||
} else if (prefix(args, "delta")) {
|
||||
currentmode = display_DELTA;
|
||||
} else if (prefix(args, "since")) {
|
||||
currentmode = display_SINCE;
|
||||
} else if (prefix(args, "absolute")) {
|
||||
currentmode = display_ABS;
|
||||
} else {
|
||||
printw("unknown mode `%s'", args);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if(prefix(cmd, "reset")) {
|
||||
curcmd->c_reset();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
44
usr.bin/systat/mode.h
Normal file
44
usr.bin/systat/mode.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 1997 Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby
|
||||
* granted, provided that both the above copyright notice and this
|
||||
* permission notice appear in all copies, that both the above
|
||||
* copyright notice and this permission notice appear in all
|
||||
* supporting documentation, and that the name of M.I.T. not be used
|
||||
* in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission. M.I.T. makes
|
||||
* no representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
|
||||
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
||||
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* mode.h - mechanisms for dealing with SGI-style modal displays.
|
||||
*/
|
||||
|
||||
#ifndef MODE_H
|
||||
#define MODE_H 1
|
||||
|
||||
enum mode { display_RATE, display_DELTA, display_SINCE, display_ABS };
|
||||
|
||||
extern int cmdmode(char *cmd, char *args);
|
||||
extern enum mode currentmode;
|
||||
|
||||
#endif /* MODE_H */
|
@ -31,7 +31,7 @@
|
||||
.\"
|
||||
.\" @(#)systat.1 8.2 (Berkeley) 12/30/93
|
||||
.\"
|
||||
.Dd December 30, 1993
|
||||
.Dd September 9, 1997
|
||||
.Dt SYSTAT 1
|
||||
.Os BSD 4.3
|
||||
.Sh NAME
|
||||
@ -65,7 +65,10 @@ statistics (a la
|
||||
.Xr iostat 8 ) ,
|
||||
virtual memory statistics (a la
|
||||
.Xr vmstat 8 ) ,
|
||||
network ``mbuf'' utilization, and network connections (a la
|
||||
network ``mbuf'' utilization,
|
||||
.Tn ICMP
|
||||
statistics,
|
||||
and network connections (a la
|
||||
.Xr netstat 1 ) .
|
||||
.Pp
|
||||
Input is interpreted at two different levels.
|
||||
@ -83,6 +86,7 @@ flag expects
|
||||
.Ar display
|
||||
to be one of:
|
||||
.Ic pigs ,
|
||||
.Ic icmp ,
|
||||
.Ic iostat ,
|
||||
.Ic swap ,
|
||||
.Ic mbufs ,
|
||||
@ -153,6 +157,43 @@ largest portion of the processor (the default display).
|
||||
When less than 100% of the
|
||||
processor is scheduled to user processes, the remaining time
|
||||
is accounted to the ``idle'' process.
|
||||
.It Ic icmp
|
||||
Display, in the lower window, statistics about messages received and
|
||||
transmitted by the Internet Control Message Protocol
|
||||
.Pq Dq Tn ICMP .
|
||||
The left half of the screen displays information about received
|
||||
packets, and the right half displays information regarding transmitted
|
||||
packets.
|
||||
.Pp
|
||||
The
|
||||
.Ic icmp
|
||||
display understands two commands:
|
||||
.Ic mode
|
||||
and
|
||||
.Ic reset .
|
||||
The
|
||||
.Ic mode
|
||||
command is used to select one of four display modes, given as its argument:
|
||||
.Bl -tag -width absoluteXX -compact
|
||||
.It Ic rate :
|
||||
show the rate of change of each value in packets (the default)
|
||||
per second
|
||||
.It Ic delta :
|
||||
show the rate of change of each value in packets per refresh interval
|
||||
.It Ic since :
|
||||
show the total change of each value since the display was last reset
|
||||
.It Ic absolute :
|
||||
show the absolute value of each statistic
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Ic reset
|
||||
command resets the baseline for
|
||||
.Ic since
|
||||
mode. The
|
||||
.Ic mode
|
||||
command with no argument will display the current mode in the command
|
||||
line.
|
||||
.It Ic iostat
|
||||
Display, in the lower window, statistics about processor use
|
||||
and disk throughput. Statistics on processor use appear as
|
||||
@ -398,6 +439,11 @@ drives may be specified, separated by spaces.
|
||||
Display information about the drives indicated. Multiple drives
|
||||
may be specified, separated by spaces.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr iostat 1 ,
|
||||
.Xr netstat 1 ,
|
||||
.Xr vmstat 1 ,
|
||||
.Xr icmp 4
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/networks -compact
|
||||
.It Pa /kernel
|
||||
@ -418,6 +464,19 @@ The
|
||||
.Nm
|
||||
program appeared in
|
||||
.Bx 4.3 .
|
||||
The
|
||||
.Ic icmp
|
||||
display appeared in
|
||||
.Fx 3.0 ;
|
||||
the notion of having different display modes for the
|
||||
.Tn ICMP
|
||||
statistics was stolen from the
|
||||
.Fl C
|
||||
option to
|
||||
.Xr netstat 1
|
||||
in Silicon Graphics'
|
||||
.Tn IRIX
|
||||
system.
|
||||
.Sh BUGS
|
||||
Takes 2-10 percent of the cpu.
|
||||
Certain displays presume a minimum of 80 characters per line.
|
||||
|
@ -30,20 +30,22 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)systat.h 8.1 (Berkeley) 6/6/93
|
||||
* From: @(#)systat.h 8.1 (Berkeley) 6/6/93
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <curses.h>
|
||||
|
||||
struct cmdtab {
|
||||
char *c_name; /* command name */
|
||||
void (*c_refresh)(); /* display refresh */
|
||||
void (*c_fetch)(); /* sets up data structures */
|
||||
void (*c_label)(); /* label display */
|
||||
int (*c_init)(); /* initialize namelist, etc. */
|
||||
WINDOW *(*c_open)(); /* open display */
|
||||
void (*c_close)(); /* close display */
|
||||
int (*c_cmd)(); /* display command interpreter */
|
||||
void (*c_refresh)(void); /* display refresh */
|
||||
void (*c_fetch)(void); /* sets up data structures */
|
||||
void (*c_label)(void); /* label display */
|
||||
int (*c_init)(void); /* initialize namelist, etc. */
|
||||
WINDOW *(*c_open)(void); /* open display */
|
||||
void (*c_close)(WINDOW *); /* close display */
|
||||
int (*c_cmd)(char *, char *); /* display command interpreter */
|
||||
void (*c_reset)(void); /* reset ``mode since'' display */
|
||||
char c_flags; /* see below */
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user