+void
+session_cli_show_events_thread (vlib_main_t * vm, u32 thread_index)
+{
+ session_worker_t *wrk;
+
+ wrk = session_main_get_worker_if_valid (thread_index);
+ if (!wrk)
+ {
+ vlib_cli_output (vm, "invalid thread index %u", thread_index);
+ return;
+ }
+
+ vlib_cli_output (vm, "Thread %d:\n", thread_index);
+ vlib_cli_output (vm, " evt elements alloc: %u",
+ pool_elts (wrk->event_elts));
+ vlib_cli_output (vm, " ctrl evt elt data alloc: %d",
+ pool_elts (wrk->ctrl_evts_data));
+}
+
+static void
+session_cli_show_events (vlib_main_t * vm, u32 thread_index)
+{
+ session_main_t *smm = &session_main;
+ if (!thread_index)
+ {
+ session_cli_show_events_thread (vm, thread_index);
+ return;
+ }
+
+ for (thread_index = 0; thread_index < vec_len (smm->wrk); thread_index++)
+ session_cli_show_events_thread (vm, thread_index);
+}
+
+static void
+session_cli_print_session_states (vlib_main_t * vm)
+{
+#define _(sym, str) vlib_cli_output (vm, str);
+ foreach_session_state
+#undef _
+}
+
+static clib_error_t *
+show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ u8 one_session = 0, do_listeners = 0, sst, do_elog = 0, do_filter = 0;
+ u32 track_index, thread_index = 0, start = 0, end = ~0, session_index;
+ unformat_input_t _line_input, *line_input = &_line_input;
+ transport_proto_t transport_proto = TRANSPORT_PROTO_INVALID;
+ session_state_t state = SESSION_N_STATES, *states = 0;
+ session_main_t *smm = &session_main;
+ clib_error_t *error = 0;
+ app_worker_t *app_wrk;
+ u32 transport_index;
+ const u8 *app_name;
+ u8 do_events = 0;
+ int verbose = 0;
+ session_t *s;
+
+ session_cli_return_if_not_enabled ();
+
+ if (!unformat_user (input, unformat_line_input, line_input))
+ {
+ session_cli_show_all_sessions (vm, 0);
+ return 0;
+ }
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "verbose %d", &verbose))
+ ;
+ else if (unformat (line_input, "verbose"))
+ verbose = 1;
+ else if (unformat (line_input, "listeners %U", unformat_transport_proto,
+ &transport_proto))
+ do_listeners = 1;
+ else if (unformat (line_input, "%U", unformat_session, &s))
+ {
+ one_session = 1;
+ }
+ else if (unformat (line_input, "thread %u index %u", &thread_index,
+ &session_index))
+ {
+ s = session_get_if_valid (session_index, thread_index);
+ if (!s)
+ {
+ vlib_cli_output (vm, "session is not allocated");
+ goto done;