2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without modification,
\r
6 * are permitted provided that the following conditions are met:
\r
8 * 1. Redistributions of source code must retain the above copyright notice,
\r
9 * this list of conditions and the following disclaimer.
\r
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
11 * this list of conditions and the following disclaimer in the documentation
\r
12 * and/or other materials provided with the distribution.
\r
13 * 3. The name of the author may not be used to endorse or promote products
\r
14 * derived from this software without specific prior written permission.
\r
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
\r
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
\r
19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
\r
21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\r
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
\r
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
\r
27 * This file is part of the lwIP TCP/IP stack.
\r
29 * Author: Adam Dunkels <adam@sics.se>
\r
35 #include "lwip/opt.h"
\r
37 #include "lwip/def.h"
\r
39 #include "lwip/stats.h"
\r
40 #include "lwip/mem.h"
\r
44 struct stats_ lwip_stats;
\r
49 memset(&lwip_stats, 0, sizeof(struct stats_));
\r
51 #if LWIP_STATS_DISPLAY
\r
53 stats_display_proto(struct stats_proto *proto, char *name)
\r
55 LWIP_PLATFORM_DIAG(("\n%s\n\t", name));
\r
56 LWIP_PLATFORM_DIAG(("xmit: %"S16_F"\n\t", proto->xmit));
\r
57 LWIP_PLATFORM_DIAG(("rexmit: %"S16_F"\n\t", proto->rexmit));
\r
58 LWIP_PLATFORM_DIAG(("recv: %"S16_F"\n\t", proto->recv));
\r
59 LWIP_PLATFORM_DIAG(("fw: %"S16_F"\n\t", proto->fw));
\r
60 LWIP_PLATFORM_DIAG(("drop: %"S16_F"\n\t", proto->drop));
\r
61 LWIP_PLATFORM_DIAG(("chkerr: %"S16_F"\n\t", proto->chkerr));
\r
62 LWIP_PLATFORM_DIAG(("lenerr: %"S16_F"\n\t", proto->lenerr));
\r
63 LWIP_PLATFORM_DIAG(("memerr: %"S16_F"\n\t", proto->memerr));
\r
64 LWIP_PLATFORM_DIAG(("rterr: %"S16_F"\n\t", proto->rterr));
\r
65 LWIP_PLATFORM_DIAG(("proterr: %"S16_F"\n\t", proto->proterr));
\r
66 LWIP_PLATFORM_DIAG(("opterr: %"S16_F"\n\t", proto->opterr));
\r
67 LWIP_PLATFORM_DIAG(("err: %"S16_F"\n\t", proto->err));
\r
68 LWIP_PLATFORM_DIAG(("cachehit: %"S16_F"\n", proto->cachehit));
\r
72 stats_display_pbuf(struct stats_pbuf *pbuf)
\r
74 LWIP_PLATFORM_DIAG(("\nPBUF\n\t"));
\r
75 LWIP_PLATFORM_DIAG(("avail: %"S16_F"\n\t", pbuf->avail));
\r
76 LWIP_PLATFORM_DIAG(("used: %"S16_F"\n\t", pbuf->used));
\r
77 LWIP_PLATFORM_DIAG(("max: %"S16_F"\n\t", pbuf->max));
\r
78 LWIP_PLATFORM_DIAG(("err: %"S16_F"\n\t", pbuf->err));
\r
79 LWIP_PLATFORM_DIAG(("alloc_locked: %"S16_F"\n\t", pbuf->alloc_locked));
\r
80 LWIP_PLATFORM_DIAG(("refresh_locked: %"S16_F"\n", pbuf->refresh_locked));
\r
84 stats_display_mem(struct stats_mem *mem, char *name)
\r
86 LWIP_PLATFORM_DIAG(("\n MEM %s\n\t", name));
\r
87 LWIP_PLATFORM_DIAG(("avail: %"MEM_SIZE_F"\n\t", mem->avail));
\r
88 LWIP_PLATFORM_DIAG(("used: %"MEM_SIZE_F"\n\t", mem->used));
\r
89 LWIP_PLATFORM_DIAG(("max: %"MEM_SIZE_F"\n\t", mem->max));
\r
90 LWIP_PLATFORM_DIAG(("err: %"MEM_SIZE_F"\n", mem->err));
\r
98 char * memp_names[] = {"PBUF", "RAW_PCB", "UDP_PCB", "TCP_PCB", "TCP_PCB_LISTEN",
\r
99 "TCP_SEG", "NETBUF", "NETCONN", "API_MSG", "TCP_MSG", "TIMEOUT"};
\r
100 stats_display_proto(&lwip_stats.link, "LINK");
\r
101 stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG");
\r
102 stats_display_proto(&lwip_stats.ip, "IP");
\r
103 stats_display_proto(&lwip_stats.icmp, "ICMP");
\r
104 stats_display_proto(&lwip_stats.udp, "UDP");
\r
105 stats_display_proto(&lwip_stats.tcp, "TCP");
\r
106 stats_display_pbuf(&lwip_stats.pbuf);
\r
107 stats_display_mem(&lwip_stats.mem, "HEAP");
\r
108 for (i = 0; i < MEMP_MAX; i++) {
\r
109 stats_display_mem(&lwip_stats.memp[i], memp_names[i]);
\r
113 #endif /* LWIP_STATS_DISPLAY */
\r
114 #endif /* LWIP_STATS */
\r