source: rtems/cpukit/libnetworking/rtems/rtems_showtcpstat.c @ 39e6e65a

4.104.114.84.95
Last change on this file since 39e6e65a was 39e6e65a, checked in by Joel Sherrill <joel.sherrill@…>, on 08/19/98 at 21:32:28

Base files

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