summaryrefslogtreecommitdiff
path: root/usr.bin/systat
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-08-14 08:10:31 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-08-14 08:10:31 +0000
commitd59dc5cdce338260f0577b0f2e4aef2518cd2d4f (patch)
tree65b292d8082a676c6d3c4c876bf0981b4b00730b /usr.bin/systat
parent94d1d797cc01353b29b7ba7995c6ad7bab63c878 (diff)
Show only active pools by default, pressing 'A' shows all of them.
ok deraadt@
Diffstat (limited to 'usr.bin/systat')
-rw-r--r--usr.bin/systat/pool.c29
-rw-r--r--usr.bin/systat/systat.18
2 files changed, 32 insertions, 5 deletions
diff --git a/usr.bin/systat/pool.c b/usr.bin/systat/pool.c
index f06bb127756..3db6c6cae3a 100644
--- a/usr.bin/systat/pool.c
+++ b/usr.bin/systat/pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pool.c,v 1.7 2014/07/02 00:12:34 dlg Exp $ */
+/* $OpenBSD: pool.c,v 1.8 2014/08/14 08:10:30 mpi Exp $ */
/*
* Copyright (c) 2008 Can Erkin Acar <canacar@openbsd.org>
*
@@ -30,6 +30,7 @@ int read_pool(void);
void sort_pool(void);
int select_pool(void);
void showpool(int k);
+int pool_keyboard_callback(int);
/* qsort callbacks */
int sort_name_callback(const void *s1, const void *s2);
@@ -43,6 +44,7 @@ struct pool_info {
};
+int print_all = 0;
int num_pools = 0;
struct pool_info *pools = NULL;
@@ -94,7 +96,7 @@ order_type pool_order_list[] = {
/* Define view managers */
struct view_manager pool_mgr = {
"Pool", select_pool, read_pool, sort_pool, print_header,
- print_pool, keyboard_callback, pool_order_list, pool_order_list
+ print_pool, pool_keyboard_callback, pool_order_list, pool_order_list
};
field_view views_pool[] = {
@@ -257,14 +259,21 @@ read_pool(void)
void
print_pool(void)
{
+ struct pool_info *p;
int i, n, count = 0;
if (pools == NULL)
return;
for (n = i = 0; i < num_pools; i++) {
- if (pools[i].name[0] == 0)
+ p = &pools[i];
+ if (p->name[0] == 0)
continue;
+
+ if (!print_all &&
+ (p->pool.pr_nget == 0 && p->pool.pr_npagealloc == 0))
+ continue;
+
if (n++ < dispstart)
continue;
showpool(i);
@@ -317,3 +326,17 @@ showpool(int k)
end_line();
}
+
+int
+pool_keyboard_callback(int ch)
+{
+ switch (ch) {
+ case 'A':
+ print_all ^= 1;
+ gotsig_alarm = 1;
+ default:
+ return keyboard_callback(ch);
+ };
+
+ return (1);
+}
diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
index f5b170a27d9..1c4e16a42f3 100644
--- a/usr.bin/systat/systat.1
+++ b/usr.bin/systat/systat.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: systat.1,v 1.97 2013/11/01 10:40:15 henning Exp $
+.\" $OpenBSD: systat.1,v 1.98 2014/08/14 08:10:30 mpi Exp $
.\" $NetBSD: systat.1,v 1.6 1996/05/10 23:16:39 thorpej Exp $
.\"
.\" Copyright (c) 1985, 1990, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)systat.1 8.2 (Berkeley) 12/30/93
.\"
-.Dd $Mdocdate: November 1 2013 $
+.Dd $Mdocdate: August 14 2014 $
.Dt SYSTAT 1
.Os
.Sh NAME
@@ -375,6 +375,10 @@ Available orderings are:
.Ic size ,
and
.Ic number of pages .
+.Pp
+By default only the statistics of active pools are displayed but pressing
+.Ic A
+changes the view to show all of them.
.It Ic queues
Display statistics about the active queues,
similar to the output of