root/webserver/example/freeRTOS/Demo/Common/ethernet/lwIP/include/lwip/stats.h

Revision 14, 3.9 kB (checked in by phil, 15 years ago)

added unmodified FreeRTOS package V5.4.1 with only web srv demo source for LPC2368 for CrossWorks?

Line 
1 /*
2  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  *    derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
25  * OF SUCH DAMAGE.
26  *
27  * This file is part of the lwIP TCP/IP stack.
28  *
29  * Author: Adam Dunkels <adam@sics.se>
30  *
31  */
32 #ifndef __LWIP_STATS_H__
33 #define __LWIP_STATS_H__
34
35 #include "lwip/opt.h"
36 #include "arch/cc.h"
37
38 #include "lwip/mem.h"
39 #include "lwip/memp.h"
40
41 #if LWIP_STATS
42
43 struct stats_proto {
44   u16_t xmit;    /* Transmitted packets. */
45   u16_t rexmit;  /* Retransmitted packets. */
46   u16_t recv;    /* Received packets. */
47   u16_t fw;      /* Forwarded packets. */
48   u16_t drop;    /* Dropped packets. */
49   u16_t chkerr;  /* Checksum error. */
50   u16_t lenerr;  /* Invalid length error. */
51   u16_t memerr;  /* Out of memory error. */
52   u16_t rterr;   /* Routing error. */
53   u16_t proterr; /* Protocol error. */
54   u16_t opterr;  /* Error in options. */
55   u16_t err;     /* Misc error. */
56   u16_t cachehit;
57 };
58
59 struct stats_mem {
60   mem_size_t avail;
61   mem_size_t used;
62   mem_size_t max; 
63   mem_size_t err;
64 };
65
66 struct stats_pbuf {
67   u16_t avail;
68   u16_t used;
69   u16_t max; 
70   u16_t err;
71
72   u16_t alloc_locked;
73   u16_t refresh_locked;
74 };
75
76 struct stats_syselem {
77   u16_t used;
78   u16_t max;
79   u16_t err;
80 };
81
82 struct stats_sys {
83   struct stats_syselem sem;
84   struct stats_syselem mbox;
85 };
86
87 struct stats_ {
88   struct stats_proto link;
89   struct stats_proto ip_frag;
90   struct stats_proto ip;
91   struct stats_proto icmp;
92   struct stats_proto udp;
93   struct stats_proto tcp;
94   struct stats_pbuf pbuf;
95   struct stats_mem mem;
96   struct stats_mem memp[MEMP_MAX];
97   struct stats_sys sys;
98 };
99
100 extern struct stats_ lwip_stats;
101
102
103 void stats_init(void);
104
105 #define STATS_INC(x) ++lwip_stats.x
106 #else
107 #define stats_init()
108 #define STATS_INC(x)
109 #endif /* LWIP_STATS */
110
111 #if TCP_STATS
112 #define TCP_STATS_INC(x) STATS_INC(x)
113 #else
114 #define TCP_STATS_INC(x)
115 #endif
116
117 #if UDP_STATS
118 #define UDP_STATS_INC(x) STATS_INC(x)
119 #else
120 #define UDP_STATS_INC(x)
121 #endif
122
123 #if ICMP_STATS
124 #define ICMP_STATS_INC(x) STATS_INC(x)
125 #else
126 #define ICMP_STATS_INC(x)
127 #endif
128
129 #if IP_STATS
130 #define IP_STATS_INC(x) STATS_INC(x)
131 #else
132 #define IP_STATS_INC(x)
133 #endif
134
135 #if IPFRAG_STATS
136 #define IPFRAG_STATS_INC(x) STATS_INC(x)
137 #else
138 #define IPFRAG_STATS_INC(x)
139 #endif
140
141 #if LINK_STATS
142 #define LINK_STATS_INC(x) STATS_INC(x)
143 #else
144 #define LINK_STATS_INC(x)
145 #endif
146
147 /* Display of statistics */
148 #if LWIP_STATS_DISPLAY
149 void stats_display(void);
150 #else
151 #define stats_display()
152 #endif
153
154 #endif /* __LWIP_STATS_H__ */
155
156
157
158
Note: See TracBrowser for help on using the browser.