Commit | Line | Data |
---|---|---|
bad4305f | 1 | #ifndef lint |
c02627d4 | 2 | static char sccsid[] = "@(#)mbuf.c 4.5 82/12/18"; |
bad4305f SL |
3 | #endif |
4 | ||
24bf5f10 | 5 | #include <sys/param.h> |
bad4305f SL |
6 | #include <sys/mbuf.h> |
7 | ||
8 | struct mbstat mbstat; | |
9 | extern int kmem; | |
10 | ||
11 | /* | |
12 | * Print mbuf statistics. | |
13 | */ | |
14 | mbpr(mbaddr) | |
15 | off_t mbaddr; | |
16 | { | |
24bf5f10 SL |
17 | register int totmem, totfree; |
18 | ||
bad4305f SL |
19 | if (mbaddr == 0) { |
20 | printf("mbstat: symbol not in namelist\n"); | |
21 | return; | |
22 | } | |
bad4305f | 23 | klseek(kmem, mbaddr, 0); |
24bf5f10 SL |
24 | if (read(kmem, &mbstat, sizeof (mbstat)) != sizeof (mbstat)) { |
25 | printf("mbstat: bad read\n"); | |
26 | return; | |
27 | } | |
84f2241b | 28 | printf("%d/%d mbufs in use\n", mbstat.m_mbufs - mbstat.m_mbfree, |
24bf5f10 | 29 | mbstat.m_mbufs); |
84f2241b | 30 | printf("%d/%d mapped pages in use\n", |
24bf5f10 | 31 | mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters); |
84f2241b | 32 | printf("%d requests for memory denied\n", mbstat.m_drops); |
24bf5f10 SL |
33 | totmem = mbstat.m_mbufs * MSIZE + mbstat.m_clusters * CLBYTES; |
34 | totfree = mbstat.m_mbfree * MSIZE + mbstat.m_clusters * CLBYTES; | |
84f2241b | 35 | printf("%dKbytes allocated to network (%d%% in use)\n", |
c1567c4d | 36 | totmem / 1024, (totmem - totfree) * 100 / totmem); |
bad4305f | 37 | } |