+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;
+}
+