summaryrefslogtreecommitdiff
path: root/usr/src/cmd/stat
diff options
context:
space:
mode:
authorJohn Levon <john.levon@sun.com>2010-06-10 18:27:18 -0700
committerJohn Levon <john.levon@sun.com>2010-06-10 18:27:18 -0700
commit44c4f64b9f50f21ae3e51ad48a595c85f53db4bc (patch)
treeacec7a2cf16eed6b62163744b46431a1bdd81ecc /usr/src/cmd/stat
parentbfbb13c994c87d0453ca6bb826470ec99a909992 (diff)
downloadillumos-gate-44c4f64b9f50f21ae3e51ad48a595c85f53db4bc.tar.gz
PSARC 2004/445 EOF of vmstat -c option
4801975 remove flushmeter + kstats after EOF period (PSARC 2004/445) 5034996 remove vmstat -c (after EOF period for PSARC 2004/445)
Diffstat (limited to 'usr/src/cmd/stat')
-rw-r--r--usr/src/cmd/stat/common/acquire.c22
-rw-r--r--usr/src/cmd/stat/common/statcommon.h21
-rw-r--r--usr/src/cmd/stat/vmstat/vmstat.c67
3 files changed, 16 insertions, 94 deletions
diff --git a/usr/src/cmd/stat/common/acquire.c b/usr/src/cmd/stat/common/acquire.c
index afc379adeb..b952b8d5e4 100644
--- a/usr/src/cmd/stat/common/acquire.c
+++ b/usr/src/cmd/stat/common/acquire.c
@@ -19,12 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "statcommon.h"
#include "dsr.h"
@@ -158,7 +155,7 @@ acquire_psets(struct snapshot *ss)
ps->ps_id = pids[i - 1];
ps->ps_cpus =
- calloc(ss->s_nr_cpus, sizeof (struct cpu_snapshot *));
+ calloc(ss->s_nr_cpus, sizeof (struct cpu_snapshot *));
if (ps->ps_cpus == NULL)
goto out;
}
@@ -227,7 +224,7 @@ acquire_intrs(struct snapshot *ss, kstat_ctl_t *kc)
ki = KSTAT_INTR_PTR(ksp);
(void) strlcpy(ss->s_intrs[i].is_name, ksp->ks_name,
- KSTAT_STRLEN);
+ KSTAT_STRLEN);
ss->s_intrs[i].is_total = 0;
for (j = 0; j < KSTAT_NUM_INTRS; j++)
@@ -322,17 +319,6 @@ retry:
fail(1, "kstat_chain_update failed");
}
- if (types & SNAP_FLUSHES) {
- kstat_t *ksp;
- ksp = kstat_lookup(kc, "unix", 0, "flushmeter");
- if (ksp == NULL) {
- fail(0, "This machine does not have "
- "a virtual address cache");
- }
- if (kstat_read(kc, ksp, &ss->s_flushes) == -1)
- err = errno;
- }
-
if (!err && (types & SNAP_INTERRUPTS))
err = acquire_intrs(ss, kc);
@@ -488,7 +474,7 @@ kstat_add(const kstat_t *src, kstat_t *dst)
for (i = 0; i < src->ks_ndata; i++) {
/* "addition" makes little sense for strings */
if (from->data_type != KSTAT_DATA_CHAR &&
- from->data_type != KSTAT_DATA_STRING)
+ from->data_type != KSTAT_DATA_STRING)
(to)->value.ui64 += (from)->value.ui64;
from++;
to++;
diff --git a/usr/src/cmd/stat/common/statcommon.h b/usr/src/cmd/stat/common/statcommon.h
index 7ae60ced27..9ee077431d 100644
--- a/usr/src/cmd/stat/common/statcommon.h
+++ b/usr/src/cmd/stat/common/statcommon.h
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
*
* Common routines for acquiring snapshots of kstats for
* iostat, mpstat, and vmstat.
@@ -40,7 +39,6 @@ extern "C" {
#include <sys/buf.h>
#include <sys/dnlc.h>
#include <sys/sysinfo.h>
-#include <sys/vmmeter.h>
#include <sys/processor.h>
#include <sys/pset.h>
#include <sys/avl.h>
@@ -72,22 +70,20 @@ enum snapshot_types {
SNAP_SYSTEM = 1 << 2,
/* interrupt sources and counts */
SNAP_INTERRUPTS = 1 << 3,
- /* cache flushes */
- SNAP_FLUSHES = 1 << 4,
/* disk etc. stats */
- SNAP_IODEVS = 1 << 5,
+ SNAP_IODEVS = 1 << 4,
/* disk controller aggregates */
- SNAP_CONTROLLERS = 1 << 6,
+ SNAP_CONTROLLERS = 1 << 5,
/* mpxio L I (multipath) paths: -X: Lun,LunInitiator */
- SNAP_IOPATHS_LI = 1 << 7,
+ SNAP_IOPATHS_LI = 1 << 6,
/* mpxio LTI (multipath) paths: -Y: Lun,LunTarget,LunTargetInitiator */
- SNAP_IOPATHS_LTI = 1 << 8,
+ SNAP_IOPATHS_LTI = 1 << 7,
/* disk error stats */
- SNAP_IODEV_ERRORS = 1 << 9,
+ SNAP_IODEV_ERRORS = 1 << 8,
/* pretty names for iodevs */
- SNAP_IODEV_PRETTY = 1 << 10,
+ SNAP_IODEV_PRETTY = 1 << 9,
/* devid for iodevs */
- SNAP_IODEV_DEVID = 1 << 11
+ SNAP_IODEV_DEVID = 1 << 10
};
struct cpu_snapshot {
@@ -225,7 +221,6 @@ struct snapshot {
size_t s_iodevs_is_name_maxlen;
struct sys_snapshot s_sys;
struct biostats s_biostats;
- struct flushmeter s_flushes;
};
/* print a message and exit with failure */
diff --git a/usr/src/cmd/stat/vmstat/vmstat.c b/usr/src/cmd/stat/vmstat/vmstat.c
index 2f4aff5f17..f089d554f6 100644
--- a/usr/src/cmd/stat/vmstat/vmstat.c
+++ b/usr/src/cmd/stat/vmstat/vmstat.c
@@ -1,6 +1,5 @@
/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -37,7 +36,7 @@ static int hz;
static int pagesize;
static double etime;
static int lines = 1;
-static int swflag = 0, cflag = 0, pflag = 0;
+static int swflag = 0, pflag = 0;
static int suppress_state;
static long iter = 0;
static hrtime_t period_n = 0;
@@ -53,7 +52,6 @@ static void dovmstats(struct snapshot *old, struct snapshot *new);
static void printhdr(int);
static void dosum(struct sys_snapshot *ss);
static void dointr(struct snapshot *ss);
-static void docachestats(kstat_ctl_t *kc, hrtime_t interval, int forever);
static void usage(void);
int
@@ -77,7 +75,7 @@ main(int argc, char **argv)
pagesize = sysconf(_SC_PAGESIZE);
hz = sysconf(_SC_CLK_TCK);
- while ((c = getopt(argc, argv, "cipqsST:")) != EOF)
+ while ((c = getopt(argc, argv, "ipqsST:")) != EOF)
switch (c) {
case 'S':
swflag = !swflag;
@@ -88,9 +86,6 @@ main(int argc, char **argv)
case 'i':
intr = 1;
break;
- case 'c':
- cflag++;
- break;
case 'q':
suppress_state = 1;
break;
@@ -121,8 +116,6 @@ main(int argc, char **argv)
if (intr)
types |= SNAP_INTERRUPTS;
- if (cflag)
- types |= SNAP_FLUSHES;
if (!intr)
types |= SNAP_IODEVS;
@@ -184,12 +177,6 @@ main(int argc, char **argv)
usage();
}
- if (cflag) {
- free_snapshot(ss);
- docachestats(kc, period_n, forever);
- exit(0);
- }
-
(void) sigset(SIGCONT, printhdr);
dovmstats(old, ss);
@@ -512,56 +499,10 @@ dointr(struct snapshot *ss)
}
static void
-docachestats(kstat_ctl_t *kc, hrtime_t interval, int forever)
-{
- struct snapshot *old;
- struct snapshot *new;
- int i;
- hrtime_t start;
-
- start = gethrtime();
- old = acquire_snapshot(kc, SNAP_FLUSHES, NULL);
-
- if (iter == 0) {
- (void) printf("flush statistics: (totals)\n");
- (void) printf("%8s%8s%8s%8s%8s%8s\n",
- "usr", "ctx", "rgn", "seg", "pag", "par");
- (void) printf(" %7d %7d %7d %7d %7d %7d\n",
- old->s_flushes.f_usr, old->s_flushes.f_ctx,
- old->s_flushes.f_region, old->s_flushes.f_segment,
- old->s_flushes.f_page, old->s_flushes.f_partial);
- return;
- }
-
- (void) printf("flush statistics: (interval based)\n");
- for (i = 0; i < iter; i++) {
- if (i % REPRINT == 0)
- (void) printf("%8s%8s%8s%8s%8s%8s\n",
- "usr", "ctx", "rgn", "seg", "pag", "par");
-
- /* Have a kip */
- sleep_until(&start, interval, forever, &caught_cont);
-
- new = acquire_snapshot(kc, SNAP_FLUSHES, NULL);
-
- (void) printf(" %7d %7d %7d %7d %7d %7d\n",
- new->s_flushes.f_usr - old->s_flushes.f_usr,
- new->s_flushes.f_ctx - old->s_flushes.f_ctx,
- new->s_flushes.f_region - old->s_flushes.f_region,
- new->s_flushes.f_segment - old->s_flushes.f_segment,
- new->s_flushes.f_page - old->s_flushes.f_page,
- new->s_flushes.f_partial- old->s_flushes.f_partial);
- (void) fflush(stdout);
- free_snapshot(old);
- old = new;
- }
-}
-
-static void
usage(void)
{
(void) fprintf(stderr,
- "Usage: vmstat [-cipqsS] [-T d|u] [disk ...] "
+ "Usage: vmstat [-ipqsS] [-T d|u] [disk ...] "
"[interval [count]]\n");
exit(1);
}