Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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(("recv: %"STAT_COUNTER_F"\n\t", proto->recv)); 00058 LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw)); 00059 LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop)); 00060 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", proto->chkerr)); 00061 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", proto->lenerr)); 00062 LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", proto->memerr)); 00063 LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F"\n\t", proto->rterr)); 00064 LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", proto->proterr)); 00065 LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F"\n\t", proto->opterr)); 00066 LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n\t", proto->err)); 00067 LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit)); 00068 } 00069 00070 #if IGMP_STATS 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 #endif /* IGMP_STATS */ 00086 00087 #if MEM_STATS || MEMP_STATS 00088 void 00089 stats_display_mem(struct stats_mem *mem, char *name) 00090 { 00091 LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name)); 00092 LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail)); 00093 LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used)); 00094 LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max)); 00095 LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err)); 00096 } 00097 00098 #if MEMP_STATS 00099 void 00100 stats_display_memp(struct stats_mem *mem, int index) 00101 { 00102 char * memp_names[] = { 00103 #define LWIP_MEMPOOL(name,num,size,desc) desc, 00104 #include "lwip/memp_std.h" 00105 }; 00106 if(index < MEMP_MAX) { 00107 stats_display_mem(mem, memp_names[index]); 00108 } 00109 } 00110 #endif /* MEMP_STATS */ 00111 #endif /* MEM_STATS || MEMP_STATS */ 00112 00113 #if SYS_STATS 00114 void 00115 stats_display_sys(struct stats_sys *sys) 00116 { 00117 LWIP_PLATFORM_DIAG(("\nSYS\n\t")); 00118 LWIP_PLATFORM_DIAG(("sem.used: %"U32_F"\n\t", (u32_t)sys->sem.used)); 00119 LWIP_PLATFORM_DIAG(("sem.max: %"U32_F"\n\t", (u32_t)sys->sem.max)); 00120 LWIP_PLATFORM_DIAG(("sem.err: %"U32_F"\n\t", (u32_t)sys->sem.err)); 00121 LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F"\n\t", (u32_t)sys->mbox.used)); 00122 LWIP_PLATFORM_DIAG(("mbox.max: %"U32_F"\n\t", (u32_t)sys->mbox.max)); 00123 LWIP_PLATFORM_DIAG(("mbox.err: %"U32_F"\n\t", (u32_t)sys->mbox.err)); 00124 } 00125 #endif /* SYS_STATS */ 00126 00127 void 00128 stats_display(void) 00129 { 00130 s16_t i; 00131 00132 LINK_STATS_DISPLAY(); 00133 ETHARP_STATS_DISPLAY(); 00134 IPFRAG_STATS_DISPLAY(); 00135 IP_STATS_DISPLAY(); 00136 IGMP_STATS_DISPLAY(); 00137 ICMP_STATS_DISPLAY(); 00138 UDP_STATS_DISPLAY(); 00139 TCP_STATS_DISPLAY(); 00140 MEM_STATS_DISPLAY(); 00141 for (i = 0; i < MEMP_MAX; i++) { 00142 MEMP_STATS_DISPLAY(i); 00143 } 00144 SYS_STATS_DISPLAY(); 00145 } 00146 #endif /* LWIP_STATS_DISPLAY */ 00147 00148 #endif /* LWIP_STATS */ 00149
Generated on Wed Jul 13 2022 07:13:44 by
1.7.2