2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without modification,
\r
6 * are permitted provided that the following conditions are met:
\r
8 * 1. Redistributions of source code must retain the above copyright notice,
\r
9 * this list of conditions and the following disclaimer.
\r
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
11 * this list of conditions and the following disclaimer in the documentation
\r
12 * and/or other materials provided with the distribution.
\r
13 * 3. The name of the author may not be used to endorse or promote products
\r
14 * derived from this software without specific prior written permission.
\r
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
\r
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
\r
19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
\r
21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\r
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
\r
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
\r
27 * This file is part of the lwIP TCP/IP stack.
\r
29 * Author: Adam Dunkels <adam@sics.se>
\r
32 #ifndef __LWIP_STATS_H__
\r
33 #define __LWIP_STATS_H__
\r
35 #include "lwip/opt.h"
\r
37 #include "lwip/mem.h"
\r
38 #include "lwip/memp.h"
\r
46 #ifndef LWIP_STATS_LARGE
\r
47 #define LWIP_STATS_LARGE 0
\r
50 #if LWIP_STATS_LARGE
\r
51 #define STAT_COUNTER u32_t
\r
52 #define STAT_COUNTER_F U32_F
\r
54 #define STAT_COUNTER u16_t
\r
55 #define STAT_COUNTER_F U16_F
\r
58 struct stats_proto {
\r
59 STAT_COUNTER xmit; /* Transmitted packets. */
\r
60 STAT_COUNTER rexmit; /* Retransmitted packets. */
\r
61 STAT_COUNTER recv; /* Received packets. */
\r
62 STAT_COUNTER fw; /* Forwarded packets. */
\r
63 STAT_COUNTER drop; /* Dropped packets. */
\r
64 STAT_COUNTER chkerr; /* Checksum error. */
\r
65 STAT_COUNTER lenerr; /* Invalid length error. */
\r
66 STAT_COUNTER memerr; /* Out of memory error. */
\r
67 STAT_COUNTER rterr; /* Routing error. */
\r
68 STAT_COUNTER proterr; /* Protocol error. */
\r
69 STAT_COUNTER opterr; /* Error in options. */
\r
70 STAT_COUNTER err; /* Misc error. */
\r
71 STAT_COUNTER cachehit;
\r
75 STAT_COUNTER lenerr; /* Invalid length error. */
\r
76 STAT_COUNTER chkerr; /* Checksum error. */
\r
77 STAT_COUNTER v1_rxed; /* */
\r
78 STAT_COUNTER join_sent; /* */
\r
79 STAT_COUNTER leave_sent; /* */
\r
80 STAT_COUNTER unicast_query; /* */
\r
81 STAT_COUNTER report_sent; /* */
\r
82 STAT_COUNTER report_rxed; /* */
\r
83 STAT_COUNTER group_query_rxed; /* */
\r
93 struct stats_syselem {
\r
100 struct stats_syselem sem;
\r
101 struct stats_syselem mbox;
\r
106 struct stats_proto link;
\r
109 struct stats_proto etharp;
\r
112 struct stats_proto ip_frag;
\r
115 struct stats_proto ip;
\r
118 struct stats_proto icmp;
\r
121 struct stats_igmp igmp;
\r
124 struct stats_proto udp;
\r
127 struct stats_proto tcp;
\r
130 struct stats_mem mem;
\r
133 struct stats_mem memp[MEMP_MAX];
\r
136 struct stats_sys sys;
\r
140 extern struct stats_ lwip_stats;
\r
142 #define stats_init() /* Compatibility define, not init needed. */
\r
144 #define STATS_INC(x) ++lwip_stats.x
\r
146 #define stats_init()
\r
147 #define STATS_INC(x)
\r
148 #endif /* LWIP_STATS */
\r
151 #define TCP_STATS_INC(x) STATS_INC(x)
\r
153 #define TCP_STATS_INC(x)
\r
157 #define UDP_STATS_INC(x) STATS_INC(x)
\r
159 #define UDP_STATS_INC(x)
\r
163 #define ICMP_STATS_INC(x) STATS_INC(x)
\r
165 #define ICMP_STATS_INC(x)
\r
169 #define IGMP_STATS_INC(x) STATS_INC(x)
\r
171 #define IGMP_STATS_INC(x)
\r
175 #define IP_STATS_INC(x) STATS_INC(x)
\r
177 #define IP_STATS_INC(x)
\r
181 #define IPFRAG_STATS_INC(x) STATS_INC(x)
\r
183 #define IPFRAG_STATS_INC(x)
\r
187 #define ETHARP_STATS_INC(x) STATS_INC(x)
\r
189 #define ETHARP_STATS_INC(x)
\r
193 #define LINK_STATS_INC(x) STATS_INC(x)
\r
195 #define LINK_STATS_INC(x)
\r
198 /* Display of statistics */
\r
199 #if LWIP_STATS_DISPLAY
\r
200 void stats_display(void);
\r
202 #define stats_display()
\r
203 #endif /* LWIP_STATS_DISPLAY */
\r
209 #endif /* __LWIP_STATS_H__ */
\r