source: rtems/cpukit/libnetworking/rtems/rtems_showtcpstat.c @ c301570
Last change on this file since c301570 was c301570, checked in by Ralf Corsepius <ralf.corsepius@…>, on May 10, 2007 at 5:12:54 AM

Include <rtems/bsd/sys/queue.h> instead of <sys/queue.h>.

  • Property mode set to 100644
File size: 4.9 KB
2 *  $Id$
3 */
6#include "config.h"
9#include <sys/param.h>
10#include <rtems/bsd/sys/queue.h>
11#include <sys/systm.h>
12#include <sys/kernel.h>
13#include <sys/sysctl.h>
14#include <sys/proc.h>
15#include <sys/mbuf.h>
16#include <sys/socket.h>
17#include <net/if.h>
18#include <netinet/in.h>
19#include <netinet/in_systm.h>
20#include <netinet/ip.h>
21#include <netinet/ip_var.h>
22#include <netinet/tcp.h>
23#include <netinet/tcp_timer.h>
24#include <netinet/tcp_seq.h>
25#include <netinet/tcp_var.h>
28 * Display TCP statistics
29 * Don't lock the rest of the network tasks out while printing.
30 * It's no big deal if the values change while being printed.
31 */
32static void
33showtcpstat (const char *name, unsigned long n)
35        if (n)
36                printf ("%35s%12lu\n", name, n);
40rtems_bsdnet_show_tcp_stats (void)
42        printf ("************ TCP Statistics ************\n");
43        showtcpstat ("connections initiated", tcpstat.tcps_connattempt);
44        showtcpstat ("connections accepted", tcpstat.tcps_accepts);
45        showtcpstat ("connections established", tcpstat.tcps_connects);
46        showtcpstat ("connections dropped", tcpstat.tcps_drops);
47        showtcpstat ("embryonic connections dropped", tcpstat.tcps_conndrops);
48        showtcpstat ("conn. closed (includes drops)", tcpstat.tcps_closed);
49        showtcpstat ("segs where we tried to get rtt", tcpstat.tcps_segstimed);
50        showtcpstat ("times we succeeded", tcpstat.tcps_rttupdated);
51        showtcpstat ("delayed acks sent", tcpstat.tcps_delack);
52        showtcpstat ("conn. dropped in rxmt timeout", tcpstat.tcps_timeoutdrop);
53        showtcpstat ("retransmit timeouts", tcpstat.tcps_rexmttimeo);
54        showtcpstat ("persist timeouts", tcpstat.tcps_persisttimeo);
55        showtcpstat ("keepalive timeouts", tcpstat.tcps_keeptimeo);
56        showtcpstat ("keepalive probes sent", tcpstat.tcps_keepprobe);
57        showtcpstat ("connections dropped in keepalive", tcpstat.tcps_keepdrops);
59        showtcpstat ("total packets sent", tcpstat.tcps_sndtotal);
60        showtcpstat ("data packets sent", tcpstat.tcps_sndpack);
61        showtcpstat ("data bytes sent", tcpstat.tcps_sndbyte);
62        showtcpstat ("data packets retransmitted", tcpstat.tcps_sndrexmitpack);
63        showtcpstat ("data bytes retransmitted", tcpstat.tcps_sndrexmitbyte);
64        showtcpstat ("ack-only packets sent", tcpstat.tcps_sndacks);
65        showtcpstat ("window probes sent", tcpstat.tcps_sndprobe);
66        showtcpstat ("packets sent with URG only", tcpstat.tcps_sndurg);
67        showtcpstat ("window update-only packets sent", tcpstat.tcps_sndwinup);
68        showtcpstat ("control (SYN|FIN|RST) packets sent", tcpstat.tcps_sndctrl);
70        showtcpstat ("total packets received", tcpstat.tcps_rcvtotal);
71        showtcpstat ("packets received in sequence", tcpstat.tcps_rcvpack);
72        showtcpstat ("bytes received in sequence", tcpstat.tcps_rcvbyte);
73        showtcpstat ("packets received with ccksum errs", tcpstat.tcps_rcvbadsum);
74        showtcpstat ("packets received with bad offset", tcpstat.tcps_rcvbadoff);
75        showtcpstat ("packets received too short", tcpstat.tcps_rcvshort);
76        showtcpstat ("duplicate-only packets received", tcpstat.tcps_rcvduppack);
77        showtcpstat ("duplicate-only bytes received", tcpstat.tcps_rcvdupbyte);
78        showtcpstat ("packets with some duplicate data", tcpstat.tcps_rcvpartduppack);
79        showtcpstat ("dup. bytes in part-dup. packets", tcpstat.tcps_rcvpartdupbyte);
80        showtcpstat ("out-of-order packets received", tcpstat.tcps_rcvoopack);
81        showtcpstat ("out-of-order bytes received", tcpstat.tcps_rcvoobyte);
82        showtcpstat ("packets with data after window", tcpstat.tcps_rcvpackafterwin);
83        showtcpstat ("bytes rcvd after window", tcpstat.tcps_rcvbyteafterwin);
84        showtcpstat ("packets rcvd after \"close\"", tcpstat.tcps_rcvafterclose);
85        showtcpstat ("rcvd window probe packets", tcpstat.tcps_rcvwinprobe);
86        showtcpstat ("rcvd duplicate acks", tcpstat.tcps_rcvdupack);
87        showtcpstat ("rcvd acks for unsent data", tcpstat.tcps_rcvacktoomuch);
88        showtcpstat ("rcvd ack packets", tcpstat.tcps_rcvackpack);
89        showtcpstat ("bytes acked by rcvd acks", tcpstat.tcps_rcvackbyte);
90        showtcpstat ("rcvd window update packets", tcpstat.tcps_rcvwinupd);
91        showtcpstat ("segments dropped due to PAWS", tcpstat.tcps_pawsdrop);
92        showtcpstat ("times hdr predict ok for acks", tcpstat.tcps_predack);
93        showtcpstat ("times hdr predict ok for data pkts", tcpstat.tcps_preddat);
94        showtcpstat ("pcb cache misses", tcpstat.tcps_pcbcachemiss);
95        showtcpstat ("times cached RTT in route updated", tcpstat.tcps_cachedrtt);
96        showtcpstat ("times cached rttvar updated", tcpstat.tcps_cachedrttvar);
97        showtcpstat ("times cached ssthresh updated", tcpstat.tcps_cachedssthresh);
98        showtcpstat ("times RTT initialized from route", tcpstat.tcps_usedrtt);
99        showtcpstat ("times RTTVAR initialized from rt", tcpstat.tcps_usedrttvar);
100        showtcpstat ("times ssthresh initialized from rt", tcpstat.tcps_usedssthresh);
101        showtcpstat ("timeout in persist state", tcpstat.tcps_persistdrop);
102        showtcpstat ("bogus SYN, e.g. premature ACK", tcpstat.tcps_badsyn);
103        showtcpstat ("resends due to MTU discovery", tcpstat.tcps_mturesent);
104        showtcpstat ("listen queue overflows", tcpstat.tcps_listendrop);
105        printf ("\n");
Note: See TracBrowser for help on using the repository browser.