Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/vmstat allow the number of disks displayed in the de...
details: https://anonhg.NetBSD.org/src/rev/4cb8b186db7d
branches: trunk
changeset: 360016:4cb8b186db7d
user: mrg <mrg%NetBSD.org@localhost>
date: Wed Feb 09 07:34:08 2022 +0000
description:
allow the number of disks displayed in the default output
to be controlled.
diffstat:
usr.bin/vmstat/vmstat.1 | 12 +++++++++---
usr.bin/vmstat/vmstat.c | 21 ++++++++++++++-------
2 files changed, 23 insertions(+), 10 deletions(-)
diffs (118 lines):
diff -r 5e364b1010b8 -r 4cb8b186db7d usr.bin/vmstat/vmstat.1
--- a/usr.bin/vmstat/vmstat.1 Wed Feb 09 07:32:33 2022 +0000
+++ b/usr.bin/vmstat/vmstat.1 Wed Feb 09 07:34:08 2022 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: vmstat.1,v 1.25 2021/12/13 08:19:12 simonb Exp $
+.\" $NetBSD: vmstat.1,v 1.26 2022/02/09 07:34:08 mrg Exp $
.\"
.\" Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -53,7 +53,7 @@
.\"
.\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93
.\"
-.Dd December 13, 2021
+.Dd February 1, 2022
.Dt VMSTAT 1
.Os
.Sh NAME
@@ -66,6 +66,7 @@
.Op Fl h Ar hashname
.Op Fl M Ar core
.Op Fl N Ar system
+.Op Fl n Ar diskcount
.Op Fl u Ar histname
.Op Fl w Ar wait
.Op Ar disks
@@ -123,6 +124,10 @@
.It Fl N Ar system
Extract the name list from the specified system instead of the default
.Pa /netbsd .
+.It Fl n Ar diskcount
+Display up to
+.Ar diskcount
+disks in the standard output, instead of the default 2.
.It Fl s
Display the contents of the
.Dv uvmexp
@@ -300,7 +305,8 @@
.Xr kernhist 9
.Sh BUGS
The
-.Fl c
+.Fl c ,
+.Fl n ,
and
.Fl w
options are only available with the default output.
diff -r 5e364b1010b8 -r 4cb8b186db7d usr.bin/vmstat/vmstat.c
--- a/usr.bin/vmstat/vmstat.c Wed Feb 09 07:32:33 2022 +0000
+++ b/usr.bin/vmstat/vmstat.c Wed Feb 09 07:34:08 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.249 2022/02/01 09:18:07 mrg Exp $ */
+/* $NetBSD: vmstat.c,v 1.250 2022/02/09 07:34:18 mrg Exp $ */
/*-
* Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 3/1/95";
#else
-__RCSID("$NetBSD: vmstat.c,v 1.249 2022/02/01 09:18:07 mrg Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.250 2022/02/09 07:34:18 mrg Exp $");
#endif
#endif /* not lint */
@@ -329,6 +329,8 @@
static const int uvmexp2_mib[] = { CTL_VM, VM_UVMEXP2 };
static const int boottime_mib[] = { CTL_KERN, KERN_BOOTTIME };
+int numdisks = 2;
+
int
main(int argc, char *argv[])
{
@@ -343,7 +345,7 @@
reps = todo = verbose = wide = 0;
interval.tv_sec = 0;
interval.tv_nsec = 0;
- while ((c = getopt(argc, argv, "Cc:efh:HilLM:mN:stu:UvWw:")) != -1) {
+ while ((c = getopt(argc, argv, "Cc:efh:HilLM:mN:n:stu:UvWw:")) != -1) {
switch (c) {
case 'c':
reps = atoi(optarg);
@@ -381,6 +383,9 @@
case 'N':
nlistf = optarg;
break;
+ case 'n':
+ numdisks = atoi(optarg);
+ break;
case 's':
todo |= SUMSTAT;
break;
@@ -595,10 +600,10 @@
/*
* Pick the most active drives. Must read the stats once before
* sorting so that there is current IO data, before selecting
- * just the first two drives.
+ * just the first 'numdisks' (default 2) drives.
*/
drvreadstats();
- for (i = 0; i < ndrive && ndrives < 2; i++) {
+ for (i = 0; i < ndrive && ndrives < numdisks; i++) {
uint64_t high_bytes = 0, bytes;
k = ndrive;
@@ -2436,7 +2441,9 @@
{
(void)fprintf(stderr,
- "usage: %s [-CefHiLlmstUvW] [-c count] [-h hashname] [-M core] [-N system]\n"
- "\t\t[-u histname] [-w wait] [disks]\n", getprogname());
+ "usage: %s [-CefHiLlmstUvW] [-c count] [-h hashname]\n"
+ "\t\t[-M core] [-N system] [-d diskcount] [-u histname]\n"
+ "[-w wait] [disks]\n",
+ getprogname());
exit(1);
}
Home |
Main Index |
Thread Index |
Old Index