17908Ssam #ifndef lint 2*9576Ssam static char sccsid[] = "@(#)mbuf.c 4.3 82/12/06"; 37908Ssam #endif 47908Ssam 59568Ssam #include <sys/param.h> 67908Ssam #include <sys/mbuf.h> 77908Ssam 87908Ssam struct mbstat mbstat; 97908Ssam extern int kmem; 107908Ssam 117908Ssam /* 127908Ssam * Print mbuf statistics. 137908Ssam */ 147908Ssam mbpr(mbaddr) 157908Ssam off_t mbaddr; 167908Ssam { 179568Ssam register int totmem, totfree; 189568Ssam 197908Ssam if (mbaddr == 0) { 207908Ssam printf("mbstat: symbol not in namelist\n"); 217908Ssam return; 227908Ssam } 239568Ssam printf("memory utilization:\n"); 247908Ssam klseek(kmem, mbaddr, 0); 259568Ssam if (read(kmem, &mbstat, sizeof (mbstat)) != sizeof (mbstat)) { 269568Ssam printf("mbstat: bad read\n"); 279568Ssam return; 289568Ssam } 299568Ssam printf("\t%d/%d mbufs in use\n", mbstat.m_mbufs - mbstat.m_mbfree, 309568Ssam mbstat.m_mbufs); 319568Ssam printf("\t%d/%d mapped pages in use\n", 329568Ssam mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters); 339568Ssam printf("\t%d requests for memory denied\n", mbstat.m_drops); 349568Ssam totmem = mbstat.m_mbufs * MSIZE + mbstat.m_clusters * CLBYTES; 359568Ssam totfree = mbstat.m_mbfree * MSIZE + mbstat.m_clusters * CLBYTES; 369568Ssam printf("\t%dKbytes allocated to network (%d%% in use)\n", 37*9576Ssam totmem / 1024, (totmem - totfree) * 100 / totmem); 387908Ssam } 39