Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/intrctl add "-w wait" arg to "intrctl list" to have...
details: https://anonhg.NetBSD.org/src/rev/bc3c5285cd70
branches: trunk
changeset: 965587:bc3c5285cd70
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Sep 23 09:17:19 2019 +0000
description:
add "-w wait" arg to "intrctl list" to have it loop forever.
don't bother testing poitner for NULL before calling free().
diffstat:
usr.sbin/intrctl/intrctl.8 | 14 +++++++++--
usr.sbin/intrctl/intrctl.c | 48 ++++++++++++++++++++++++++++--------------
usr.sbin/intrctl/intrctl_io.c | 7 ++---
3 files changed, 46 insertions(+), 23 deletions(-)
diffs (159 lines):
diff -r d53676294977 -r bc3c5285cd70 usr.sbin/intrctl/intrctl.8
--- a/usr.sbin/intrctl/intrctl.8 Mon Sep 23 08:50:52 2019 +0000
+++ b/usr.sbin/intrctl/intrctl.8 Mon Sep 23 09:17:19 2019 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: intrctl.8,v 1.4 2016/10/15 12:06:27 jdolecek Exp $
+.\" $NetBSD: intrctl.8,v 1.5 2019/09/23 09:17:19 mrg Exp $
.\"
.\" Copyright (c) 2015 Internet Initiative Japan Inc.
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd October 15, 2016
+.Dd September 22, 2019
.Dt INTRCTL 8
.Os
.Sh NAME
@@ -56,7 +56,7 @@
If
.Ar cpu_index
is already enabled, this command has no effect.
-.It list Op Fl c
+.It list Oo Fl c Oc Op Fl w Ar wait
for each intrid in the system, display interrupt counts per CPU.
The intrid is an interrupt name such as "ioapic0 pin 22" for x86.
.Pp
@@ -64,6 +64,14 @@
.Fl c
is specified, display compact list with total counts per interrupt,
and CPU affinity as comma separated list of CPU indexes.
+.Pp
+If
+.Fl w
+is specified then
+.Nm
+display the data continuously with a
+.Ar wait
+seconds delay between each iteration.
.It nointr Fl c Ar cpu_index
disable to set an interrupt's affinity to
.Ar cpu_index .
diff -r d53676294977 -r bc3c5285cd70 usr.sbin/intrctl/intrctl.c
--- a/usr.sbin/intrctl/intrctl.c Mon Sep 23 08:50:52 2019 +0000
+++ b/usr.sbin/intrctl/intrctl.c Mon Sep 23 09:17:19 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intrctl.c,v 1.8 2018/06/22 22:50:53 jdolecek Exp $ */
+/* $NetBSD: intrctl.c,v 1.9 2019/09/23 09:17:19 mrg Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: intrctl.c,v 1.8 2018/06/22 22:50:53 jdolecek Exp $");
+__RCSID("$NetBSD: intrctl.c,v 1.9 2019/09/23 09:17:19 mrg Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -99,7 +99,7 @@
{
const char *progname = getprogname();
- fprintf(stderr, "usage: %s list [-c]\n", progname);
+ fprintf(stderr, "usage: %s list [-c] [-w secs]\n", progname);
fprintf(stderr, " %s affinity -i interrupt_name -c cpu_index\n", progname);
fprintf(stderr, " %s intr -c cpu_index\n", progname);
fprintf(stderr, " %s nointr -c cpu_index\n", progname);
@@ -110,25 +110,13 @@
static int intrctl_io_alloc_retry_count = 4;
static void
-intrctl_list(int argc, char **argv)
+intrctl_list_one(int compact)
{
char buf[64];
struct intrio_list_line *illine;
int i, ncpus, *cpucol;
void *handle;
size_t intridlen;
- int compact = 0;
- int ch;
-
- while ((ch = getopt(argc, argv, "c")) != -1) {
- switch (ch) {
- case 'c':
- compact = 1;
- break;
- default:
- usage();
- }
- }
handle = intrctl_io_alloc(intrctl_io_alloc_retry_count);
if (handle == NULL)
@@ -217,6 +205,34 @@
}
static void
+intrctl_list(int argc, char **argv)
+{
+ int seconds = 0;
+ bool compact = false;
+ int ch;
+
+ while ((ch = getopt(argc, argv, "cw:")) != -1) {
+ switch (ch) {
+ case 'c':
+ compact = true;
+ break;
+ case 'w':
+ seconds = atoi(optarg);
+ if (seconds < 0)
+ errx(1, "seconds must be positive.");
+ break;
+ default:
+ usage();
+ }
+ }
+
+ do {
+ intrctl_list_one(compact);
+ sleep(seconds);
+ } while (seconds);
+}
+
+static void
intrctl_affinity(int argc, char **argv)
{
struct intrio_set iset;
diff -r d53676294977 -r bc3c5285cd70 usr.sbin/intrctl/intrctl_io.c
--- a/usr.sbin/intrctl/intrctl_io.c Mon Sep 23 08:50:52 2019 +0000
+++ b/usr.sbin/intrctl/intrctl_io.c Mon Sep 23 09:17:19 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intrctl_io.c,v 1.4 2018/06/23 11:11:00 jdolecek Exp $ */
+/* $NetBSD: intrctl_io.c,v 1.5 2019/09/23 09:17:19 mrg Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: intrctl_io.c,v 1.4 2018/06/23 11:11:00 jdolecek Exp $");
+__RCSID("$NetBSD: intrctl_io.c,v 1.5 2019/09/23 09:17:19 mrg Exp $");
#include <sys/sysctl.h>
#include <sys/intrio.h>
@@ -76,8 +76,7 @@
}
}
error:
- if (buf != NULL)
- free(buf);
+ free(buf);
return NULL;
}
Home |
Main Index |
Thread Index |
Old Index