ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

stats.c
Go to the documentation of this file.
00001 
00007 /*
00008  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
00009  * All rights reserved. 
00010  * 
00011  * Redistribution and use in source and binary forms, with or without modification, 
00012  * are permitted provided that the following conditions are met:
00013  *
00014  * 1. Redistributions of source code must retain the above copyright notice,
00015  *    this list of conditions and the following disclaimer.
00016  * 2. Redistributions in binary form must reproduce the above copyright notice,
00017  *    this list of conditions and the following disclaimer in the documentation
00018  *    and/or other materials provided with the distribution.
00019  * 3. The name of the author may not be used to endorse or promote products
00020  *    derived from this software without specific prior written permission. 
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
00023  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
00024  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
00025  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00026  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00027  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
00030  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
00031  * OF SUCH DAMAGE.
00032  *
00033  * This file is part of the lwIP TCP/IP stack.
00034  * 
00035  * Author: Adam Dunkels <adam@sics.se>
00036  *
00037  */
00038 
00039 #include "lwip/opt.h"
00040 
00041 #if LWIP_STATS /* don't build if not configured for use in lwipopts.h */
00042 
00043 #include "lwip/def.h"
00044 #include "lwip/stats.h"
00045 #include "lwip/mem.h"
00046 
00047 #include <string.h>
00048 
00049 struct stats_ lwip_stats;
00050 
00051 void stats_init(void)
00052 {
00053 #ifdef LWIP_DEBUG
00054 #if MEMP_STATS
00055   const char * memp_names[] = {
00056 #define LWIP_MEMPOOL(name,num,size,desc) desc,
00057 #include "lwip/memp_std.h"
00058   };
00059   int i;
00060   for (i = 0; i < MEMP_MAX; i++) {
00061     lwip_stats.memp[i].name = memp_names[i];
00062   }
00063 #endif /* MEMP_STATS */
00064 #if MEM_STATS
00065   lwip_stats.mem.name = "MEM";
00066 #endif /* MEM_STATS */
00067 #endif /* LWIP_DEBUG */
00068 }
00069 
00070 #if LWIP_STATS_DISPLAY
00071 void
00072 stats_display_proto(struct stats_proto *proto, char *name)
00073 {
00074   LWIP_PLATFORM_DIAG(("\n%s\n\t", name));
00075   LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit)); 
00076   LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv)); 
00077   LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw)); 
00078   LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop)); 
00079   LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", proto->chkerr)); 
00080   LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", proto->lenerr)); 
00081   LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", proto->memerr)); 
00082   LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F"\n\t", proto->rterr)); 
00083   LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", proto->proterr)); 
00084   LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F"\n\t", proto->opterr)); 
00085   LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n\t", proto->err)); 
00086   LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit)); 
00087 }
00088 
00089 #if IGMP_STATS
00090 void
00091 stats_display_igmp(struct stats_igmp *igmp)
00092 {
00093   LWIP_PLATFORM_DIAG(("\nIGMP\n\t"));
00094   LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", igmp->xmit)); 
00095   LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", igmp->recv)); 
00096   LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", igmp->drop)); 
00097   LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", igmp->chkerr)); 
00098   LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", igmp->lenerr)); 
00099   LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", igmp->memerr)); 
00100   LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", igmp->proterr)); 
00101   LWIP_PLATFORM_DIAG(("rx_v1: %"STAT_COUNTER_F"\n\t", igmp->rx_v1)); 
00102   LWIP_PLATFORM_DIAG(("rx_group: %"STAT_COUNTER_F"\n", igmp->rx_group));
00103   LWIP_PLATFORM_DIAG(("rx_general: %"STAT_COUNTER_F"\n", igmp->rx_general));
00104   LWIP_PLATFORM_DIAG(("rx_report: %"STAT_COUNTER_F"\n\t", igmp->rx_report)); 
00105   LWIP_PLATFORM_DIAG(("tx_join: %"STAT_COUNTER_F"\n\t", igmp->tx_join)); 
00106   LWIP_PLATFORM_DIAG(("tx_leave: %"STAT_COUNTER_F"\n\t", igmp->tx_leave)); 
00107   LWIP_PLATFORM_DIAG(("tx_report: %"STAT_COUNTER_F"\n\t", igmp->tx_report)); 
00108 }
00109 #endif /* IGMP_STATS */
00110 
00111 #if MEM_STATS || MEMP_STATS
00112 void
00113 stats_display_mem(struct stats_mem *mem, char *name)
00114 {
00115   LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name));
00116   LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail)); 
00117   LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used)); 
00118   LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max)); 
00119   LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err));
00120 }
00121 
00122 #if MEMP_STATS
00123 void
00124 stats_display_memp(struct stats_mem *mem, int index)
00125 {
00126   char * memp_names[] = {
00127 #define LWIP_MEMPOOL(name,num,size,desc) desc,
00128 #include "lwip/memp_std.h"
00129   };
00130   if(index < MEMP_MAX) {
00131     stats_display_mem(mem, memp_names[index]);
00132   }
00133 }
00134 #endif /* MEMP_STATS */
00135 #endif /* MEM_STATS || MEMP_STATS */
00136 
00137 #if SYS_STATS
00138 void
00139 stats_display_sys(struct stats_sys *sys)
00140 {
00141   LWIP_PLATFORM_DIAG(("\nSYS\n\t"));
00142   LWIP_PLATFORM_DIAG(("sem.used:  %"U32_F"\n\t", (u32_t)sys->sem.used)); 
00143   LWIP_PLATFORM_DIAG(("sem.max:   %"U32_F"\n\t", (u32_t)sys->sem.max)); 
00144   LWIP_PLATFORM_DIAG(("sem.err:   %"U32_F"\n\t", (u32_t)sys->sem.err)); 
00145   LWIP_PLATFORM_DIAG(("mutex.used: %"U32_F"\n\t", (u32_t)sys->mutex.used)); 
00146   LWIP_PLATFORM_DIAG(("mutex.max:  %"U32_F"\n\t", (u32_t)sys->mutex.max)); 
00147   LWIP_PLATFORM_DIAG(("mutex.err:  %"U32_F"\n\t", (u32_t)sys->mutex.err)); 
00148   LWIP_PLATFORM_DIAG(("mbox.used:  %"U32_F"\n\t", (u32_t)sys->mbox.used)); 
00149   LWIP_PLATFORM_DIAG(("mbox.max:   %"U32_F"\n\t", (u32_t)sys->mbox.max)); 
00150   LWIP_PLATFORM_DIAG(("mbox.err:   %"U32_F"\n\t", (u32_t)sys->mbox.err)); 
00151 }
00152 #endif /* SYS_STATS */
00153 
00154 void
00155 stats_display(void)
00156 {
00157   s16_t i;
00158 
00159   LINK_STATS_DISPLAY();
00160   ETHARP_STATS_DISPLAY();
00161   IPFRAG_STATS_DISPLAY();
00162   IP_STATS_DISPLAY();
00163   IGMP_STATS_DISPLAY();
00164   ICMP_STATS_DISPLAY();
00165   UDP_STATS_DISPLAY();
00166   TCP_STATS_DISPLAY();
00167   MEM_STATS_DISPLAY();
00168   for (i = 0; i < MEMP_MAX; i++) {
00169     MEMP_STATS_DISPLAY(i);
00170   }
00171   SYS_STATS_DISPLAY();
00172 }
00173 #endif /* LWIP_STATS_DISPLAY */
00174 
00175 #endif /* LWIP_STATS */
00176 

Generated on Sun May 27 2012 04:36:03 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.