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"
49 struct stats_ lwip_stats;
51 #if LWIP_STATS_DISPLAY
53 stats_display_proto(struct stats_proto *proto, char *name)
55 LWIP_PLATFORM_DIAG(("%s", name));
56 LWIP_PLATFORM_DIAG((" xmit: %"STAT_COUNTER_F, proto->xmit));
57 LWIP_PLATFORM_DIAG((" rexmit: %"STAT_COUNTER_F, proto->rexmit));
58 LWIP_PLATFORM_DIAG((" recv: %"STAT_COUNTER_F, proto->recv));
59 LWIP_PLATFORM_DIAG((" fw: %"STAT_COUNTER_F, proto->fw));
60 LWIP_PLATFORM_DIAG((" drop: %"STAT_COUNTER_F, proto->drop));
61 LWIP_PLATFORM_DIAG((" chkerr: %"STAT_COUNTER_F, proto->chkerr));
62 LWIP_PLATFORM_DIAG((" lenerr: %"STAT_COUNTER_F, proto->lenerr));
63 LWIP_PLATFORM_DIAG((" memerr: %"STAT_COUNTER_F, proto->memerr));
64 LWIP_PLATFORM_DIAG((" rterr: %"STAT_COUNTER_F, proto->rterr));
65 LWIP_PLATFORM_DIAG((" proterr: %"STAT_COUNTER_F, proto->proterr));
66 LWIP_PLATFORM_DIAG((" opterr: %"STAT_COUNTER_F, proto->opterr));
67 LWIP_PLATFORM_DIAG((" err: %"STAT_COUNTER_F, proto->err));
68 LWIP_PLATFORM_DIAG((" cachehit: %"STAT_COUNTER_F, proto->cachehit));
72 stats_display_igmp(struct stats_igmp *igmp)
74 LWIP_PLATFORM_DIAG(("IGMP"));
75 LWIP_PLATFORM_DIAG((" lenerr: %"STAT_COUNTER_F, igmp->lenerr));
76 LWIP_PLATFORM_DIAG((" chkerr: %"STAT_COUNTER_F, igmp->chkerr));
77 LWIP_PLATFORM_DIAG((" v1_rxed: %"STAT_COUNTER_F, igmp->v1_rxed));
78 LWIP_PLATFORM_DIAG((" join_sent: %"STAT_COUNTER_F, igmp->join_sent));
79 LWIP_PLATFORM_DIAG((" leave_sent: %"STAT_COUNTER_F, igmp->leave_sent));
80 LWIP_PLATFORM_DIAG((" unicast_query: %"STAT_COUNTER_F, igmp->unicast_query));
81 LWIP_PLATFORM_DIAG((" report_sent: %"STAT_COUNTER_F, igmp->report_sent));
82 LWIP_PLATFORM_DIAG((" report_rxed: %"STAT_COUNTER_F, igmp->report_rxed));
83 LWIP_PLATFORM_DIAG((" group_query_rxed: %"STAT_COUNTER_F, igmp->group_query_rxed));
87 stats_display_mem(struct stats_mem *mem, char *name)
89 LWIP_PLATFORM_DIAG(("MEM %s", name));
90 LWIP_PLATFORM_DIAG((" avail: %"U32_F, (u32_t)mem->avail));
91 LWIP_PLATFORM_DIAG((" used: %"U32_F, (u32_t)mem->used));
92 LWIP_PLATFORM_DIAG((" max: %"U32_F, (u32_t)mem->max));
93 LWIP_PLATFORM_DIAG((" err: %"U32_F, (u32_t)mem->err));
101 char * memp_names[] = {
102 #define LWIP_MEMPOOL(name,num,size,desc) desc,
103 #include "lwip/memp_std.h"
107 stats_display_proto(&lwip_stats.link, "LINK");
110 stats_display_proto(&lwip_stats.etharp, "ETHARP");
113 stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG");
116 stats_display_proto(&lwip_stats.ip, "IP");
119 stats_display_proto(&lwip_stats.icmp, "ICMP");
122 stats_display_igmp(&lwip_stats.igmp);
125 stats_display_proto(&lwip_stats.udp, "UDP");
128 stats_display_proto(&lwip_stats.tcp, "TCP");
131 stats_display_mem(&lwip_stats.mem, "HEAP");
134 for (i = 0; i < MEMP_MAX; i++) {
135 stats_display_mem(&lwip_stats.memp[i], memp_names[i]);
139 #endif /* LWIP_STATS_DISPLAY */
141 #endif /* LWIP_STATS */