From 31a60e22752d3daaa248ca10930f3cf4bc5f02e8 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Fri, 26 Oct 2007 18:42:59 +0000 Subject: Make Slirp statistics gathering and output conditional to LOG_ENABLED Add 'info slirp' command to monitor to display statistics Disable Slirp debugging code by default git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3451 c046a42c-6fe2-441c-8c8c-71466251a162 --- slirp/udp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'slirp/udp.c') diff --git a/slirp/udp.c b/slirp/udp.c index 44900ff144..8510380949 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -45,7 +45,9 @@ #include #include "ip_icmp.h" +#ifdef LOG_ENABLED struct udpstat udpstat; +#endif struct socket udb; @@ -86,7 +88,7 @@ udp_input(m, iphlen) DEBUG_ARG("m = %lx", (long)m); DEBUG_ARG("iphlen = %d", iphlen); - udpstat.udps_ipackets++; + STAT(udpstat.udps_ipackets++); /* * Strip IP options, if any; should skip this, @@ -113,7 +115,7 @@ udp_input(m, iphlen) if (ip->ip_len != len) { if (len > ip->ip_len) { - udpstat.udps_badlen++; + STAT(udpstat.udps_badlen++); goto bad; } m_adj(m, len - ip->ip_len); @@ -140,7 +142,7 @@ udp_input(m, iphlen) * if (uh->uh_sum) { */ if(cksum(m, len + sizeof(struct ip))) { - udpstat.udps_badsum++; + STAT(udpstat.udps_badsum++); goto bad; } } @@ -181,7 +183,7 @@ udp_input(m, iphlen) if (tmp == &udb) { so = NULL; } else { - udpstat.udpps_pcbcachemiss++; + STAT(udpstat.udpps_pcbcachemiss++); udp_last_so = so; } } @@ -299,7 +301,7 @@ int udp_output2(struct socket *so, struct mbuf *m, ((struct ip *)ui)->ip_ttl = ip_defttl; ((struct ip *)ui)->ip_tos = iptos; - udpstat.udps_opackets++; + STAT(udpstat.udps_opackets++); error = ip_output(so, m); -- cgit v1.2.3