Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add tape statistics.
details: https://anonhg.NetBSD.org/src/rev/ba18dbe6cfcb
branches: trunk
changeset: 583463:ba18dbe6cfcb
user: blymn <blymn%NetBSD.org@localhost>
date: Sun Aug 07 12:32:38 2005 +0000
description:
Add tape statistics.
diffstat:
usr.bin/systat/Makefile | 4 +-
usr.bin/systat/iostat.c | 119 ++++++++++++++++++++++++++++-
usr.bin/systat/vmstat.c | 59 ++++++++++++--
usr.sbin/iostat/Makefile | 4 +-
usr.sbin/iostat/iostat.c | 187 ++++++++++++++++++++++++++++++++++++++++++++--
5 files changed, 343 insertions(+), 30 deletions(-)
diffs (truncated from 694 to 300 lines):
diff -r 31b09574a2c8 -r ba18dbe6cfcb usr.bin/systat/Makefile
--- a/usr.bin/systat/Makefile Sun Aug 07 12:30:01 2005 +0000
+++ b/usr.bin/systat/Makefile Sun Aug 07 12:32:38 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.30 2005/02/26 22:12:33 dsl Exp $
+# $NetBSD: Makefile,v 1.31 2005/08/07 12:32:38 blymn Exp $
# @(#)Makefile 8.1 (Berkeley) 6/6/93
.include <bsd.own.mk>
@@ -11,7 +11,7 @@
CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin/vmstat -DSUPPORT_UTMP -DSUPPORT_UTMPX \
-I${NETBSDSRCDIR}/usr.bin/who
CWARNFLAGS+= -Wno-format-y2k
-SRCS= bufcache.c cmds.c cmdtab.c disks.c df.c dkstats.c fetch.c \
+SRCS= bufcache.c cmds.c cmdtab.c disks.c df.c dkstats.c tpstats.c fetch.c \
globalcmds.c icmp.c iostat.c ip.c keyboard.c main.c mbufs.c \
netcmds.c netstat.c pigs.c ps.c swap.c tcp.c vmstat.c utmpentry.c
DPADD= ${LIBCURSES} ${LIBM} ${LIBKVM}
diff -r 31b09574a2c8 -r ba18dbe6cfcb usr.bin/systat/iostat.c
--- a/usr.bin/systat/iostat.c Sun Aug 07 12:30:01 2005 +0000
+++ b/usr.bin/systat/iostat.c Sun Aug 07 12:32:38 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iostat.c,v 1.32 2005/02/26 22:28:23 dsl Exp $ */
+/* $NetBSD: iostat.c,v 1.33 2005/08/07 12:32:38 blymn Exp $ */
/*
* Copyright (c) 1980, 1992, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: iostat.c,v 1.32 2005/02/26 22:28:23 dsl Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.33 2005/08/07 12:32:38 blymn Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -44,6 +44,7 @@
#include "systat.h"
#include "extern.h"
#include "dkstats.h"
+#include "tpstats.h"
static int linesperregion;
static double etime;
@@ -55,6 +56,7 @@
static void histogram(double, int, double);
static int numlabels(int);
static int stats(int, int, int);
+static int tpstats(int, int, int);
static void stat1(int, int);
@@ -81,7 +83,9 @@
{
dkinit(1);
+ tpinit(1);
dkreadstats();
+ tpreadstats();
return(1);
}
@@ -91,7 +95,13 @@
if (dk_ndrive == 0)
return;
- dkreadstats();
+ else
+ dkreadstats();
+
+ if (tp_ndrive == 0)
+ return;
+ else
+ tpreadstats();
}
#define INSET 14
@@ -101,7 +111,7 @@
{
int row;
- if (dk_ndrive == 0) {
+ if ((dk_ndrive == 0) && (tp_ndrive == 0)) {
error("No drives defined.");
return;
}
@@ -130,6 +140,10 @@
for (ndrives = 0, i = 0; i < dk_ndrive; i++)
if (cur.dk_select[i])
ndrives++;
+ for (i = 0; i < tp_ndrive; i++)
+ if (cur_tape.select[i])
+ ndrives++;
+
regions = howmany(ndrives, DRIVESPERLINE);
/*
* Deduct -regions for blank line after each scrolling region.
@@ -142,14 +156,22 @@
if (linesperregion < 3)
linesperregion = 3;
col = 0;
- for (i = 0; i < dk_ndrive; i++)
- if (cur.dk_select[i]) {
+ for (i = 0; i < (dk_ndrive + tp_ndrive); i++)
+ if (((i < dk_ndrive) && (cur.dk_select[i])) ||
+ ((i >= dk_ndrive) && (cur_tape.select[i - dk_ndrive]))) {
if (col + COLWIDTH - 1 > getmaxx(wnd)) {
col = 0, row += linesperregion + 1;
if (row > getmaxy(wnd) - (linesperregion))
break;
}
- mvwprintw(wnd, row, col + 5, "%s", cur.dk_name[i]);
+
+ if (i < dk_ndrive)
+ mvwprintw(wnd, row, col + 5, "%s",
+ cur.dk_name[i]);
+ else
+ mvwprintw(wnd, row, col + 5, "%s",
+ cur_tape.name[i - dk_ndrive]);
+
if (read_write)
mvwprintw(wnd, row, col + 11 + secs * 5,
"(write)");
@@ -188,6 +210,20 @@
if (secs)
mvwaddstr(wnd, row++, 0, " msec|");
}
+ for (i = 0; i < tp_ndrive; i++)
+ if (cur_tape.select[i]) {
+ if (row > getmaxy(wnd) - linesperregion)
+ break;
+ mvwprintw(wnd, row++, 0, "%7.7s kBps|",
+ cur_tape.name[i]);
+ mvwaddstr(wnd, row++, 0, " tps|");
+ if (read_write) {
+ mvwprintw(wnd, row++, 0, " (write) kBps|");
+ mvwaddstr(wnd, row++, 0, " tps|");
+ }
+ if (secs)
+ mvwaddstr(wnd, row++, 0, " msec|");
+ }
return (row);
}
@@ -199,6 +235,7 @@
if (dk_ndrive == 0)
return;
dkswap();
+ tpswap();
etime = cur.cp_etime;
row = 1;
@@ -216,6 +253,12 @@
break;
row = stats(row, INSET, i);
}
+ for (i = 0; i < tp_ndrive; i++)
+ if (cur_tape.select[i]) {
+ if (row > getmaxy(wnd) - linesperregion)
+ break;
+ row = tpstats(row, INSET, i);
+ }
return;
}
col = 0;
@@ -237,6 +280,20 @@
(void) stats(row + 3, col, i);
col += COLWIDTH;
}
+ for (i = 0; i < tp_ndrive; i++)
+ if (cur_tape.select[i]) {
+ if (col + COLWIDTH - 1 > getmaxx(wnd)) {
+ col = 0, row += linesperregion + 1;
+ if (row > getmaxy(wnd) - (linesperregion + 1))
+ break;
+ wmove(wnd, row + linesperregion, 0);
+ wdeleteln(wnd);
+ wmove(wnd, row + 3, 0);
+ winsertln(wnd);
+ }
+ (void) stats(row + 3, col, i);
+ col += COLWIDTH;
+ }
}
static int
@@ -287,6 +344,54 @@
return (row);
}
+static int
+tpstats(int row, int col, int dn)
+{
+ double atime, rwords, wwords;
+ uint64_t rxfer;
+
+ /* time busy in disk activity */
+ atime = (double)cur_tape.time[dn].tv_sec +
+ ((double)cur_tape.time[dn].tv_usec / (double)1000000);
+
+ /* # of k transferred */
+ rwords = cur_tape.rbytes[dn] / 1024.0;
+ wwords = cur_tape.wbytes[dn] / 1024.0;
+ rxfer = cur_tape.rxfer[dn];
+ if (!read_write) {
+ rwords = wwords;
+ rxfer += cur_tape.wxfer[dn];
+ }
+ if (numbers) {
+ mvwprintw(wnd, row, col, "%5.0f%4.0f",
+ rwords / etime, rxfer / etime);
+ if (secs)
+ wprintw(wnd, "%5.1f", atime / etime);
+ if (read_write)
+ wprintw(wnd, " %5.0f%4.0f",
+ wwords / etime, cur_tape.wxfer[dn] / etime);
+ return (row);
+ }
+
+ wmove(wnd, row++, col);
+ histogram(rwords / etime, 50, 0.5);
+ wmove(wnd, row++, col);
+ histogram(rxfer / etime, 50, 0.5);
+ if (read_write) {
+ wmove(wnd, row++, col);
+ histogram(wwords / etime, 50, 0.5);
+ wmove(wnd, row++, col);
+ histogram(cur_tape.wxfer[dn] / etime, 50, 0.5);
+ }
+
+ if (secs) {
+ wmove(wnd, row++, col);
+ atime *= 1000; /* In milliseconds */
+ histogram(atime / etime, 50, 0.5);
+ }
+ return (row);
+}
+
static void
stat1(int row, int o)
{
diff -r 31b09574a2c8 -r ba18dbe6cfcb usr.bin/systat/vmstat.c
--- a/usr.bin/systat/vmstat.c Sun Aug 07 12:30:01 2005 +0000
+++ b/usr.bin/systat/vmstat.c Sun Aug 07 12:32:38 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.60 2005/05/22 14:00:59 chs Exp $ */
+/* $NetBSD: vmstat.c,v 1.61 2005/08/07 12:32:38 blymn Exp $ */
/*-
* Copyright (c) 1983, 1989, 1992, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
#endif
-__RCSID("$NetBSD: vmstat.c,v 1.60 2005/05/22 14:00:59 chs Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.61 2005/08/07 12:32:38 blymn Exp $");
#endif /* not lint */
/*
@@ -56,6 +56,7 @@
#include "systat.h"
#include "extern.h"
#include "dkstats.h"
+#include "tpstats.h"
#include "utmpentry.h"
static struct Info {
@@ -79,6 +80,7 @@
static void copyinfo(struct Info *, struct Info *);
static float cputime(int);
static void dinfo(int, int, int);
+static void tinfo(int, int, int);
static void getinfo(struct Info *, enum state);
static void putint(int, int, int, int);
static void putfloat(double, int, int, int, int, int);
@@ -221,6 +223,8 @@
hertz = stathz ? stathz : hz;
if (!dkinit(1))
return(0);
+ if (!tpinit(1))
+ return(0);
/* Old style interrupt counts - deprecated */
nintr = (namelist[X_EINTRCNT].n_value -
@@ -423,6 +427,7 @@
if (state == TIME) {
dkswap();
+ tpswap();
etime = cur.cp_etime;
/* < 5 ticks - ignore this trash */
if ((etime * hertz) < 1.0) {
@@ -551,16 +556,23 @@
PUTRATE(uvmexp.intrs, GENSTATROW + 1, GENSTATCOL + 17, 5);
PUTRATE(uvmexp.softs, GENSTATROW + 1, GENSTATCOL + 22, 5);
PUTRATE(uvmexp.faults, GENSTATROW + 1, GENSTATCOL + 27, 6);
- for (l = 0, i = 0, r = DISKROW, c = DISKCOL; i < dk_ndrive; i++) {
- if (!dk_select[i])
- continue;
+ for (l = 0, i = 0, r = DISKROW, c = DISKCOL;
Home |
Main Index |
Thread Index |
Old Index