summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-12-02 16:44:42 +0100
committerFlorin Coras <florin.coras@gmail.com>2019-12-11 16:46:51 +0000
commitcfdb109180cb01c17f92a465f925c244259ba06b (patch)
treeb4bf1ea473a74f5da041ec05d4a2366d9812a155 /src/vnet
parentc00f480ba080847417b4ecb41118d5079f9860c7 (diff)
session: Add mq debug cli
Type: feature This add a `show app message queue` cli command that shows mq size per app & thread. Change-Id: I5c6ce024b149fb7a47d899bc514c5a4887429982 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application.c69
1 files changed, 61 insertions, 8 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 42c5136a70b..8d8e17c8943 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -1379,9 +1379,8 @@ format_cert_key_pair (u8 * s, va_list * args)
if (ckpair->cert_key_index == 0)
s = format (s, "DEFAULT (cert:%d, key:%d)", cert_len, key_len);
else
- s =
- format (s, "%d (cert:%d, key:%d)", ckpair->cert_key_index, cert_len,
- key_len);
+ s = format (s, "%d (cert:%d, key:%d)", ckpair->cert_key_index,
+ cert_len, key_len);
return s;
}
@@ -1428,9 +1427,8 @@ u8 *
format_crypto_context (u8 * s, va_list * args)
{
crypto_context_t *crctx = va_arg (*args, crypto_context_t *);
- s =
- format (s, "[0x%x][sub%d,ckpair%x]", crctx->ctx_index,
- crctx->n_subscribers, crctx->ckpair_index);
+ s = format (s, "[0x%x][sub%d,ckpair%x]", crctx->ctx_index,
+ crctx->n_subscribers, crctx->ckpair_index);
s = format (s, "[%U]", format_crypto_engine, crctx->crypto_engine);
return s;
}
@@ -1534,11 +1532,48 @@ show_certificate_command_fn (vlib_main_t * vm, unformat_input_t * input,
return 0;
}
+static inline void
+appliction_format_app_mq (vlib_main_t * vm, application_t * app)
+{
+ app_worker_map_t *map;
+ app_worker_t *wrk;
+ /* *INDENT-OFF* */
+ pool_foreach (map, app->worker_maps, ({
+ wrk = app_worker_get (map->wrk_index);
+ vlib_cli_output (vm, "[A%d][%d]%U", app->app_index,
+ map->wrk_index, format_svm_msg_q,
+ wrk->event_queue);
+ }));
+ /* *INDENT-ON* */
+}
+
+static clib_error_t *
+appliction_format_all_app_mq (vlib_main_t * vm)
+{
+ application_t *app;
+ int i, n_threads;
+
+ n_threads = vec_len (vlib_mains);
+
+ for (i = 0; i < n_threads; i++)
+ {
+ vlib_cli_output (vm, "[Ctrl%d]%U", i, format_svm_msg_q,
+ session_main_get_vpp_event_queue (i));
+ }
+
+ /* *INDENT-OFF* */
+ pool_foreach (app, app_main.app_pool, ({
+ appliction_format_app_mq (vm, app);
+ }));
+ /* *INDENT-ON* */
+ return 0;
+}
+
static clib_error_t *
show_app_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
- int do_server = 0, do_client = 0;
+ int do_server = 0, do_client = 0, do_mq = 0;
application_t *app;
u32 app_index = ~0;
int verbose = 0;
@@ -1551,6 +1586,8 @@ show_app_command_fn (vlib_main_t * vm, unformat_input_t * input,
do_server = 1;
else if (unformat (input, "client"))
do_client = 1;
+ else if (unformat (input, "mq"))
+ do_mq = 1;
else if (unformat (input, "%u", &app_index))
;
else if (unformat (input, "verbose"))
@@ -1560,6 +1597,22 @@ show_app_command_fn (vlib_main_t * vm, unformat_input_t * input,
format_unformat_error, input);
}
+ if (do_mq && app_index != ~0)
+ {
+ app = application_get_if_valid (app_index);
+ if (!app)
+ return clib_error_return (0, "No app with index %u", app_index);
+
+ appliction_format_app_mq (vm, app);
+ return 0;
+ }
+
+ if (do_mq)
+ {
+ appliction_format_all_app_mq (vm);
+ return 0;
+ }
+
if (do_server)
{
application_format_all_listeners (vm, verbose);
@@ -1688,7 +1741,7 @@ VLIB_INIT_FUNCTION (application_init);
VLIB_CLI_COMMAND (show_app_command, static) =
{
.path = "show app",
- .short_help = "show app [server|client] [verbose]",
+ .short_help = "show app [app_id] [server|client] [mq] [verbose]",
.function = show_app_command_fn,
};