00001 /* 00002 * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright notice, 00011 * this list of conditions and the following disclaimer in the documentation 00012 * and/or other materials provided with the distribution. 00013 * 3. The name of the author may not be used to endorse or promote products 00014 * derived from this software without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00017 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00018 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00019 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00020 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00021 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00023 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00024 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00025 * OF SUCH DAMAGE. 00026 * 00027 * This file is part of the lwIP TCP/IP stack. 00028 * 00029 * Author: Adam Dunkels <adam@sics.se> 00030 * 00031 */ 00032 #ifndef __LWIP_STATS_H__ 00033 #define __LWIP_STATS_H__ 00034 00035 #include "lwip/opt.h" 00036 #include "arch/cc.h" 00037 00038 #include "lwip/mem.h" 00039 #include "lwip/memp.h" 00040 00041 #if LWIP_STATS 00042 00043 struct stats_proto { 00044 u16_t xmit; /* Transmitted packets. */ 00045 u16_t rexmit; /* Retransmitted packets. */ 00046 u16_t recv; /* Received packets. */ 00047 u16_t fw; /* Forwarded packets. */ 00048 u16_t drop; /* Dropped packets. */ 00049 u16_t chkerr; /* Checksum error. */ 00050 u16_t lenerr; /* Invalid length error. */ 00051 u16_t memerr; /* Out of memory error. */ 00052 u16_t rterr; /* Routing error. */ 00053 u16_t proterr; /* Protocol error. */ 00054 u16_t opterr; /* Error in options. */ 00055 u16_t err; /* Misc error. */ 00056 u16_t cachehit; 00057 }; 00058 00059 struct stats_mem { 00060 mem_size_t avail; 00061 mem_size_t used; 00062 mem_size_t max; 00063 mem_size_t err; 00064 }; 00065 00066 struct stats_pbuf { 00067 u16_t avail; 00068 u16_t used; 00069 u16_t max; 00070 u16_t err; 00071 00072 u16_t alloc_locked; 00073 u16_t refresh_locked; 00074 }; 00075 00076 struct stats_syselem { 00077 u16_t used; 00078 u16_t max; 00079 u16_t err; 00080 }; 00081 00082 struct stats_sys { 00083 struct stats_syselem sem; 00084 struct stats_syselem mbox; 00085 }; 00086 00087 struct stats_ { 00088 struct stats_proto link; 00089 struct stats_proto ip_frag; 00090 struct stats_proto ip; 00091 struct stats_proto icmp; 00092 struct stats_proto udp; 00093 struct stats_proto tcp; 00094 struct stats_pbuf pbuf; 00095 struct stats_mem mem; 00096 struct stats_mem memp[MEMP_MAX]; 00097 struct stats_sys sys; 00098 }; 00099 00100 extern struct stats_ lwip_stats; 00101 00102 00103 void stats_init(void); 00104 #else 00105 #define stats_init() 00106 #endif /* LWIP_STATS */ 00107 #endif /* __LWIP_STATS_H__ */ 00108 00109 00110 00111