source: rtems/cpukit/libnetworking/rtems/rtems_showmbuf.c @ 4aa8a23

4.104.114.84.95
Last change on this file since 4aa8a23 was 4aa8a23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/02/05 at 03:06:41

Include config.h.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  $Id$
3 */
4
5#if HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <sys/param.h>
10#include <sys/queue.h>
11#include <sys/systm.h>
12#include <sys/kernel.h>
13#include <sys/sysctl.h>
14#include <sys/proc.h>
15#include <sys/mbuf.h>
16
17/*
18 * Display MBUF statistics
19 * Don't lock the rest of the network tasks out while printing.
20 * It's no big deal if the values change while being printed.
21 */
22void
23rtems_bsdnet_show_mbuf_stats (void)
24{
25        int i;
26        int printed = 0;
27        char *cp;
28
29        printf ("************ MBUF STATISTICS ************\n");
30        printf ("mbufs:%4lu    clusters:%4lu    free:%4lu\n",
31                        mbstat.m_mbufs, mbstat.m_clusters, mbstat.m_clfree);
32        printf ("drops:%4lu       waits:%4lu  drains:%4lu\n",
33                        mbstat.m_drops, mbstat.m_wait, mbstat.m_drain);
34        for (i = 0 ; i < 20 ; i++) {
35                switch (i) {
36                case MT_FREE:           cp = "free";            break;
37                case MT_DATA:           cp = "data";            break;
38                case MT_HEADER:         cp = "header";          break;
39                case MT_SOCKET:         cp = "socket";          break;
40                case MT_PCB:            cp = "pcb";             break;
41                case MT_RTABLE:         cp = "rtable";          break;
42                case MT_HTABLE:         cp = "htable";          break;
43                case MT_ATABLE:         cp = "atable";          break;
44                case MT_SONAME:         cp = "soname";          break;
45                case MT_SOOPTS:         cp = "soopts";          break;
46                case MT_FTABLE:         cp = "ftable";          break;
47                case MT_RIGHTS:         cp = "rights";          break;
48                case MT_IFADDR:         cp = "ifaddr";          break;
49                case MT_CONTROL:        cp = "control";         break;
50                case MT_OOBDATA:        cp = "oobdata";         break;
51                default:                cp = NULL;              break;
52                }
53                if ((cp != NULL) || (mbstat.m_mtypes[i] != 0)) {
54                        char cbuf[16];
55                        if (cp == NULL) {
56                                sprintf (cbuf, "Type %d", i);
57                                cp = cbuf;
58                        }
59                        printf ("%10s:%-8u", cp, mbstat.m_mtypes[i]);
60                        if (++printed == 4) {
61                                printf ("\n");
62                                printed = 0;
63                        }
64                }
65        }
66        if (printed)
67                printf ("\n");
68        printf ("\n");
69}
Note: See TracBrowser for help on using the repository browser.