A version of LWIP, provided for backwards compatibility.
Dependents: AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more
stats.c
00001 /** 00002 * @file 00003 * Statistics module 00004 * 00005 */ 00006 00007 /* 00008 * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 00009 * All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without modification, 00012 * are permitted provided that the following conditions are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * 3. The name of the author may not be used to endorse or promote products 00020 * derived from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00023 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00024 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00025 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00026 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00027 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00028 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00029 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00030 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00031 * OF SUCH DAMAGE. 00032 * 00033 * This file is part of the lwIP TCP/IP stack. 00034 * 00035 * Author: Adam Dunkels <adam@sics.se> 00036 * 00037 */ 00038 00039 #include "lwip/opt.h" 00040 00041 #if LWIP_STATS /* don't build if not configured for use in lwipopts.h */ 00042 00043 #include "lwip/def.h" 00044 #include "lwip/stats.h" 00045 #include "lwip/mem.h" 00046 00047 #include <string.h> 00048 00049 struct stats_ lwip_stats; 00050 00051 #if LWIP_STATS_DISPLAY 00052 void 00053 stats_display_proto(struct stats_proto *proto, char *name) 00054 { 00055 LWIP_PLATFORM_DIAG(("\n%s\n\t", name)); 00056 LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit)); 00057 LWIP_PLATFORM_DIAG(("rexmit: %"STAT_COUNTER_F"\n\t", proto->rexmit)); 00058 LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv)); 00059 LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw)); 00060 LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop)); 00061 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", proto->chkerr)); 00062 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", proto->lenerr)); 00063 LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", proto->memerr)); 00064 LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F"\n\t", proto->rterr)); 00065 LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", proto->proterr)); 00066 LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F"\n\t", proto->opterr)); 00067 LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n\t", proto->err)); 00068 LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit)); 00069 } 00070 00071 void 00072 stats_display_igmp(struct stats_igmp *igmp) 00073 { 00074 LWIP_PLATFORM_DIAG(("\nIGMP\n\t")); 00075 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", igmp->lenerr)); 00076 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", igmp->chkerr)); 00077 LWIP_PLATFORM_DIAG(("v1_rxed: %"STAT_COUNTER_F"\n\t", igmp->v1_rxed)); 00078 LWIP_PLATFORM_DIAG(("join_sent: %"STAT_COUNTER_F"\n\t", igmp->join_sent)); 00079 LWIP_PLATFORM_DIAG(("leave_sent: %"STAT_COUNTER_F"\n\t", igmp->leave_sent)); 00080 LWIP_PLATFORM_DIAG(("unicast_query: %"STAT_COUNTER_F"\n\t", igmp->unicast_query)); 00081 LWIP_PLATFORM_DIAG(("report_sent: %"STAT_COUNTER_F"\n\t", igmp->report_sent)); 00082 LWIP_PLATFORM_DIAG(("report_rxed: %"STAT_COUNTER_F"\n\t", igmp->report_rxed)); 00083 LWIP_PLATFORM_DIAG(("group_query_rxed: %"STAT_COUNTER_F"\n", igmp->group_query_rxed)); 00084 } 00085 00086 void 00087 stats_display_mem(struct stats_mem *mem, char *name) 00088 { 00089 LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name)); 00090 LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail)); 00091 LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used)); 00092 LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max)); 00093 LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err)); 00094 } 00095 00096 void 00097 stats_display(void) 00098 { 00099 #if MEMP_STATS 00100 s16_t i; 00101 char * memp_names[] = { 00102 #define LWIP_MEMPOOL(name,num,size,desc) desc, 00103 #include "lwip/memp_std.h" 00104 }; 00105 #endif 00106 #if LINK_STATS 00107 stats_display_proto(&lwip_stats.link, "LINK"); 00108 #endif 00109 #if ETHARP_STATS 00110 stats_display_proto(&lwip_stats.etharp, "ETHARP"); 00111 #endif 00112 #if IPFRAG_STATS 00113 stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG"); 00114 #endif 00115 #if IP_STATS 00116 stats_display_proto(&lwip_stats.ip, "IP"); 00117 #endif 00118 #if ICMP_STATS 00119 stats_display_proto(&lwip_stats.icmp, "ICMP"); 00120 #endif 00121 #if IGMP_STATS 00122 stats_display_igmp(&lwip_stats.igmp); 00123 #endif 00124 #if UDP_STATS 00125 stats_display_proto(&lwip_stats.udp, "UDP"); 00126 #endif 00127 #if TCP_STATS 00128 stats_display_proto(&lwip_stats.tcp, "TCP"); 00129 #endif 00130 #if MEM_STATS 00131 stats_display_mem(&lwip_stats.mem, "HEAP"); 00132 #endif 00133 #if MEMP_STATS 00134 for (i = 0; i < MEMP_MAX; i++) { 00135 stats_display_mem(&lwip_stats.memp[i], memp_names[i]); 00136 } 00137 #endif 00138 } 00139 #endif /* LWIP_STATS_DISPLAY */ 00140 00141 #endif /* LWIP_STATS */ 00142
Generated on Tue Jul 12 2022 16:06:24 by 1.7.2