8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
33 * This file is part of the lwIP TCP/IP stack.
35 * Author: Adam Dunkels <adam@sics.se>
41 #if LWIP_STATS /* don't build if not configured for use in lwipopts.h */
44 #include "lwip/stats.h"
46 #include "lwip/debug.h"
50 struct stats_ lwip_stats
;
57 lwip_stats
.mem
.name
= "MEM";
58 #endif /* MEM_STATS */
59 #endif /* LWIP_DEBUG */
62 #if LWIP_STATS_DISPLAY
64 stats_display_proto(struct stats_proto
*proto
, const char *name
)
66 LWIP_PLATFORM_DIAG(("\n%s\n\t", name
));
67 LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F
"\n\t", proto
->xmit
));
68 LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F
"\n\t", proto
->recv
));
69 LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F
"\n\t", proto
->fw
));
70 LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F
"\n\t", proto
->drop
));
71 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F
"\n\t", proto
->chkerr
));
72 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F
"\n\t", proto
->lenerr
));
73 LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F
"\n\t", proto
->memerr
));
74 LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F
"\n\t", proto
->rterr
));
75 LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F
"\n\t", proto
->proterr
));
76 LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F
"\n\t", proto
->opterr
));
77 LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F
"\n\t", proto
->err
));
78 LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F
"\n", proto
->cachehit
));
81 #if IGMP_STATS || MLD6_STATS
83 stats_display_igmp(struct stats_igmp
*igmp
, const char *name
)
85 LWIP_PLATFORM_DIAG(("\n%s\n\t", name
));
86 LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F
"\n\t", igmp
->xmit
));
87 LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F
"\n\t", igmp
->recv
));
88 LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F
"\n\t", igmp
->drop
));
89 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F
"\n\t", igmp
->chkerr
));
90 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F
"\n\t", igmp
->lenerr
));
91 LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F
"\n\t", igmp
->memerr
));
92 LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F
"\n\t", igmp
->proterr
));
93 LWIP_PLATFORM_DIAG(("rx_v1: %"STAT_COUNTER_F
"\n\t", igmp
->rx_v1
));
94 LWIP_PLATFORM_DIAG(("rx_group: %"STAT_COUNTER_F
"\n\t", igmp
->rx_group
));
95 LWIP_PLATFORM_DIAG(("rx_general: %"STAT_COUNTER_F
"\n\t", igmp
->rx_general
));
96 LWIP_PLATFORM_DIAG(("rx_report: %"STAT_COUNTER_F
"\n\t", igmp
->rx_report
));
97 LWIP_PLATFORM_DIAG(("tx_join: %"STAT_COUNTER_F
"\n\t", igmp
->tx_join
));
98 LWIP_PLATFORM_DIAG(("tx_leave: %"STAT_COUNTER_F
"\n\t", igmp
->tx_leave
));
99 LWIP_PLATFORM_DIAG(("tx_report: %"STAT_COUNTER_F
"\n", igmp
->tx_report
));
101 #endif /* IGMP_STATS || MLD6_STATS */
103 #if MEM_STATS || MEMP_STATS
105 stats_display_mem(struct stats_mem
*mem
, const char *name
)
107 LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name
));
108 LWIP_PLATFORM_DIAG(("avail: %"U32_F
"\n\t", (u32_t
)mem
->avail
));
109 LWIP_PLATFORM_DIAG(("used: %"U32_F
"\n\t", (u32_t
)mem
->used
));
110 LWIP_PLATFORM_DIAG(("max: %"U32_F
"\n\t", (u32_t
)mem
->max
));
111 LWIP_PLATFORM_DIAG(("err: %"U32_F
"\n", (u32_t
)mem
->err
));
116 stats_display_memp(struct stats_mem
*mem
, int idx
)
118 if (idx
< MEMP_MAX
) {
119 stats_display_mem(mem
, mem
->name
);
122 #endif /* MEMP_STATS */
123 #endif /* MEM_STATS || MEMP_STATS */
127 stats_display_sys(struct stats_sys
*sys
)
129 LWIP_PLATFORM_DIAG(("\nSYS\n\t"));
130 LWIP_PLATFORM_DIAG(("sem.used: %"U32_F
"\n\t", (u32_t
)sys
->sem
.used
));
131 LWIP_PLATFORM_DIAG(("sem.max: %"U32_F
"\n\t", (u32_t
)sys
->sem
.max
));
132 LWIP_PLATFORM_DIAG(("sem.err: %"U32_F
"\n\t", (u32_t
)sys
->sem
.err
));
133 LWIP_PLATFORM_DIAG(("mutex.used: %"U32_F
"\n\t", (u32_t
)sys
->mutex
.used
));
134 LWIP_PLATFORM_DIAG(("mutex.max: %"U32_F
"\n\t", (u32_t
)sys
->mutex
.max
));
135 LWIP_PLATFORM_DIAG(("mutex.err: %"U32_F
"\n\t", (u32_t
)sys
->mutex
.err
));
136 LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F
"\n\t", (u32_t
)sys
->mbox
.used
));
137 LWIP_PLATFORM_DIAG(("mbox.max: %"U32_F
"\n\t", (u32_t
)sys
->mbox
.max
));
138 LWIP_PLATFORM_DIAG(("mbox.err: %"U32_F
"\n", (u32_t
)sys
->mbox
.err
));
140 #endif /* SYS_STATS */
147 LINK_STATS_DISPLAY();
148 ETHARP_STATS_DISPLAY();
149 IPFRAG_STATS_DISPLAY();
150 IP6_FRAG_STATS_DISPLAY();
154 IGMP_STATS_DISPLAY();
155 MLD6_STATS_DISPLAY();
156 ICMP_STATS_DISPLAY();
157 ICMP6_STATS_DISPLAY();
161 for (i
= 0; i
< MEMP_MAX
; i
++) {
162 MEMP_STATS_DISPLAY(i
);
166 #endif /* LWIP_STATS_DISPLAY */
168 #endif /* LWIP_STATS */