aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-07-29 18:13:25 -0700
committerDave Barach <openvpp@barachs.net>2019-08-02 16:32:34 +0000
commitedfe0eea7a938e650074fcb82a971187a7beb12e (patch)
tree36e42838e4fc3f90594ee48b8eef3ce9c461e0e2 /src/vnet/tcp/tcp.c
parentc62a83daeac52c8642206ac1660e4e3e6ead77bf (diff)
tcp: add more connection stats
Type:feature Change-Id: If02884d0f1f26bfe31ec609ea9611cb27b699868 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp.c')
-rw-r--r--src/vnet/tcp/tcp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 5a215b658a0..adff77c14ad 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -670,6 +670,8 @@ tcp_connection_init_vars (tcp_connection_t * tc)
if (tc->flags & TCP_CONN_RATE_SAMPLE)
tcp_bt_init (tc);
+
+ tc->start_ts = tcp_time_now_us (tc->c_thread_index);
}
static int
@@ -864,6 +866,27 @@ format_tcp_congestion (u8 * s, va_list * args)
}
static u8 *
+format_tcp_stats (u8 * s, va_list * args)
+{
+ tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
+ u32 indent = format_get_indent (s);
+ s = format (s, "in segs %lu dsegs %lu bytes %lu dupacks %u\n",
+ tc->segs_in, tc->data_segs_in, tc->bytes_in, tc->dupacks_in);
+ s = format (s, "%Uout segs %lu dsegs %lu bytes %lu dupacks %u\n",
+ format_white_space, indent, tc->segs_out,
+ tc->data_segs_out, tc->bytes_out, tc->dupacks_out);
+ s = format (s, "%Ufr %u tr %u rxt segs %lu bytes %lu duration %.3f\n",
+ format_white_space, indent, tc->fr_occurences,
+ tc->tr_occurences, tc->segs_retrans, tc->bytes_retrans,
+ tcp_time_now_us (tc->c_thread_index) - tc->start_ts);
+ s = format (s, "%Uerr wnd data below %u above %u ack below %u above %u",
+ format_white_space, indent, tc->errors.below_data_wnd,
+ tc->errors.above_data_wnd, tc->errors.below_ack_wnd,
+ tc->errors.above_ack_wnd);
+ return s;
+}
+
+static u8 *
format_tcp_vars (u8 * s, va_list * args)
{
tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
@@ -896,6 +919,7 @@ format_tcp_vars (u8 * s, va_list * args)
{
s = format (s, " sboard: %U\n", format_tcp_scoreboard, &tc->sack_sb,
tc);
+ s = format (s, " stats: %U\n", format_tcp_stats, tc);
}
if (vec_len (tc->snd_sacks))
s = format (s, " sacks tx: %U\n", format_tcp_sacks, tc);