2007-08-09 22:21:44 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Statistics module
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2002-10-19 12:59:30 +00:00
|
|
|
/*
|
2004-02-07 00:30:03 +00:00
|
|
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
2002-10-19 12:59:30 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
* are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
|
|
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
|
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
|
|
|
* OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* This file is part of the lwIP TCP/IP stack.
|
|
|
|
*
|
|
|
|
* Author: Adam Dunkels <adam@sics.se>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "lwip/opt.h"
|
|
|
|
|
2007-09-07 23:01:59 +00:00
|
|
|
#if LWIP_STATS /* don't build if not configured for use in lwipopts.h */
|
2002-10-19 12:59:30 +00:00
|
|
|
|
2007-09-07 23:01:59 +00:00
|
|
|
#include "lwip/def.h"
|
2002-10-19 12:59:30 +00:00
|
|
|
#include "lwip/stats.h"
|
|
|
|
#include "lwip/mem.h"
|
|
|
|
|
2007-09-07 23:01:59 +00:00
|
|
|
#include <string.h>
|
2002-10-19 12:59:30 +00:00
|
|
|
|
2002-12-18 12:49:01 +00:00
|
|
|
struct stats_ lwip_stats;
|
2003-11-14 13:17:23 +00:00
|
|
|
|
2004-03-26 12:47:57 +00:00
|
|
|
#if LWIP_STATS_DISPLAY
|
2004-03-26 12:40:58 +00:00
|
|
|
void
|
|
|
|
stats_display_proto(struct stats_proto *proto, char *name)
|
|
|
|
{
|
|
|
|
LWIP_PLATFORM_DIAG(("\n%s\n\t", name));
|
2007-03-22 16:36:45 +00:00
|
|
|
LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit));
|
|
|
|
LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv));
|
|
|
|
LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw));
|
|
|
|
LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop));
|
|
|
|
LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", proto->chkerr));
|
|
|
|
LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", proto->lenerr));
|
|
|
|
LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", proto->memerr));
|
|
|
|
LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F"\n\t", proto->rterr));
|
|
|
|
LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", proto->proterr));
|
|
|
|
LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F"\n\t", proto->opterr));
|
|
|
|
LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n\t", proto->err));
|
|
|
|
LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit));
|
2004-03-26 12:40:58 +00:00
|
|
|
}
|
|
|
|
|
2008-06-27 18:37:53 +00:00
|
|
|
#if IGMP_STATS
|
2007-08-09 20:09:22 +00:00
|
|
|
void
|
|
|
|
stats_display_igmp(struct stats_igmp *igmp)
|
|
|
|
{
|
|
|
|
LWIP_PLATFORM_DIAG(("\nIGMP\n\t"));
|
2010-02-08 19:19:26 +00:00
|
|
|
LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", igmp->xmit));
|
|
|
|
LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", igmp->recv));
|
|
|
|
LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", igmp->drop));
|
2007-08-09 20:09:22 +00:00
|
|
|
LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", igmp->chkerr));
|
2010-02-08 19:19:26 +00:00
|
|
|
LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", igmp->lenerr));
|
|
|
|
LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", igmp->memerr));
|
|
|
|
LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", igmp->proterr));
|
|
|
|
LWIP_PLATFORM_DIAG(("rx_v1: %"STAT_COUNTER_F"\n\t", igmp->rx_v1));
|
|
|
|
LWIP_PLATFORM_DIAG(("rx_group: %"STAT_COUNTER_F"\n", igmp->rx_group));
|
|
|
|
LWIP_PLATFORM_DIAG(("rx_general: %"STAT_COUNTER_F"\n", igmp->rx_general));
|
|
|
|
LWIP_PLATFORM_DIAG(("rx_report: %"STAT_COUNTER_F"\n\t", igmp->rx_report));
|
|
|
|
LWIP_PLATFORM_DIAG(("tx_join: %"STAT_COUNTER_F"\n\t", igmp->tx_join));
|
|
|
|
LWIP_PLATFORM_DIAG(("tx_leave: %"STAT_COUNTER_F"\n\t", igmp->tx_leave));
|
|
|
|
LWIP_PLATFORM_DIAG(("tx_report: %"STAT_COUNTER_F"\n\t", igmp->tx_report));
|
2007-08-09 20:09:22 +00:00
|
|
|
}
|
2008-06-27 18:37:53 +00:00
|
|
|
#endif /* IGMP_STATS */
|
2007-08-09 20:09:22 +00:00
|
|
|
|
2008-06-27 18:37:53 +00:00
|
|
|
#if MEM_STATS || MEMP_STATS
|
2004-03-26 12:40:58 +00:00
|
|
|
void
|
|
|
|
stats_display_mem(struct stats_mem *mem, char *name)
|
|
|
|
{
|
2007-08-09 20:09:22 +00:00
|
|
|
LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name));
|
2008-03-04 16:31:31 +00:00
|
|
|
LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail));
|
|
|
|
LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used));
|
|
|
|
LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max));
|
|
|
|
LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err));
|
2004-03-26 12:40:58 +00:00
|
|
|
}
|
|
|
|
|
2008-06-27 18:37:53 +00:00
|
|
|
#if MEMP_STATS
|
2004-03-26 12:40:58 +00:00
|
|
|
void
|
2008-06-27 18:37:53 +00:00
|
|
|
stats_display_memp(struct stats_mem *mem, int index)
|
2004-03-26 12:40:58 +00:00
|
|
|
{
|
2007-03-20 18:12:06 +00:00
|
|
|
char * memp_names[] = {
|
2007-08-17 17:49:17 +00:00
|
|
|
#define LWIP_MEMPOOL(name,num,size,desc) desc,
|
2007-08-20 16:42:16 +00:00
|
|
|
#include "lwip/memp_std.h"
|
2007-03-20 18:12:06 +00:00
|
|
|
};
|
2008-06-27 18:37:53 +00:00
|
|
|
if(index < MEMP_MAX) {
|
|
|
|
stats_display_mem(mem, memp_names[index]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* MEMP_STATS */
|
|
|
|
#endif /* MEM_STATS || MEMP_STATS */
|
|
|
|
|
|
|
|
#if SYS_STATS
|
|
|
|
void
|
|
|
|
stats_display_sys(struct stats_sys *sys)
|
|
|
|
{
|
|
|
|
LWIP_PLATFORM_DIAG(("\nSYS\n\t"));
|
|
|
|
LWIP_PLATFORM_DIAG(("sem.used: %"U32_F"\n\t", (u32_t)sys->sem.used));
|
|
|
|
LWIP_PLATFORM_DIAG(("sem.max: %"U32_F"\n\t", (u32_t)sys->sem.max));
|
|
|
|
LWIP_PLATFORM_DIAG(("sem.err: %"U32_F"\n\t", (u32_t)sys->sem.err));
|
|
|
|
LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F"\n\t", (u32_t)sys->mbox.used));
|
|
|
|
LWIP_PLATFORM_DIAG(("mbox.max: %"U32_F"\n\t", (u32_t)sys->mbox.max));
|
|
|
|
LWIP_PLATFORM_DIAG(("mbox.err: %"U32_F"\n\t", (u32_t)sys->mbox.err));
|
|
|
|
}
|
|
|
|
#endif /* SYS_STATS */
|
|
|
|
|
|
|
|
void
|
|
|
|
stats_display(void)
|
|
|
|
{
|
|
|
|
s16_t i;
|
|
|
|
|
|
|
|
LINK_STATS_DISPLAY();
|
|
|
|
ETHARP_STATS_DISPLAY();
|
|
|
|
IPFRAG_STATS_DISPLAY();
|
|
|
|
IP_STATS_DISPLAY();
|
|
|
|
IGMP_STATS_DISPLAY();
|
|
|
|
ICMP_STATS_DISPLAY();
|
|
|
|
UDP_STATS_DISPLAY();
|
|
|
|
TCP_STATS_DISPLAY();
|
|
|
|
MEM_STATS_DISPLAY();
|
2004-03-26 12:40:58 +00:00
|
|
|
for (i = 0; i < MEMP_MAX; i++) {
|
2008-06-27 18:37:53 +00:00
|
|
|
MEMP_STATS_DISPLAY(i);
|
2004-03-26 12:40:58 +00:00
|
|
|
}
|
2008-06-27 18:37:53 +00:00
|
|
|
SYS_STATS_DISPLAY();
|
2004-03-26 12:40:58 +00:00
|
|
|
}
|
2004-03-26 12:47:57 +00:00
|
|
|
#endif /* LWIP_STATS_DISPLAY */
|
2007-09-07 23:01:59 +00:00
|
|
|
|
2003-03-19 12:37:46 +00:00
|
|
|
#endif /* LWIP_STATS */
|
2003-11-14 13:17:23 +00:00
|
|
|
|