Added const char* name to mem- and memp-stats for easier debugging.

This commit is contained in:
goldsimon 2010-02-21 12:32:29 +00:00
parent b73dcfb8cf
commit 1d8538bca4
3 changed files with 27 additions and 1 deletions

View File

@ -13,6 +13,10 @@ HISTORY
++ New features:
2010-02-21: Simon Goldschmidt
* stats.c/.h: Added const char* name to mem- and memp-stats for easier
debugging.
2010-02-21: Simon Goldschmidt
* tcp.h (and usages), added tcp_impl.h: Splitted API and internal
implementation of tcp to make API usage cleare to application programmers

View File

@ -48,6 +48,25 @@
struct stats_ lwip_stats;
void stats_init()
{
#ifdef LWIP_DEBUG
#if MEMP_STATS
char * memp_names[] = {
#define LWIP_MEMPOOL(name,num,size,desc) desc,
#include "lwip/memp_std.h"
};
int i;
for (i = 0; i < MEMP_MAX; i++) {
lwip_stats.memp[i].name = memp_names[i];
}
#endif /* MEMP_STATS */
#if MEM_STATS
lwip_stats.mem.name = "MEM";
#endif /* MEM_STATS */
#endif /* LWIP_DEBUG */
}
#if LWIP_STATS_DISPLAY
void
stats_display_proto(struct stats_proto *proto, char *name)

View File

@ -88,6 +88,9 @@ struct stats_igmp {
};
struct stats_mem {
#ifdef LWIP_DEBUG
const char *name;
#endif /* LWIP_DEBUG */
mem_size_t avail;
mem_size_t used;
mem_size_t max;
@ -145,7 +148,7 @@ struct stats_ {
extern struct stats_ lwip_stats;
#define stats_init() /* Compatibility define, no init needed. */
void stats_init();
#define STATS_INC(x) ++lwip_stats.x
#define STATS_DEC(x) --lwip_stats.x