OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libnetworking/] [rtems/] [rtems_showmbuf.c] - Blame information for rev 507

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.