37 #ifndef LWIP_HDR_STATS_H
38 #define LWIP_HDR_STATS_H
51 #ifndef LWIP_STATS_LARGE
52 #define LWIP_STATS_LARGE 0
56 #define STAT_COUNTER u32_t
57 #define STAT_COUNTER_F U32_F
59 #define STAT_COUNTER u16_t
60 #define STAT_COUNTER_F U16_F
76 STAT_COUNTER cachehit;
89 STAT_COUNTER rx_group;
90 STAT_COUNTER rx_general;
91 STAT_COUNTER rx_report;
93 STAT_COUNTER tx_leave;
94 STAT_COUNTER tx_report;
99 #if defined(LWIP_DEBUG) || LWIP_STATS_DISPLAY
106 STAT_COUNTER illegal;
110 struct stats_syselem {
118 struct stats_syselem sem;
119 struct stats_syselem mutex;
120 struct stats_syselem mbox;
127 u32_t ipinaddrerrors;
128 u32_t ipinunknownprotos;
140 u32_t ipforwdatagrams;
144 u32_t tcpactiveopens;
145 u32_t tcppassiveopens;
146 u32_t tcpattemptfails;
147 u32_t tcpestabresets;
149 u32_t tcpretranssegs;
155 u32_t udpindatagrams;
158 u32_t udpoutdatagrams;
163 u32_t icmpindestunreachs;
164 u32_t icmpintimeexcds;
165 u32_t icmpinparmprobs;
166 u32_t icmpinsrcquenchs;
167 u32_t icmpinredirects;
169 u32_t icmpinechoreps;
170 u32_t icmpintimestamps;
171 u32_t icmpintimestampreps;
172 u32_t icmpinaddrmasks;
173 u32_t icmpinaddrmaskreps;
176 u32_t icmpoutdestunreachs;
177 u32_t icmpouttimeexcds;
179 u32_t icmpoutechoreps;
186 struct stats_mib2_netif_ctrs {
194 u32_t ifinnucastpkts;
210 u32_t ifinunknownprotos;
216 u32_t ifoutucastpkts;
220 u32_t ifoutnucastpkts;
235 struct stats_proto link;
239 struct stats_proto etharp;
243 struct stats_proto ip_frag;
247 struct stats_proto ip;
251 struct stats_proto icmp;
255 struct stats_igmp igmp;
259 struct stats_proto udp;
263 struct stats_proto tcp;
267 struct stats_mem
mem;
275 struct stats_sys sys;
279 struct stats_proto ip6;
283 struct stats_proto icmp6;
287 struct stats_proto ip6_frag;
291 struct stats_igmp mld6;
295 struct stats_proto nd6;
299 struct stats_mib2 mib2;
304 extern struct stats_ lwip_stats;
309 #define STATS_INC(x) ++lwip_stats.x
310 #define STATS_DEC(x) --lwip_stats.x
311 #define STATS_INC_USED(x, y, type) do { lwip_stats.x.used = (type)(lwip_stats.x.used + y); \
312 if (lwip_stats.x.max < lwip_stats.x.used) { \
313 lwip_stats.x.max = lwip_stats.x.used; \
316 #define STATS_GET(x) lwip_stats.x
321 #define STATS_INC_USED(x, y, type)
325 #define TCP_STATS_INC(x) STATS_INC(x)
326 #define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP")
328 #define TCP_STATS_INC(x)
329 #define TCP_STATS_DISPLAY()
333 #define UDP_STATS_INC(x) STATS_INC(x)
334 #define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP")
336 #define UDP_STATS_INC(x)
337 #define UDP_STATS_DISPLAY()
341 #define ICMP_STATS_INC(x) STATS_INC(x)
342 #define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP")
344 #define ICMP_STATS_INC(x)
345 #define ICMP_STATS_DISPLAY()
349 #define IGMP_STATS_INC(x) STATS_INC(x)
350 #define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp, "IGMP")
352 #define IGMP_STATS_INC(x)
353 #define IGMP_STATS_DISPLAY()
357 #define IP_STATS_INC(x) STATS_INC(x)
358 #define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP")
360 #define IP_STATS_INC(x)
361 #define IP_STATS_DISPLAY()
365 #define IPFRAG_STATS_INC(x) STATS_INC(x)
366 #define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG")
368 #define IPFRAG_STATS_INC(x)
369 #define IPFRAG_STATS_DISPLAY()
373 #define ETHARP_STATS_INC(x) STATS_INC(x)
374 #define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP")
376 #define ETHARP_STATS_INC(x)
377 #define ETHARP_STATS_DISPLAY()
381 #define LINK_STATS_INC(x) STATS_INC(x)
382 #define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK")
384 #define LINK_STATS_INC(x)
385 #define LINK_STATS_DISPLAY()
389 #define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y
390 #define MEM_STATS_INC(x) STATS_INC(mem.x)
391 #define MEM_STATS_INC_USED(x, y) STATS_INC_USED(mem, y, mem_size_t)
392 #define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x = (mem_size_t)((lwip_stats.mem.x) - (y))
393 #define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP")
395 #define MEM_STATS_AVAIL(x, y)
396 #define MEM_STATS_INC(x)
397 #define MEM_STATS_INC_USED(x, y)
398 #define MEM_STATS_DEC_USED(x, y)
399 #define MEM_STATS_DISPLAY()
403 #define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i]->x)
404 #define MEMP_STATS_DISPLAY(i) stats_display_memp(lwip_stats.memp[i], i)
405 #define MEMP_STATS_GET(x, i) STATS_GET(memp[i]->x)
407 #define MEMP_STATS_DEC(x, i)
408 #define MEMP_STATS_DISPLAY(i)
409 #define MEMP_STATS_GET(x, i) 0
413 #define SYS_STATS_INC(x) STATS_INC(sys.x)
414 #define SYS_STATS_DEC(x) STATS_DEC(sys.x)
415 #define SYS_STATS_INC_USED(x) STATS_INC_USED(sys.x, 1, STAT_COUNTER)
416 #define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys)
418 #define SYS_STATS_INC(x)
419 #define SYS_STATS_DEC(x)
420 #define SYS_STATS_INC_USED(x)
421 #define SYS_STATS_DISPLAY()
425 #define IP6_STATS_INC(x) STATS_INC(x)
426 #define IP6_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip6, "IPv6")
428 #define IP6_STATS_INC(x)
429 #define IP6_STATS_DISPLAY()
433 #define ICMP6_STATS_INC(x) STATS_INC(x)
434 #define ICMP6_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp6, "ICMPv6")
436 #define ICMP6_STATS_INC(x)
437 #define ICMP6_STATS_DISPLAY()
441 #define IP6_FRAG_STATS_INC(x) STATS_INC(x)
442 #define IP6_FRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip6_frag, "IPv6 FRAG")
444 #define IP6_FRAG_STATS_INC(x)
445 #define IP6_FRAG_STATS_DISPLAY()
449 #define MLD6_STATS_INC(x) STATS_INC(x)
450 #define MLD6_STATS_DISPLAY() stats_display_igmp(&lwip_stats.mld6, "MLDv1")
452 #define MLD6_STATS_INC(x)
453 #define MLD6_STATS_DISPLAY()
457 #define ND6_STATS_INC(x) STATS_INC(x)
458 #define ND6_STATS_DISPLAY() stats_display_proto(&lwip_stats.nd6, "ND")
460 #define ND6_STATS_INC(x)
461 #define ND6_STATS_DISPLAY()
465 #define MIB2_STATS_INC(x) STATS_INC(x)
467 #define MIB2_STATS_INC(x)
471 #if LWIP_STATS_DISPLAY
479 #define stats_display()
480 #define stats_display_proto(proto, name)
481 #define stats_display_igmp(igmp, name)
482 #define stats_display_mem(mem, name)
483 #define stats_display_memp(mem, index)
484 #define stats_display_sys(sys)
uint32_t u32_t
Definition: arch.h:129
u16_t mem_size_t
Definition: mem.h:67
@ MEMP_MAX
Definition: memp.h:55
#define stats_display_proto(proto, name)
Definition: stats.h:480
#define stats_display_igmp(igmp, name)
Definition: stats.h:481
#define stats_display_memp(mem, index)
Definition: stats.h:483
#define stats_init()
Definition: stats.h:318
#define stats_display_mem(mem, name)
Definition: stats.h:482
#define stats_display_sys(sys)
Definition: stats.h:484
#define stats_display()
Definition: stats.h:479
Definition: memp_priv.h:69