Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/systat - Add `boot', `run', `time' and `zero' comman...



details:   https://anonhg.NetBSD.org/src/rev/7777c9bf4849
branches:  trunk
changeset: 494296:7777c9bf4849
user:      ad <ad%NetBSD.org@localhost>
date:      Wed Jul 05 11:03:20 2000 +0000

description:
- Add `boot', `run', `time' and `zero' commands to all IP displays. These work
  as in the `vmstat' display mode. The default mode is now `time', not `boot'.
- ANSIfy.
- s@kre\(@vmstat\(@.
- __RCSID() police.
- Tweak inet.icmp display visual a little.

diffstat:

 usr.bin/systat/bufcache.c   |   36 ++---
 usr.bin/systat/cmds.c       |   14 +-
 usr.bin/systat/cmdtab.c     |   64 +++++++++-
 usr.bin/systat/disks.c      |   21 +--
 usr.bin/systat/extern.h     |  260 ++++++++++++++++++++++++-------------------
 usr.bin/systat/fetch.c      |   11 +-
 usr.bin/systat/globalcmds.c |   29 ++--
 usr.bin/systat/icmp.c       |   94 +++++++++++++--
 usr.bin/systat/iostat.c     |   54 +++-----
 usr.bin/systat/ip.c         |   96 +++++++++++++++-
 usr.bin/systat/ip6.c        |  162 +++++++++++++++++++-------
 usr.bin/systat/ipsec.c      |   96 ++++++++++++++-
 usr.bin/systat/keyboard.c   |    6 +-
 usr.bin/systat/main.c       |   47 ++-----
 usr.bin/systat/mbufs.c      |   17 +-
 usr.bin/systat/netcmds.c    |   75 ++++-------
 usr.bin/systat/netstat.c    |   78 ++++--------
 usr.bin/systat/pigs.c       |   22 +--
 usr.bin/systat/ps.c         |   56 +++-----
 usr.bin/systat/swap.c       |   20 +-
 usr.bin/systat/systat.h     |   20 +-
 usr.bin/systat/tcp.c        |   98 +++++++++++++++-
 usr.bin/systat/vmstat.c     |   67 ++++------
 23 files changed, 885 insertions(+), 558 deletions(-)

diffs (truncated from 2956 to 300 lines):

diff -r 25ceb247b611 -r 7777c9bf4849 usr.bin/systat/bufcache.c
--- a/usr.bin/systat/bufcache.c Wed Jul 05 10:54:12 2000 +0000
+++ b/usr.bin/systat/bufcache.c Wed Jul 05 11:03:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bufcache.c,v 1.7 2000/04/27 00:30:51 jdc Exp $ */
+/*     $NetBSD: bufcache.c,v 1.8 2000/07/05 11:03:20 ad Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: bufcache.c,v 1.7 2000/04/27 00:30:51 jdc Exp $");
+__RCSID("$NetBSD: bufcache.c,v 1.8 2000/07/05 11:03:20 ad Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -106,22 +106,21 @@
 static struct buf *buf = NULL;
 static TAILQ_HEAD(bqueues, buf) bufqueues[BQUEUES];
 
-static void    vc_init __P((void));
-static void    ml_init __P((void));
-static struct  vnode *vc_lookup __P((struct vnode *));
-static struct  mount *ml_lookup __P((struct mount *, int, int));
+static void    vc_init(void);
+static void    ml_init(void);
+static struct  vnode *vc_lookup(struct vnode *);
+static struct  mount *ml_lookup(struct mount *, int, int);
 
 
 WINDOW *
-openbufcache()
+openbufcache(void)
 {
 
        return (subwin(stdscr, LINES-5-1, 0, 5, 0));
 }
 
 void
-closebufcache(w)
-       WINDOW *w;
+closebufcache(WINDOW *w)
 {
 
        if (w == NULL)
@@ -133,7 +132,7 @@
 }
 
 void
-labelbufcache()
+labelbufcache(void)
 {
        mvwprintw(wnd, 0, 0, "There are %d buffers using %d kBytes of memory.",
            nbuf, bufkb);
@@ -146,7 +145,7 @@
 }
 
 void
-showbufcache()
+showbufcache(void)
 {
        int tbuf, i, lastrow;
        long tvalid, tsize;
@@ -186,7 +185,7 @@
 }
 
 int
-initbufcache()
+initbufcache(void)
 {
        if (namelist[X_NBUF].n_type == 0) {
                if (kvm_nlist(kd, namelist)) {
@@ -213,7 +212,7 @@
 }
 
 void
-fetchbufcache()
+fetchbufcache(void)
 {
        int i, count;
        struct buf *bp;
@@ -271,7 +270,7 @@
 }
 
 static void
-vc_init()
+vc_init(void)
 {
        int i;
 
@@ -281,7 +280,7 @@
 }
 
 static void
-ml_init()
+ml_init(void)
 {
        struct ml_entry *ml;
 
@@ -294,8 +293,7 @@
 
 
 static struct vnode *
-vc_lookup(vaddr)
-       struct vnode *vaddr;
+vc_lookup(struct vnode *vaddr)
 {
        struct vnode *ret;
        int i, oldest, match;
@@ -332,9 +330,7 @@
 }
 
 static struct mount *
-ml_lookup(maddr, size, valid)
-       struct mount *maddr;
-       int size, valid;
+ml_lookup(struct mount *maddr, int size, int valid)
 {
        struct ml_entry *ml;
 
diff -r 25ceb247b611 -r 7777c9bf4849 usr.bin/systat/cmds.c
--- a/usr.bin/systat/cmds.c     Wed Jul 05 10:54:12 2000 +0000
+++ b/usr.bin/systat/cmds.c     Wed Jul 05 11:03:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.21 2000/06/05 21:48:25 mycroft Exp $        */
+/*     $NetBSD: cmds.c,v 1.22 2000/07/05 11:03:20 ad Exp $     */
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)cmds.c     8.2 (Berkeley) 4/29/95";
 #endif
-__RCSID("$NetBSD: cmds.c,v 1.21 2000/06/05 21:48:25 mycroft Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.22 2000/07/05 11:03:20 ad Exp $");
 #endif /* not lint */
 
 #include <stdlib.h>
@@ -49,11 +49,10 @@
 #include "systat.h"
 #include "extern.h"
 
-void   switch_mode __P((struct mode *p));
+void   switch_mode(struct mode *p);
 
 void
-command(cmd)
-       char *cmd;
+command(char *cmd)
 {
        struct command *c;
        struct mode *p;
@@ -101,8 +100,7 @@
 }
 
 void
-switch_mode(p)
-       struct mode *p;
+switch_mode(struct mode *p)
 {
        int switchfail;
 
@@ -146,7 +144,7 @@
 }
 
 void
-status()
+status(void)
 {
        error("Showing %s, refresh every %d seconds.", curmode->c_name, naptime);
 }
diff -r 25ceb247b611 -r 7777c9bf4849 usr.bin/systat/cmdtab.c
--- a/usr.bin/systat/cmdtab.c   Wed Jul 05 10:54:12 2000 +0000
+++ b/usr.bin/systat/cmdtab.c   Wed Jul 05 11:03:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmdtab.c,v 1.15 2000/04/11 01:18:35 jwise Exp $        */
+/*     $NetBSD: cmdtab.c,v 1.16 2000/07/05 11:03:21 ad Exp $   */
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)cmdtab.c   8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: cmdtab.c,v 1.15 2000/04/11 01:18:35 jwise Exp $");
+__RCSID("$NetBSD: cmdtab.c,v 1.16 2000/07/05 11:03:21 ad Exp $");
 #endif /* not lint */
 
 #include "systat.h"
@@ -59,6 +59,14 @@
        { 0 }
 };
 
+struct command icmp_commands[] = {
+       { "boot",       icmp_boot,      "show total stats since boot"},
+       { "run",        icmp_run,       "show running total stats"},
+       { "time",       icmp_time,      "show stats for each sample time"},
+       { "zero",       icmp_zero,      "re-zero running totals"},
+       { 0 }
+};
+
 struct command iostat_commands[] = {
        { "bars",       iostat_bars,    "show io stats as a bar graph"},
        { "numbers",    iostat_numbers, "show io stats numerically"},
@@ -72,6 +80,34 @@
        { 0 }
 };
 
+struct command ip_commands[] = {
+       { "boot",       ip_boot,        "show total stats since boot"},
+       { "run",        ip_run,         "show running total stats"},
+       { "time",       ip_time,        "show stats for each sample time"},
+       { "zero",       ip_zero,        "re-zero running totals"},
+       { 0 }
+};
+
+#ifdef INET6
+struct command ip6_commands[] = {
+       { "boot",       ip6_boot,       "show total stats since boot"},
+       { "run",        ip6_run,        "show running total stats"},
+       { "time",       ip6_time,       "show stats for each sample time"},
+       { "zero",       ip6_zero,       "re-zero running totals"},
+       { 0 }
+};
+#endif
+
+#ifdef IPSEC
+struct command ipsec_commands[] = {
+       { "boot",       ipsec_boot,     "show total stats since boot"},
+       { "run",        ipsec_run,      "show running total stats"},
+       { "time",       ipsec_time,     "show stats for each sample time"},
+       { "zero",       ipsec_zero,     "re-zero running totals"},
+       { NULL,         NULL,           NULL },
+};
+#endif
+
 struct command netstat_commands[] = {
        { "all",        netstat_all,     "include server sockets"},
        { "display",    netstat_display, "show specified hosts or ports"},
@@ -90,6 +126,14 @@
        { 0 }
 };
 
+struct command tcp_commands[] = {
+       { "boot",       tcp_boot,       "show total stats since boot"},
+       { "run",        tcp_run,        "show running total stats"},
+       { "time",       tcp_time,       "show stats for each sample time"},
+       { "zero",       tcp_zero,       "re-zero running totals"},
+       { NULL,         NULL,           NULL },
+};
+
 struct command vmstat_commands[] = {
        { "boot",       vmstat_boot,    "show total vm stats since boot"},
        { "run",        vmstat_run,     "show running total vm stats"},
@@ -113,25 +157,25 @@
          initbufcache, openbufcache,   closebufcache,  0,
          CF_LOADAV },
        { "inet.icmp",  showicmp,       fetchicmp,      labelicmp,
-         initicmp,     openicmp,       closeicmp,      0,
+         initicmp,     openicmp,       closeicmp,      icmp_commands,
          CF_LOADAV },
        { "inet.ip",    showip,         fetchip,        labelip,
-         initip,       openip,         closeip,        0,
+         initip,       openip,         closeip,        ip_commands,
          CF_LOADAV },
        { "inet.tcp",   showtcp,        fetchtcp,       labeltcp,
-         inittcp,      opentcp,        closetcp,       0,
+         inittcp,      opentcp,        closetcp,       tcp_commands,
          CF_LOADAV },
        { "inet.tcpsyn",showtcpsyn,     fetchtcp,       labeltcpsyn,
-         inittcp,      opentcp,        closetcp,       0,
+         inittcp,      opentcp,        closetcp,       tcp_commands,
          CF_LOADAV },
 #ifdef INET6
        { "inet6.ip6",  showip6,        fetchip6,       labelip6,
-         initip6,      openip6,        closeip6,       0,
+         initip6,      openip6,        closeip6,       ip6_commands,
          CF_LOADAV },
 #endif
 #ifdef IPSEC
        { "ipsec",      showipsec,      fetchipsec,     labelipsec,
-         initipsec,    openipsec,      closeipsec,     0,
+         initipsec,    openipsec,      closeipsec,     ipsec_commands,
          CF_LOADAV },
 #endif
        { "iostat",     showiostat,     fetchiostat,    labeliostat,
@@ -149,8 +193,8 @@
        { "swap",       showswap,       fetchswap,      labelswap,
          initswap,     openswap,       closeswap,      0,
          CF_LOADAV },
-       { "vmstat",     showkre,        fetchkre,       labelkre,
-         initkre,      openkre,        closekre,       vmstat_commands,
+       { "vmstat",     showvmstat,     fetchvmstat,    labelvmstat,
+         initvmstat,   openvmstat,     closevmstat,    vmstat_commands,
          0 },
        { 0 }
 };
diff -r 25ceb247b611 -r 7777c9bf4849 usr.bin/systat/disks.c



Home | Main Index | Thread Index | Old Index