32#ifndef __LWIP_STATS_H__
33#define __LWIP_STATS_H__
46#ifndef LWIP_STATS_LARGE
47#define LWIP_STATS_LARGE 0
51#define STAT_COUNTER u32_t
52#define STAT_COUNTER_F U32_F
54#define STAT_COUNTER u16_t
55#define STAT_COUNTER_F U16_F
70 STAT_COUNTER cachehit;
82 STAT_COUNTER rx_group;
83 STAT_COUNTER rx_general;
84 STAT_COUNTER rx_report;
86 STAT_COUNTER tx_leave;
87 STAT_COUNTER tx_report;
101struct stats_syselem {
108 struct stats_syselem sem;
109 struct stats_syselem mutex;
110 struct stats_syselem mbox;
115 struct stats_proto
link;
118 struct stats_proto etharp;
121 struct stats_proto ip_frag;
124 struct stats_proto
ip;
127 struct stats_proto icmp;
130 struct stats_igmp igmp;
133 struct stats_proto udp;
136 struct stats_proto tcp;
139 struct stats_mem
mem;
145 struct stats_sys sys;
149extern struct stats_ lwip_stats;
153#define STATS_INC(x) ++lwip_stats.x
154#define STATS_DEC(x) --lwip_stats.x
155#define STATS_INC_USED(x, y) do { lwip_stats.x.used += y; \
156 if (lwip_stats.x.max < lwip_stats.x.used) { \
157 lwip_stats.x.max = lwip_stats.x.used; \
164#define STATS_INC_USED(x)
168#define TCP_STATS_INC(x) STATS_INC(x)
169#define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP")
171#define TCP_STATS_INC(x)
172#define TCP_STATS_DISPLAY()
176#define UDP_STATS_INC(x) STATS_INC(x)
177#define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP")
179#define UDP_STATS_INC(x)
180#define UDP_STATS_DISPLAY()
184#define ICMP_STATS_INC(x) STATS_INC(x)
185#define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP")
187#define ICMP_STATS_INC(x)
188#define ICMP_STATS_DISPLAY()
192#define IGMP_STATS_INC(x) STATS_INC(x)
193#define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp)
195#define IGMP_STATS_INC(x)
196#define IGMP_STATS_DISPLAY()
200#define IP_STATS_INC(x) STATS_INC(x)
201#define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP")
203#define IP_STATS_INC(x)
204#define IP_STATS_DISPLAY()
208#define IPFRAG_STATS_INC(x) STATS_INC(x)
209#define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG")
211#define IPFRAG_STATS_INC(x)
212#define IPFRAG_STATS_DISPLAY()
216#define ETHARP_STATS_INC(x) STATS_INC(x)
217#define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP")
219#define ETHARP_STATS_INC(x)
220#define ETHARP_STATS_DISPLAY()
224#define LINK_STATS_INC(x) STATS_INC(x)
225#define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK")
227#define LINK_STATS_INC(x)
228#define LINK_STATS_DISPLAY()
232#define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y
233#define MEM_STATS_INC(x) STATS_INC(mem.x)
234#define MEM_STATS_INC_USED(x, y) STATS_INC_USED(mem, y)
235#define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x -= y
236#define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP")
238#define MEM_STATS_AVAIL(x, y)
239#define MEM_STATS_INC(x)
240#define MEM_STATS_INC_USED(x, y)
241#define MEM_STATS_DEC_USED(x, y)
242#define MEM_STATS_DISPLAY()
246#define MEMP_STATS_AVAIL(x, i, y) lwip_stats.memp[i].x = y
247#define MEMP_STATS_INC(x, i) STATS_INC(memp[i].x)
248#define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i].x)
249#define MEMP_STATS_INC_USED(x, i) STATS_INC_USED(memp[i], 1)
250#define MEMP_STATS_DISPLAY(i) stats_display_memp(&lwip_stats.memp[i], i)
252#define MEMP_STATS_AVAIL(x, i, y)
253#define MEMP_STATS_INC(x, i)
254#define MEMP_STATS_DEC(x, i)
255#define MEMP_STATS_INC_USED(x, i)
256#define MEMP_STATS_DISPLAY(i)
260#define SYS_STATS_INC(x) STATS_INC(sys.x)
261#define SYS_STATS_DEC(x) STATS_DEC(sys.x)
262#define SYS_STATS_INC_USED(x) STATS_INC_USED(sys.x, 1)
263#define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys)
265#define SYS_STATS_INC(x)
266#define SYS_STATS_DEC(x)
267#define SYS_STATS_INC_USED(x)
268#define SYS_STATS_DISPLAY()
272#if LWIP_STATS_DISPLAY
280#define stats_display()
281#define stats_display_proto(proto, name)
282#define stats_display_igmp(igmp)
283#define stats_display_mem(mem, name)
284#define stats_display_memp(mem, index)
285#define stats_display_sys(sys)
int link(const char *existing, const char *new)
#define stats_display_proto(proto, name)
#define stats_display_memp(mem, index)
#define stats_display_igmp(igmp)
#define stats_display_mem(mem, name)
#define stats_display_sys(sys)