takashi yamanoue
/
XBee_API_ex2
Xbee test 2
LPC1768/lwip/include/lwip/stats.h@0:ffac63d6a7f0, 2012-07-21 (annotated)
- Committer:
- takashiyamanoue
- Date:
- Sat Jul 21 04:08:27 2012 +0000
- Revision:
- 0:ffac63d6a7f0
xbee test 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takashiyamanoue | 0:ffac63d6a7f0 | 1 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
takashiyamanoue | 0:ffac63d6a7f0 | 3 | * All rights reserved. |
takashiyamanoue | 0:ffac63d6a7f0 | 4 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
takashiyamanoue | 0:ffac63d6a7f0 | 6 | * are permitted provided that the following conditions are met: |
takashiyamanoue | 0:ffac63d6a7f0 | 7 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
takashiyamanoue | 0:ffac63d6a7f0 | 9 | * this list of conditions and the following disclaimer. |
takashiyamanoue | 0:ffac63d6a7f0 | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
takashiyamanoue | 0:ffac63d6a7f0 | 11 | * this list of conditions and the following disclaimer in the documentation |
takashiyamanoue | 0:ffac63d6a7f0 | 12 | * and/or other materials provided with the distribution. |
takashiyamanoue | 0:ffac63d6a7f0 | 13 | * 3. The name of the author may not be used to endorse or promote products |
takashiyamanoue | 0:ffac63d6a7f0 | 14 | * derived from this software without specific prior written permission. |
takashiyamanoue | 0:ffac63d6a7f0 | 15 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
takashiyamanoue | 0:ffac63d6a7f0 | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
takashiyamanoue | 0:ffac63d6a7f0 | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
takashiyamanoue | 0:ffac63d6a7f0 | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
takashiyamanoue | 0:ffac63d6a7f0 | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
takashiyamanoue | 0:ffac63d6a7f0 | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
takashiyamanoue | 0:ffac63d6a7f0 | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
takashiyamanoue | 0:ffac63d6a7f0 | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
takashiyamanoue | 0:ffac63d6a7f0 | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
takashiyamanoue | 0:ffac63d6a7f0 | 25 | * OF SUCH DAMAGE. |
takashiyamanoue | 0:ffac63d6a7f0 | 26 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 27 | * This file is part of the lwIP TCP/IP stack. |
takashiyamanoue | 0:ffac63d6a7f0 | 28 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 29 | * Author: Adam Dunkels <adam@sics.se> |
takashiyamanoue | 0:ffac63d6a7f0 | 30 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 31 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 32 | #ifndef __LWIP_STATS_H__ |
takashiyamanoue | 0:ffac63d6a7f0 | 33 | #define __LWIP_STATS_H__ |
takashiyamanoue | 0:ffac63d6a7f0 | 34 | |
takashiyamanoue | 0:ffac63d6a7f0 | 35 | #include "lwip/opt.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 36 | |
takashiyamanoue | 0:ffac63d6a7f0 | 37 | #include "lwip/mem.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 38 | #include "lwip/memp.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 39 | |
takashiyamanoue | 0:ffac63d6a7f0 | 40 | #ifdef __cplusplus |
takashiyamanoue | 0:ffac63d6a7f0 | 41 | extern "C" { |
takashiyamanoue | 0:ffac63d6a7f0 | 42 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 43 | |
takashiyamanoue | 0:ffac63d6a7f0 | 44 | #if LWIP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 45 | |
takashiyamanoue | 0:ffac63d6a7f0 | 46 | #ifndef LWIP_STATS_LARGE |
takashiyamanoue | 0:ffac63d6a7f0 | 47 | #define LWIP_STATS_LARGE 0 |
takashiyamanoue | 0:ffac63d6a7f0 | 48 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 49 | |
takashiyamanoue | 0:ffac63d6a7f0 | 50 | #if LWIP_STATS_LARGE |
takashiyamanoue | 0:ffac63d6a7f0 | 51 | #define STAT_COUNTER u32_t |
takashiyamanoue | 0:ffac63d6a7f0 | 52 | #define STAT_COUNTER_F U32_F |
takashiyamanoue | 0:ffac63d6a7f0 | 53 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 54 | #define STAT_COUNTER u16_t |
takashiyamanoue | 0:ffac63d6a7f0 | 55 | #define STAT_COUNTER_F U16_F |
takashiyamanoue | 0:ffac63d6a7f0 | 56 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 57 | |
takashiyamanoue | 0:ffac63d6a7f0 | 58 | struct stats_proto { |
takashiyamanoue | 0:ffac63d6a7f0 | 59 | STAT_COUNTER xmit; /* Transmitted packets. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 60 | STAT_COUNTER recv; /* Received packets. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 61 | STAT_COUNTER fw; /* Forwarded packets. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 62 | STAT_COUNTER drop; /* Dropped packets. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 63 | STAT_COUNTER chkerr; /* Checksum error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 64 | STAT_COUNTER lenerr; /* Invalid length error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 65 | STAT_COUNTER memerr; /* Out of memory error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 66 | STAT_COUNTER rterr; /* Routing error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 67 | STAT_COUNTER proterr; /* Protocol error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 68 | STAT_COUNTER opterr; /* Error in options. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 69 | STAT_COUNTER err; /* Misc error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 70 | STAT_COUNTER cachehit; |
takashiyamanoue | 0:ffac63d6a7f0 | 71 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 72 | |
takashiyamanoue | 0:ffac63d6a7f0 | 73 | struct stats_igmp { |
takashiyamanoue | 0:ffac63d6a7f0 | 74 | STAT_COUNTER xmit; /* Transmitted packets. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 75 | STAT_COUNTER recv; /* Received packets. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 76 | STAT_COUNTER drop; /* Dropped packets. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 77 | STAT_COUNTER chkerr; /* Checksum error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 78 | STAT_COUNTER lenerr; /* Invalid length error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 79 | STAT_COUNTER memerr; /* Out of memory error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 80 | STAT_COUNTER proterr; /* Protocol error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 81 | STAT_COUNTER rx_v1; /* Received v1 frames. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 82 | STAT_COUNTER rx_group; /* Received group-specific queries. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 83 | STAT_COUNTER rx_general; /* Received general queries. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 84 | STAT_COUNTER rx_report; /* Received reports. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 85 | STAT_COUNTER tx_join; /* Sent joins. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 86 | STAT_COUNTER tx_leave; /* Sent leaves. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 87 | STAT_COUNTER tx_report; /* Sent reports. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 88 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 89 | |
takashiyamanoue | 0:ffac63d6a7f0 | 90 | struct stats_mem { |
takashiyamanoue | 0:ffac63d6a7f0 | 91 | #ifdef LWIP_DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 92 | const char *name; |
takashiyamanoue | 0:ffac63d6a7f0 | 93 | #endif /* LWIP_DEBUG */ |
takashiyamanoue | 0:ffac63d6a7f0 | 94 | mem_size_t avail; |
takashiyamanoue | 0:ffac63d6a7f0 | 95 | mem_size_t used; |
takashiyamanoue | 0:ffac63d6a7f0 | 96 | mem_size_t max; |
takashiyamanoue | 0:ffac63d6a7f0 | 97 | STAT_COUNTER err; |
takashiyamanoue | 0:ffac63d6a7f0 | 98 | STAT_COUNTER illegal; |
takashiyamanoue | 0:ffac63d6a7f0 | 99 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 100 | |
takashiyamanoue | 0:ffac63d6a7f0 | 101 | struct stats_syselem { |
takashiyamanoue | 0:ffac63d6a7f0 | 102 | STAT_COUNTER used; |
takashiyamanoue | 0:ffac63d6a7f0 | 103 | STAT_COUNTER max; |
takashiyamanoue | 0:ffac63d6a7f0 | 104 | STAT_COUNTER err; |
takashiyamanoue | 0:ffac63d6a7f0 | 105 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 106 | |
takashiyamanoue | 0:ffac63d6a7f0 | 107 | struct stats_sys { |
takashiyamanoue | 0:ffac63d6a7f0 | 108 | struct stats_syselem sem; |
takashiyamanoue | 0:ffac63d6a7f0 | 109 | struct stats_syselem mutex; |
takashiyamanoue | 0:ffac63d6a7f0 | 110 | struct stats_syselem mbox; |
takashiyamanoue | 0:ffac63d6a7f0 | 111 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 112 | |
takashiyamanoue | 0:ffac63d6a7f0 | 113 | struct stats_ { |
takashiyamanoue | 0:ffac63d6a7f0 | 114 | #if LINK_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 115 | struct stats_proto link; |
takashiyamanoue | 0:ffac63d6a7f0 | 116 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 117 | #if ETHARP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 118 | struct stats_proto etharp; |
takashiyamanoue | 0:ffac63d6a7f0 | 119 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 120 | #if IPFRAG_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 121 | struct stats_proto ip_frag; |
takashiyamanoue | 0:ffac63d6a7f0 | 122 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 123 | #if IP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 124 | struct stats_proto ip; |
takashiyamanoue | 0:ffac63d6a7f0 | 125 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 126 | #if ICMP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 127 | struct stats_proto icmp; |
takashiyamanoue | 0:ffac63d6a7f0 | 128 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 129 | #if IGMP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 130 | struct stats_igmp igmp; |
takashiyamanoue | 0:ffac63d6a7f0 | 131 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 132 | #if UDP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 133 | struct stats_proto udp; |
takashiyamanoue | 0:ffac63d6a7f0 | 134 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 135 | #if TCP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 136 | struct stats_proto tcp; |
takashiyamanoue | 0:ffac63d6a7f0 | 137 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 138 | #if MEM_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 139 | struct stats_mem mem; |
takashiyamanoue | 0:ffac63d6a7f0 | 140 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 141 | #if MEMP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 142 | struct stats_mem memp[MEMP_MAX]; |
takashiyamanoue | 0:ffac63d6a7f0 | 143 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 144 | #if SYS_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 145 | struct stats_sys sys; |
takashiyamanoue | 0:ffac63d6a7f0 | 146 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 147 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 148 | |
takashiyamanoue | 0:ffac63d6a7f0 | 149 | extern struct stats_ lwip_stats; |
takashiyamanoue | 0:ffac63d6a7f0 | 150 | |
takashiyamanoue | 0:ffac63d6a7f0 | 151 | void stats_init(void); |
takashiyamanoue | 0:ffac63d6a7f0 | 152 | |
takashiyamanoue | 0:ffac63d6a7f0 | 153 | #define STATS_INC(x) ++lwip_stats.x |
takashiyamanoue | 0:ffac63d6a7f0 | 154 | #define STATS_DEC(x) --lwip_stats.x |
takashiyamanoue | 0:ffac63d6a7f0 | 155 | #define STATS_INC_USED(x, y) do { lwip_stats.x.used += y; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 156 | if (lwip_stats.x.max < lwip_stats.x.used) { \ |
takashiyamanoue | 0:ffac63d6a7f0 | 157 | lwip_stats.x.max = lwip_stats.x.used; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 158 | } \ |
takashiyamanoue | 0:ffac63d6a7f0 | 159 | } while(0) |
takashiyamanoue | 0:ffac63d6a7f0 | 160 | #else /* LWIP_STATS */ |
takashiyamanoue | 0:ffac63d6a7f0 | 161 | #define stats_init() |
takashiyamanoue | 0:ffac63d6a7f0 | 162 | #define STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 163 | #define STATS_DEC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 164 | #define STATS_INC_USED(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 165 | #endif /* LWIP_STATS */ |
takashiyamanoue | 0:ffac63d6a7f0 | 166 | |
takashiyamanoue | 0:ffac63d6a7f0 | 167 | #if TCP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 168 | #define TCP_STATS_INC(x) STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 169 | #define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP") |
takashiyamanoue | 0:ffac63d6a7f0 | 170 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 171 | #define TCP_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 172 | #define TCP_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 173 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 174 | |
takashiyamanoue | 0:ffac63d6a7f0 | 175 | #if UDP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 176 | #define UDP_STATS_INC(x) STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 177 | #define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP") |
takashiyamanoue | 0:ffac63d6a7f0 | 178 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 179 | #define UDP_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 180 | #define UDP_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 181 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 182 | |
takashiyamanoue | 0:ffac63d6a7f0 | 183 | #if ICMP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 184 | #define ICMP_STATS_INC(x) STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 185 | #define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP") |
takashiyamanoue | 0:ffac63d6a7f0 | 186 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 187 | #define ICMP_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 188 | #define ICMP_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 189 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 190 | |
takashiyamanoue | 0:ffac63d6a7f0 | 191 | #if IGMP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 192 | #define IGMP_STATS_INC(x) STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 193 | #define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp) |
takashiyamanoue | 0:ffac63d6a7f0 | 194 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 195 | #define IGMP_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 196 | #define IGMP_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 197 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 198 | |
takashiyamanoue | 0:ffac63d6a7f0 | 199 | #if IP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 200 | #define IP_STATS_INC(x) STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 201 | #define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP") |
takashiyamanoue | 0:ffac63d6a7f0 | 202 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 203 | #define IP_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 204 | #define IP_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 205 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 206 | |
takashiyamanoue | 0:ffac63d6a7f0 | 207 | #if IPFRAG_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 208 | #define IPFRAG_STATS_INC(x) STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 209 | #define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG") |
takashiyamanoue | 0:ffac63d6a7f0 | 210 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 211 | #define IPFRAG_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 212 | #define IPFRAG_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 213 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 214 | |
takashiyamanoue | 0:ffac63d6a7f0 | 215 | #if ETHARP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 216 | #define ETHARP_STATS_INC(x) STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 217 | #define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP") |
takashiyamanoue | 0:ffac63d6a7f0 | 218 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 219 | #define ETHARP_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 220 | #define ETHARP_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 221 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 222 | |
takashiyamanoue | 0:ffac63d6a7f0 | 223 | #if LINK_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 224 | #define LINK_STATS_INC(x) STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 225 | #define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK") |
takashiyamanoue | 0:ffac63d6a7f0 | 226 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 227 | #define LINK_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 228 | #define LINK_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 229 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 230 | |
takashiyamanoue | 0:ffac63d6a7f0 | 231 | #if MEM_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 232 | #define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y |
takashiyamanoue | 0:ffac63d6a7f0 | 233 | #define MEM_STATS_INC(x) STATS_INC(mem.x) |
takashiyamanoue | 0:ffac63d6a7f0 | 234 | #define MEM_STATS_INC_USED(x, y) STATS_INC_USED(mem, y) |
takashiyamanoue | 0:ffac63d6a7f0 | 235 | #define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x -= y |
takashiyamanoue | 0:ffac63d6a7f0 | 236 | #define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP") |
takashiyamanoue | 0:ffac63d6a7f0 | 237 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 238 | #define MEM_STATS_AVAIL(x, y) |
takashiyamanoue | 0:ffac63d6a7f0 | 239 | #define MEM_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 240 | #define MEM_STATS_INC_USED(x, y) |
takashiyamanoue | 0:ffac63d6a7f0 | 241 | #define MEM_STATS_DEC_USED(x, y) |
takashiyamanoue | 0:ffac63d6a7f0 | 242 | #define MEM_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 243 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 244 | |
takashiyamanoue | 0:ffac63d6a7f0 | 245 | #if MEMP_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 246 | #define MEMP_STATS_AVAIL(x, i, y) lwip_stats.memp[i].x = y |
takashiyamanoue | 0:ffac63d6a7f0 | 247 | #define MEMP_STATS_INC(x, i) STATS_INC(memp[i].x) |
takashiyamanoue | 0:ffac63d6a7f0 | 248 | #define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i].x) |
takashiyamanoue | 0:ffac63d6a7f0 | 249 | #define MEMP_STATS_INC_USED(x, i) STATS_INC_USED(memp[i], 1) |
takashiyamanoue | 0:ffac63d6a7f0 | 250 | #define MEMP_STATS_DISPLAY(i) stats_display_memp(&lwip_stats.memp[i], i) |
takashiyamanoue | 0:ffac63d6a7f0 | 251 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 252 | #define MEMP_STATS_AVAIL(x, i, y) |
takashiyamanoue | 0:ffac63d6a7f0 | 253 | #define MEMP_STATS_INC(x, i) |
takashiyamanoue | 0:ffac63d6a7f0 | 254 | #define MEMP_STATS_DEC(x, i) |
takashiyamanoue | 0:ffac63d6a7f0 | 255 | #define MEMP_STATS_INC_USED(x, i) |
takashiyamanoue | 0:ffac63d6a7f0 | 256 | #define MEMP_STATS_DISPLAY(i) |
takashiyamanoue | 0:ffac63d6a7f0 | 257 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 258 | |
takashiyamanoue | 0:ffac63d6a7f0 | 259 | #if SYS_STATS |
takashiyamanoue | 0:ffac63d6a7f0 | 260 | #define SYS_STATS_INC(x) STATS_INC(sys.x) |
takashiyamanoue | 0:ffac63d6a7f0 | 261 | #define SYS_STATS_DEC(x) STATS_DEC(sys.x) |
takashiyamanoue | 0:ffac63d6a7f0 | 262 | #define SYS_STATS_INC_USED(x) STATS_INC_USED(sys.x, 1) |
takashiyamanoue | 0:ffac63d6a7f0 | 263 | #define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys) |
takashiyamanoue | 0:ffac63d6a7f0 | 264 | #else |
takashiyamanoue | 0:ffac63d6a7f0 | 265 | #define SYS_STATS_INC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 266 | #define SYS_STATS_DEC(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 267 | #define SYS_STATS_INC_USED(x) |
takashiyamanoue | 0:ffac63d6a7f0 | 268 | #define SYS_STATS_DISPLAY() |
takashiyamanoue | 0:ffac63d6a7f0 | 269 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 270 | |
takashiyamanoue | 0:ffac63d6a7f0 | 271 | /* Display of statistics */ |
takashiyamanoue | 0:ffac63d6a7f0 | 272 | #if LWIP_STATS_DISPLAY |
takashiyamanoue | 0:ffac63d6a7f0 | 273 | void stats_display(void); |
takashiyamanoue | 0:ffac63d6a7f0 | 274 | void stats_display_proto(struct stats_proto *proto, char *name); |
takashiyamanoue | 0:ffac63d6a7f0 | 275 | void stats_display_igmp(struct stats_igmp *igmp); |
takashiyamanoue | 0:ffac63d6a7f0 | 276 | void stats_display_mem(struct stats_mem *mem, char *name); |
takashiyamanoue | 0:ffac63d6a7f0 | 277 | void stats_display_memp(struct stats_mem *mem, int index); |
takashiyamanoue | 0:ffac63d6a7f0 | 278 | void stats_display_sys(struct stats_sys *sys); |
takashiyamanoue | 0:ffac63d6a7f0 | 279 | #else /* LWIP_STATS_DISPLAY */ |
takashiyamanoue | 0:ffac63d6a7f0 | 280 | #define stats_display() |
takashiyamanoue | 0:ffac63d6a7f0 | 281 | #define stats_display_proto(proto, name) |
takashiyamanoue | 0:ffac63d6a7f0 | 282 | #define stats_display_igmp(igmp) |
takashiyamanoue | 0:ffac63d6a7f0 | 283 | #define stats_display_mem(mem, name) |
takashiyamanoue | 0:ffac63d6a7f0 | 284 | #define stats_display_memp(mem, index) |
takashiyamanoue | 0:ffac63d6a7f0 | 285 | #define stats_display_sys(sys) |
takashiyamanoue | 0:ffac63d6a7f0 | 286 | #endif /* LWIP_STATS_DISPLAY */ |
takashiyamanoue | 0:ffac63d6a7f0 | 287 | |
takashiyamanoue | 0:ffac63d6a7f0 | 288 | #ifdef __cplusplus |
takashiyamanoue | 0:ffac63d6a7f0 | 289 | } |
takashiyamanoue | 0:ffac63d6a7f0 | 290 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 291 | |
takashiyamanoue | 0:ffac63d6a7f0 | 292 | #endif /* __LWIP_STATS_H__ */ |