summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathiasRaoul <mathias.raoul@gmail.com>2019-09-26 09:07:16 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-10-11 11:46:14 +0000
commit88af6c3f4a22d12674e7c598d0c77d0254cf0f47 (patch)
tree5f7d6734e7de3186972fff1422d4cf0b9da61633 /src
parent63f2b46a8cc0779e4a4778e47e769349c044a2a8 (diff)
quic: add cli command for stats
add command to display stats from quicly (rtt, packet loss) Type: feature Change-Id: Iaa18bc78fbf80a9367ef150a8cf4997a456c6b39 Signed-off-by: MathiasRaoul <mathias.raoul@gmail.com> (cherry picked from commit 922f0b211c160b4f1d05b87ad0103581d17efb8b)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/quic/quic.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 19004ea3bac..38f41ba8291 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -2255,6 +2255,47 @@ quic_plugin_crypto_command_fn (vlib_main_t * vm,
return 0;
}
+static u8 *
+quic_format_ctx_stat (u8 * s, va_list * args)
+{
+ quic_ctx_t *ctx = va_arg (*args, quic_ctx_t *);
+ quicly_stats_t quicly_stats;
+
+ quicly_get_stats (ctx->conn, &quicly_stats);
+
+ s = format (s, "\n\rQUIC conn stats \n\r");
+
+ s =
+ format (s, "RTT: min:%d, smoothed:%d, variance:%d, latest:%d \n\r",
+ quicly_stats.rtt.minimum, quicly_stats.rtt.smoothed,
+ quicly_stats.rtt.variance, quicly_stats.rtt.latest);
+ s = format (s, "Packet loss:%d \n\r", quicly_stats.num_packets.lost);
+
+ return s;
+}
+
+static clib_error_t *
+quic_plugin_showstats_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ quic_main_t *qm = &quic_main;
+ quic_ctx_t *ctx = NULL;
+ u32 num_workers = vlib_num_workers ();
+
+ for (int i = 0; i < num_workers + 1; i++)
+ {
+ /* *INDENT-OFF* */
+ pool_foreach (ctx, qm->ctx_pool[i],
+ ({
+ if(!(ctx->flags & QUIC_F_IS_LISTENER) && !(ctx->flags & QUIC_F_IS_STREAM))
+ vlib_cli_output (vm, "%U", quic_format_ctx_stat, ctx);
+ }));
+ /* *INDENT-ON* */
+ }
+ return 0;
+}
+
/* *INDENT-OFF* */
VLIB_CLI_COMMAND(quic_plugin_crypto_command, static)=
{
@@ -2262,6 +2303,12 @@ VLIB_CLI_COMMAND(quic_plugin_crypto_command, static)=
.short_help = "quic set crypto api [picotls, vpp]",
.function = quic_plugin_crypto_command_fn,
};
+VLIB_CLI_COMMAND(quic_plugin_stats_command, static)=
+{
+ .path = "show quic stats",
+ .short_help = "show quic stats",
+ .function = quic_plugin_showstats_command_fn,
+};
VLIB_PLUGIN_REGISTER () =
{
.version = VPP_BUILD_VER,