summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2010-11-05 10:07:30 +0000
committerclaudio <claudio@openbsd.org>2010-11-05 10:07:30 +0000
commitd9fba85215e9152f1b4222e10dc82055e93688c1 (patch)
tree4a9a044c966e82dd023f21ea67be5a1be7ff0e04
parentPrint the daemon name _before_ starting the corresponding rc script. (diff)
downloadwireguard-openbsd-d9fba85215e9152f1b4222e10dc82055e93688c1.tar.xz
wireguard-openbsd-d9fba85215e9152f1b4222e10dc82055e93688c1.zip
Print relativ number of livelocks that happend between two systat
updates instead of showing absolut figures. Makes it easier to estimate the "livelockyness" of a system. OK dlg@
-rw-r--r--usr.bin/systat/mbufs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c
index cf489e68e24..154e0c92992 100644
--- a/usr.bin/systat/mbufs.c
+++ b/usr.bin/systat/mbufs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbufs.c,v 1.30 2010/11/02 10:24:34 dlg Exp $ */
+/* $OpenBSD: mbufs.c,v 1.31 2010/11/05 10:07:30 claudio Exp $ */
/*
* Copyright (c) 2008 Can Erkin Acar <canacar@openbsd.org>
*
@@ -41,7 +41,7 @@ struct mclpool_info {
int mclpool_count = 0;
int mbpool_index = -1;
struct pool mbpool;
-u_int mcllivelocks = 0;
+u_int mcllivelocks, mcllivelocks_cur, mcllivelocks_diff;
/* interfaces */
static int num_ifs;
@@ -201,12 +201,14 @@ read_mb(void)
mib[0] = CTL_KERN;
mib[1] = KERN_NETLIVELOCKS;
- size = sizeof(mcllivelocks);
- if (sysctl(mib, 2, &mcllivelocks, &size, NULL, 0) < 0 &&
+ size = sizeof(mcllivelocks_cur);
+ if (sysctl(mib, 2, &mcllivelocks_cur, &size, NULL, 0) < 0 &&
errno != EOPNOTSUPP) {
error("sysctl(KERN_NETLIVELOCKS)");
goto exit;
}
+ mcllivelocks_diff = mcllivelocks_cur - mcllivelocks;
+ mcllivelocks = mcllivelocks_cur;
num_disp = 0;
if (getifaddrs(&ifap)) {
@@ -351,7 +353,7 @@ showmbuf(struct if_info *ifi, int p, int showif)
print_fld_str(FLD_MB_IFACE, ifi->name);
if (p == -1 && ifi == interfaces) {
- print_fld_uint(FLD_MB_LLOCKS, mcllivelocks);
+ print_fld_uint(FLD_MB_LLOCKS, mcllivelocks_diff);
print_fld_size(FLD_MB_MSIZE, mbpool.pr_size);
print_fld_size(FLD_MB_MALIVE, mbpool.pr_nget - mbpool.pr_nput);
print_fld_size(FLD_MB_MHWM, mbpool.pr_hiwat);