From bf52024c7fcd67dfa21d2b6848f2c1edfabd5d93 Mon Sep 17 00:00:00 2001 From: Jacob Potter Date: Sat, 13 Dec 2008 20:27:32 -0500 Subject: [PATCH] some better debugging output from lwip --- lwip/src/core/stats.c | 58 ++++++++++++++++++------------------- lwip/src/include/arch/cc.h | 3 +- lwip/src/include/lwipopts.h | 3 ++ 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/lwip/src/core/stats.c b/lwip/src/core/stats.c index 0604468..2d5c1e3 100644 --- a/lwip/src/core/stats.c +++ b/lwip/src/core/stats.c @@ -52,45 +52,45 @@ struct stats_ lwip_stats; void stats_display_proto(struct stats_proto *proto, char *name) { - LWIP_PLATFORM_DIAG(("\n%s\n\t", name)); - LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit)); - LWIP_PLATFORM_DIAG(("rexmit: %"STAT_COUNTER_F"\n\t", proto->rexmit)); - 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)); + LWIP_PLATFORM_DIAG(("%s", name)); + LWIP_PLATFORM_DIAG((" xmit: %"STAT_COUNTER_F, proto->xmit)); + LWIP_PLATFORM_DIAG((" rexmit: %"STAT_COUNTER_F, proto->rexmit)); + LWIP_PLATFORM_DIAG((" recv: %"STAT_COUNTER_F, proto->recv)); + LWIP_PLATFORM_DIAG((" fw: %"STAT_COUNTER_F, proto->fw)); + LWIP_PLATFORM_DIAG((" drop: %"STAT_COUNTER_F, proto->drop)); + LWIP_PLATFORM_DIAG((" chkerr: %"STAT_COUNTER_F, proto->chkerr)); + LWIP_PLATFORM_DIAG((" lenerr: %"STAT_COUNTER_F, proto->lenerr)); + LWIP_PLATFORM_DIAG((" memerr: %"STAT_COUNTER_F, proto->memerr)); + LWIP_PLATFORM_DIAG((" rterr: %"STAT_COUNTER_F, proto->rterr)); + LWIP_PLATFORM_DIAG((" proterr: %"STAT_COUNTER_F, proto->proterr)); + LWIP_PLATFORM_DIAG((" opterr: %"STAT_COUNTER_F, proto->opterr)); + LWIP_PLATFORM_DIAG((" err: %"STAT_COUNTER_F, proto->err)); + LWIP_PLATFORM_DIAG((" cachehit: %"STAT_COUNTER_F, proto->cachehit)); } void stats_display_igmp(struct stats_igmp *igmp) { - LWIP_PLATFORM_DIAG(("\nIGMP\n\t")); - LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", igmp->lenerr)); - LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", igmp->chkerr)); - LWIP_PLATFORM_DIAG(("v1_rxed: %"STAT_COUNTER_F"\n\t", igmp->v1_rxed)); - LWIP_PLATFORM_DIAG(("join_sent: %"STAT_COUNTER_F"\n\t", igmp->join_sent)); - LWIP_PLATFORM_DIAG(("leave_sent: %"STAT_COUNTER_F"\n\t", igmp->leave_sent)); - LWIP_PLATFORM_DIAG(("unicast_query: %"STAT_COUNTER_F"\n\t", igmp->unicast_query)); - LWIP_PLATFORM_DIAG(("report_sent: %"STAT_COUNTER_F"\n\t", igmp->report_sent)); - LWIP_PLATFORM_DIAG(("report_rxed: %"STAT_COUNTER_F"\n\t", igmp->report_rxed)); - LWIP_PLATFORM_DIAG(("group_query_rxed: %"STAT_COUNTER_F"\n", igmp->group_query_rxed)); + LWIP_PLATFORM_DIAG(("IGMP")); + LWIP_PLATFORM_DIAG((" lenerr: %"STAT_COUNTER_F, igmp->lenerr)); + LWIP_PLATFORM_DIAG((" chkerr: %"STAT_COUNTER_F, igmp->chkerr)); + LWIP_PLATFORM_DIAG((" v1_rxed: %"STAT_COUNTER_F, igmp->v1_rxed)); + LWIP_PLATFORM_DIAG((" join_sent: %"STAT_COUNTER_F, igmp->join_sent)); + LWIP_PLATFORM_DIAG((" leave_sent: %"STAT_COUNTER_F, igmp->leave_sent)); + LWIP_PLATFORM_DIAG((" unicast_query: %"STAT_COUNTER_F, igmp->unicast_query)); + LWIP_PLATFORM_DIAG((" report_sent: %"STAT_COUNTER_F, igmp->report_sent)); + LWIP_PLATFORM_DIAG((" report_rxed: %"STAT_COUNTER_F, igmp->report_rxed)); + LWIP_PLATFORM_DIAG((" group_query_rxed: %"STAT_COUNTER_F, igmp->group_query_rxed)); } void stats_display_mem(struct stats_mem *mem, char *name) { - LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name)); - 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)); + LWIP_PLATFORM_DIAG(("MEM %s", name)); + LWIP_PLATFORM_DIAG((" avail: %"U32_F, (u32_t)mem->avail)); + LWIP_PLATFORM_DIAG((" used: %"U32_F, (u32_t)mem->used)); + LWIP_PLATFORM_DIAG((" max: %"U32_F, (u32_t)mem->max)); + LWIP_PLATFORM_DIAG((" err: %"U32_F, (u32_t)mem->err)); } void diff --git a/lwip/src/include/arch/cc.h b/lwip/src/include/arch/cc.h index df50e8d..7878080 100644 --- a/lwip/src/include/arch/cc.h +++ b/lwip/src/include/arch/cc.h @@ -3,6 +3,7 @@ #include #include +#include #include typedef uint8_t u8_t; @@ -28,7 +29,7 @@ typedef uint32_t mem_ptr_t; #define LWIP_PLATFORM_HTONS(x) htons(x) #define LWIP_PLATFORM_HTONL(x) htonl(x) -#define LWIP_PLATFORM_DIAG(x) dolog(x) +#define LWIP_PLATFORM_DIAG(x) outputf x #define LWIP_PLATFORM_ASSERT(x) dologf("ASSERT FAILED: %s\n", (x)); #endif diff --git a/lwip/src/include/lwipopts.h b/lwip/src/include/lwipopts.h index 9c92b59..368bf86 100644 --- a/lwip/src/include/lwipopts.h +++ b/lwip/src/include/lwipopts.h @@ -28,5 +28,8 @@ extern void _memcpy(void *dest, const void *src, int bytes); #define PBUF_POOL_BUFSIZE 512 #define LWIP_STATS 1 +#define LWIP_STATS_DISPLAY 1 +#define U16_F "d" +#define U32_F "d" #endif -- 2.43.0