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