diff options
author | 2018-06-22 14:22:06 +0000 | |
---|---|---|
committer | 2018-06-22 14:22:06 +0000 | |
commit | 01c05ce200db2a98d090608d05698dfbbf7d97f5 (patch) | |
tree | a7aa17c7c3b846cf3a2e2d9e10ae61759d4a6863 | |
parent | special case for a tag in self, which should be run appropriately during (diff) | |
download | wireguard-openbsd-01c05ce200db2a98d090608d05698dfbbf7d97f5.tar.xz wireguard-openbsd-01c05ce200db2a98d090608d05698dfbbf7d97f5.zip |
Constrain IPKTS/OPKTS from floating down beyond the rest of the
displayed lines. Makes vmstat view in tall windows easier to read.
ok sthen@
-rw-r--r-- | usr.bin/systat/systat.1 | 8 | ||||
-rw-r--r-- | usr.bin/systat/vmstat.c | 43 |
2 files changed, 28 insertions, 23 deletions
diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1 index 1680e1a6522..30f76466acb 100644 --- a/usr.bin/systat/systat.1 +++ b/usr.bin/systat/systat.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: systat.1,v 1.107 2018/06/19 22:35:07 krw Exp $ +.\" $OpenBSD: systat.1,v 1.108 2018/06/22 14:22:06 krw 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: June 19 2018 $ +.Dd $Mdocdate: June 22 2018 $ .Dt SYSTAT 1 .Os .Sh NAME @@ -561,9 +561,9 @@ wired pages pages daemon freed since boot .It pdscn pages daemon scanned since boot -.It pzidle +.It pzidl number of zeroed pages -.It kmapent +.It kmape number of kernel map entries .El .It Ic uvm diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 9b4ab1ecdfc..53922d90196 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmstat.c,v 1.85 2018/05/19 13:24:10 bluhm Exp $ */ +/* $OpenBSD: vmstat.c,v 1.86 2018/06/22 14:22:06 krw Exp $ */ /* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */ /*- @@ -57,6 +57,7 @@ #include "dkstats.h" #define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) static struct Info { long time[CPUSTATES]; @@ -99,7 +100,7 @@ static float hertz; static int nintr; static long *intrloc; static char **intrname; -static int nextintsrow; +static int ipktsrow; WINDOW * openkre(void) @@ -199,7 +200,6 @@ initvmstat(void) return (-1); } - nextintsrow = INTSROW + 2; allocinfo(&s); allocinfo(&s1); allocinfo(&s2); @@ -239,8 +239,19 @@ labelkre(void) mvprintw(INTSROW, INTSCOL + 3, " Interrupts"); mvprintw(INTSROW + 1, INTSCOL + 9, "total"); - mvprintw(LINES - 3, INTSCOL + 9, "IPKTS"); - mvprintw(LINES - 2, INTSCOL + 9, "OPKTS"); + j = INTSROW + 2; + for (i = 0; i < nintr; i++) { + intrloc[i] = 0; + if (s.intrcnt[i] == 0 || ipktsrow == LINES) + continue; + intrloc[i] = j++; + mvprintw(intrloc[i], INTSCOL + 9, "%-8.8s", intrname[i]); + } + ipktsrow = MAXIMUM(j, MINIMUM(LINES - 3, VMSTATROW + 17)); + if (LINES - 1 > ipktsrow) + mvprintw(ipktsrow, INTSCOL + 9, "IPKTS"); + if (LINES - 1 > ipktsrow + 1) + mvprintw(ipktsrow + 1, INTSCOL + 9, "OPKTS"); mvprintw(VMSTATROW + 0, VMSTATCOL + 10, "forks"); mvprintw(VMSTATROW + 1, VMSTATCOL + 10, "fkppw"); @@ -261,9 +272,9 @@ labelkre(void) if (LINES - 1 > VMSTATROW + 16) mvprintw(VMSTATROW + 16, VMSTATCOL + 10, "pdscn"); if (LINES - 1 > VMSTATROW + 17) - mvprintw(VMSTATROW + 17, VMSTATCOL + 10, "pzidle"); + mvprintw(VMSTATROW + 17, VMSTATCOL + 10, "pzidl"); if (LINES - 1 > VMSTATROW + 18) - mvprintw(VMSTATROW + 18, VMSTATCOL + 10, "kmapent"); + mvprintw(VMSTATROW + 18, VMSTATCOL + 10, "kmape"); mvprintw(GENSTATROW, GENSTATCOL, " Csw Trp Sys Int Sof Flt"); @@ -340,20 +351,12 @@ showkre(void) etime /= hertz; inttotal = 0; for (i = 0; i < nintr; i++) { - if (s.intrcnt[i] == 0) - continue; - if (intrloc[i] == 0) { - if (nextintsrow == LINES) - continue; - intrloc[i] = nextintsrow++; - mvprintw(intrloc[i], INTSCOL + 9, "%-8.8s", - intrname[i]); - } t = intcnt = s.intrcnt[i]; s.intrcnt[i] -= s1.intrcnt[i]; intcnt = (u_int64_t)((float)s.intrcnt[i]/etime + 0.5); inttotal += intcnt; - putuint64(intcnt, intrloc[i], INTSCOL, 8); + if (intrloc[i] != 0) + putuint64(intcnt, intrloc[i], INTSCOL, 8); } putuint64(inttotal, INTSROW + 1, INTSCOL, 8); Z(ncs_goodhits); Z(ncs_badhits); Z(ncs_miss); @@ -361,8 +364,10 @@ showkre(void) s.nchcount = nchtotal.ncs_goodhits + nchtotal.ncs_badhits + nchtotal.ncs_miss + nchtotal.ncs_long; - putint(sum.ifc_ip, LINES - 3, INTSCOL, 8); - putint(sum.ifc_op, LINES - 2, INTSCOL, 8); + if (LINES - 1 > ipktsrow) + putint(sum.ifc_ip, ipktsrow, INTSCOL, 8); + if (LINES - 1 > ipktsrow + 1) + putint(sum.ifc_op, ipktsrow + 1, INTSCOL, 8); psiz = 0; f2 = 0.0; |