summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1998-04-24 04:30:27 +0000
committerdg <dg@FreeBSD.org>1998-04-24 04:30:27 +0000
commitabb0f6fda9e4fd0855dbe32688b31270fcbf0099 (patch)
treef9e7f5a5a96b9bcdcd28fda821c22092cf41e841 /usr.bin
parent3253b48e391f133111f605d69a39163dd0714764 (diff)
downloadFreeBSD-src-abb0f6fda9e4fd0855dbe32688b31270fcbf0099.zip
FreeBSD-src-abb0f6fda9e4fd0855dbe32688b31270fcbf0099.tar.gz
Output mbuf clusters as current/peak/max. Requires new kern.ipc.nmbclusters
sysctl variable (previously committed).
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/mbuf.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
index f794500..b0b9a4c 100644
--- a/usr.bin/netstat/mbuf.c
+++ b/usr.bin/netstat/mbuf.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mbuf.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id: mbuf.c,v 1.8 1997/08/17 09:12:43 peter Exp $";
+ "$Id: mbuf.c,v 1.9 1997/11/10 08:03:36 ache Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -100,18 +100,24 @@ mbpr(mbaddr)
register int totmem, totfree, totmbufs;
register int i;
register struct mbtypes *mp;
- int name[3];
+ int name[3], nmbclusters, nmbclen;
size_t mbstatlen;
name[0] = CTL_KERN;
name[1] = KERN_IPC;
name[2] = KIPC_MBSTAT;
mbstatlen = sizeof mbstat;
-
if (sysctl(name, 3, &mbstat, &mbstatlen, 0, 0) < 0) {
warn("sysctl: retrieving mbstat");
return;
}
+
+ name[2] = KIPC_NMBCLUSTERS;
+ nmbclen = sizeof(int);
+ if (sysctl(name, 3, &nmbclusters, &nmbclen, 0, 0) < 0) {
+ warn("sysctl: retrieving nmbclusters");
+ return;
+ }
#undef MSIZE
#define MSIZE (mbstat.m_msize)
#undef MCLBYTES
@@ -138,8 +144,8 @@ mbpr(mbaddr)
printf("\t%u mbufs allocated to <mbuf type %d>\n",
mbstat.m_mtypes[i], i);
}
- printf("%lu/%lu mbuf clusters in use\n",
- mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters);
+ printf("%lu/%lu/%lu mbuf clusters in use (current/peak/max)\n",
+ mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters, nmbclusters);
totmem = mbstat.m_mbufs * MSIZE + mbstat.m_clusters * MCLBYTES;
totfree = mbstat.m_clfree * MCLBYTES +
MSIZE * (mbstat.m_mbufs - totmbufs);
OpenPOWER on IntegriCloud