A version of LWIP, provided for backwards compatibility.
Dependents: AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more
stats.h
00001 /* 00002 * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright notice, 00011 * this list of conditions and the following disclaimer in the documentation 00012 * and/or other materials provided with the distribution. 00013 * 3. The name of the author may not be used to endorse or promote products 00014 * derived from this software without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00017 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00018 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00019 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00020 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00021 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00023 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00024 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00025 * OF SUCH DAMAGE. 00026 * 00027 * This file is part of the lwIP TCP/IP stack. 00028 * 00029 * Author: Adam Dunkels <adam@sics.se> 00030 * 00031 */ 00032 #ifndef __LWIP_STATS_H__ 00033 #define __LWIP_STATS_H__ 00034 00035 #include "lwip/opt.h" 00036 00037 #include "lwip/mem.h" 00038 #include "lwip/memp.h" 00039 00040 #ifdef __cplusplus 00041 extern "C" { 00042 #endif 00043 00044 #if LWIP_STATS 00045 00046 #ifndef LWIP_STATS_LARGE 00047 #define LWIP_STATS_LARGE 0 00048 #endif 00049 00050 #if LWIP_STATS_LARGE 00051 #define STAT_COUNTER u32_t 00052 #define STAT_COUNTER_F U32_F 00053 #else 00054 #define STAT_COUNTER u16_t 00055 #define STAT_COUNTER_F U16_F 00056 #endif 00057 00058 struct stats_proto { 00059 STAT_COUNTER xmit; /* Transmitted packets. */ 00060 STAT_COUNTER rexmit; /* Retransmitted packets. */ 00061 STAT_COUNTER recv; /* Received packets. */ 00062 STAT_COUNTER fw; /* Forwarded packets. */ 00063 STAT_COUNTER drop; /* Dropped packets. */ 00064 STAT_COUNTER chkerr; /* Checksum error. */ 00065 STAT_COUNTER lenerr; /* Invalid length error. */ 00066 STAT_COUNTER memerr; /* Out of memory error. */ 00067 STAT_COUNTER rterr; /* Routing error. */ 00068 STAT_COUNTER proterr; /* Protocol error. */ 00069 STAT_COUNTER opterr; /* Error in options. */ 00070 STAT_COUNTER err; /* Misc error. */ 00071 STAT_COUNTER cachehit; 00072 }; 00073 00074 struct stats_igmp { 00075 STAT_COUNTER lenerr; /* Invalid length error. */ 00076 STAT_COUNTER chkerr; /* Checksum error. */ 00077 STAT_COUNTER v1_rxed; /* */ 00078 STAT_COUNTER join_sent; /* */ 00079 STAT_COUNTER leave_sent; /* */ 00080 STAT_COUNTER unicast_query; /* */ 00081 STAT_COUNTER report_sent; /* */ 00082 STAT_COUNTER report_rxed; /* */ 00083 STAT_COUNTER group_query_rxed; /* */ 00084 }; 00085 00086 struct stats_mem { 00087 mem_size_t avail; 00088 mem_size_t used; 00089 mem_size_t max; 00090 mem_size_t err; 00091 }; 00092 00093 struct stats_syselem { 00094 STAT_COUNTER used; 00095 STAT_COUNTER max; 00096 STAT_COUNTER err; 00097 }; 00098 00099 struct stats_sys { 00100 struct stats_syselem sem; 00101 struct stats_syselem mbox; 00102 }; 00103 00104 struct stats_ { 00105 #if LINK_STATS 00106 struct stats_proto link; 00107 #endif 00108 #if ETHARP_STATS 00109 struct stats_proto etharp; 00110 #endif 00111 #if IPFRAG_STATS 00112 struct stats_proto ip_frag; 00113 #endif 00114 #if IP_STATS 00115 struct stats_proto ip; 00116 #endif 00117 #if ICMP_STATS 00118 struct stats_proto icmp; 00119 #endif 00120 #if IGMP_STATS 00121 struct stats_igmp igmp; 00122 #endif 00123 #if UDP_STATS 00124 struct stats_proto udp; 00125 #endif 00126 #if TCP_STATS 00127 struct stats_proto tcp; 00128 #endif 00129 #if MEM_STATS 00130 struct stats_mem mem; 00131 #endif 00132 #if MEMP_STATS 00133 struct stats_mem memp[MEMP_MAX]; 00134 #endif 00135 #if SYS_STATS 00136 struct stats_sys sys; 00137 #endif 00138 }; 00139 00140 extern struct stats_ lwip_stats; 00141 00142 #define stats_init() /* Compatibility define, not init needed. */ 00143 00144 #define STATS_INC(x) ++lwip_stats.x 00145 #else 00146 #define stats_init() 00147 #define STATS_INC(x) 00148 #endif /* LWIP_STATS */ 00149 00150 #if TCP_STATS 00151 #define TCP_STATS_INC(x) STATS_INC(x) 00152 #else 00153 #define TCP_STATS_INC(x) 00154 #endif 00155 00156 #if UDP_STATS 00157 #define UDP_STATS_INC(x) STATS_INC(x) 00158 #else 00159 #define UDP_STATS_INC(x) 00160 #endif 00161 00162 #if ICMP_STATS 00163 #define ICMP_STATS_INC(x) STATS_INC(x) 00164 #else 00165 #define ICMP_STATS_INC(x) 00166 #endif 00167 00168 #if IGMP_STATS 00169 #define IGMP_STATS_INC(x) STATS_INC(x) 00170 #else 00171 #define IGMP_STATS_INC(x) 00172 #endif 00173 00174 #if IP_STATS 00175 #define IP_STATS_INC(x) STATS_INC(x) 00176 #else 00177 #define IP_STATS_INC(x) 00178 #endif 00179 00180 #if IPFRAG_STATS 00181 #define IPFRAG_STATS_INC(x) STATS_INC(x) 00182 #else 00183 #define IPFRAG_STATS_INC(x) 00184 #endif 00185 00186 #if ETHARP_STATS 00187 #define ETHARP_STATS_INC(x) STATS_INC(x) 00188 #else 00189 #define ETHARP_STATS_INC(x) 00190 #endif 00191 00192 #if LINK_STATS 00193 #define LINK_STATS_INC(x) STATS_INC(x) 00194 #else 00195 #define LINK_STATS_INC(x) 00196 #endif 00197 00198 /* Display of statistics */ 00199 #if LWIP_STATS_DISPLAY 00200 void stats_display(void); 00201 #else 00202 #define stats_display() 00203 #endif /* LWIP_STATS_DISPLAY */ 00204 00205 #ifdef __cplusplus 00206 } 00207 #endif 00208 00209 #endif /* __LWIP_STATS_H__ */
Generated on Tue Jul 12 2022 16:06:24 by 1.7.2