Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/vmstat Add support for tape statistics.
details: https://anonhg.NetBSD.org/src/rev/01e7f961d6a4
branches: trunk
changeset: 583458:01e7f961d6a4
user: blymn <blymn%NetBSD.org@localhost>
date: Sun Aug 07 12:23:20 2005 +0000
description:
Add support for tape statistics.
diffstat:
usr.bin/vmstat/Makefile | 4 ++--
usr.bin/vmstat/vmstat.c | 41 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 41 insertions(+), 4 deletions(-)
diffs (120 lines):
diff -r d0b42b57c986 -r 01e7f961d6a4 usr.bin/vmstat/Makefile
--- a/usr.bin/vmstat/Makefile Sun Aug 07 12:21:46 2005 +0000
+++ b/usr.bin/vmstat/Makefile Sun Aug 07 12:23:20 2005 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.21 2005/02/26 21:19:18 dsl Exp $
+# $NetBSD: Makefile,v 1.22 2005/08/07 12:23:20 blymn Exp $
# @(#)Makefile 8.1 (Berkeley) 6/6/93
PROG= vmstat
WARNS=3
-SRCS= dkstats.c vmstat.c
+SRCS= dkstats.c tpstats.c vmstat.c
MAN= vmstat.1
DPADD= ${LIBKVM}
LDADD= -lkvm
diff -r d0b42b57c986 -r 01e7f961d6a4 usr.bin/vmstat/vmstat.c
--- a/usr.bin/vmstat/vmstat.c Sun Aug 07 12:21:46 2005 +0000
+++ b/usr.bin/vmstat/vmstat.c Sun Aug 07 12:23:20 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.135 2005/06/02 04:34:57 lukem Exp $ */
+/* $NetBSD: vmstat.c,v 1.136 2005/08/07 12:23:20 blymn Exp $ */
/*-
* Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 3/1/95";
#else
-__RCSID("$NetBSD: vmstat.c,v 1.135 2005/06/02 04:34:57 lukem Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.136 2005/08/07 12:23:20 blymn Exp $");
#endif
#endif /* not lint */
@@ -133,6 +133,7 @@
#include <util.h>
#include "dkstats.h"
+#include "tpstats.h"
/*
* General namelist
@@ -252,6 +253,7 @@
void cpustats(void);
void deref_kptr(const void *, void *, size_t, const char *);
void dkstats(void);
+void tpstats(void);
void doevcnt(int verbose);
void dohashstat(int, int, const char *);
void dointr(int verbose);
@@ -404,6 +406,7 @@
struct winsize winsize;
dkinit(0); /* Initialize disk stats, no disks selected. */
+ tpinit(0);
(void)setgid(getgid()); /* don't need privs anymore */
@@ -515,6 +518,13 @@
++ndrives;
break;
}
+ for (i = 0; i < tp_ndrive; i++) {
+ if (strcmp(tp_name[i], *argv))
+ continue;
+ tp_select[i] = 1;
+ ++ndrives;
+ break;
+ }
}
for (i = 0; i < dk_ndrive && ndrives < 3; i++) {
if (dk_select[i])
@@ -522,6 +532,14 @@
dk_select[i] = 1;
++ndrives;
}
+
+ for (i = 0; i < tp_ndrive && ndrives < 3; i++) {
+ if (tp_select[i])
+ continue;
+ tp_select[i] = 1;
+ ++ndrives;
+ }
+
return (argv);
}
@@ -660,6 +678,7 @@
(void)printf("%4lu ", rate(uvmexp.pdfreed - ouvmexp.pdfreed));
(void)printf("%4lu ", rate(uvmexp.pdscans - ouvmexp.pdscans));
dkstats();
+ tpstats();
(void)printf("%4lu %4lu %3lu ",
rate(uvmexp.intrs - ouvmexp.intrs),
rate(uvmexp.syscalls - ouvmexp.syscalls),
@@ -881,6 +900,24 @@
}
void
+tpstats(void)
+{
+ int dn;
+ double etime;
+
+ /* Calculate tape stat deltas. */
+ tpswap();
+ etime = cur.cp_etime;
+
+ for (dn = 0; dn < tp_ndrive; ++dn) {
+ if (!tp_select[dn])
+ continue;
+ (void)printf("%2.0f ",
+ (cur_tape.rxfer[dn] + cur_tape.wxfer[dn]) / etime);
+ }
+}
+
+void
cpustats(void)
{
int state;
Home |
Main Index |
Thread Index |
Old Index