summaryrefslogtreecommitdiffstats
path: root/src/vlib/cli.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-07-15 16:00:03 -0400
committerDamjan Marion <dmarion@me.com>2019-07-16 13:12:12 +0000
commitb09f4d0adb8364b3516c3a64e8238715887ffec8 (patch)
tree95f9f29d3d5a9c17fcff3cd670623cc16ff2806b /src/vlib/cli.c
parent7b8a30d08bffcb8c6fe7faa8d7f7dc557e175770 (diff)
api: enable binary API event logging in vat
Cleaned up a few instances of side-bet elog_string hash table usage. Elog_string handles that problem itself. Add cli commands to vat to initialize, enable/disable, and save an event log. Event logging at the same time in both vpp and vat yields a pair of event logs which can be merged by the "test_elog" tool. Type: refactor Change-Id: I8d6a72206f2309c967ea1630077fba31aef47f93 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlib/cli.c')
-rw-r--r--src/vlib/cli.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/vlib/cli.c b/src/vlib/cli.c
index bf0670da1c9..60895bacb1c 100644
--- a/src/vlib/cli.c
+++ b/src/vlib/cli.c
@@ -44,6 +44,9 @@
#include <unistd.h>
#include <ctype.h>
+int vl_api_set_elog_trace_api_messages (int enable);
+int vl_api_get_elog_trace_api_messages (void);
+
static void *current_traced_heap;
/* Root of all show commands. */
@@ -633,7 +636,7 @@ vlib_cli_dispatch_sub_commands (vlib_main_t * vm,
u32 c;
} *ed;
ed = ELOG_DATA (&vm->elog_main, e);
- ed->c = elog_global_id_for_msg_name (c->path);
+ ed->c = elog_string (&vm->elog_main, c->path);
}
if (!c->is_mp_safe)
@@ -658,16 +661,16 @@ vlib_cli_dispatch_sub_commands (vlib_main_t * vm,
u32 c, err;
} *ed;
ed = ELOG_DATA (&vm->elog_main, e);
- ed->c = elog_global_id_for_msg_name (c->path);
+ ed->c = elog_string (&vm->elog_main, c->path);
if (c_error)
{
vec_add1 (c_error->what, 0);
- ed->err = elog_global_id_for_msg_name
- ((const char *) c_error->what);
+ ed->err = elog_string (&vm->elog_main,
+ (char *) c_error->what);
_vec_len (c_error->what) -= 1;
}
else
- ed->err = elog_global_id_for_msg_name ("OK");
+ ed->err = elog_string (&vm->elog_main, "OK");
}
if (c_error)
@@ -1630,7 +1633,8 @@ elog_trace_command_fn (vlib_main_t * vm,
}
unformat_free (line_input);
- vm->elog_trace_api_messages = api ? enable : vm->elog_trace_api_messages;
+ vl_api_set_elog_trace_api_messages
+ (api ? enable : vl_api_get_elog_trace_api_messages ());
vm->elog_trace_cli_commands = cli ? enable : vm->elog_trace_cli_commands;
vm->elog_trace_graph_dispatch = dispatch ?
enable : vm->elog_trace_graph_dispatch;
@@ -1660,7 +1664,7 @@ print_status:
vlib_cli_output
(vm, " Event log API message trace: %s\n CLI command trace: %s",
- vm->elog_trace_api_messages ? "on" : "off",
+ vl_api_get_elog_trace_api_messages ()? "on" : "off",
vm->elog_trace_cli_commands ? "on" : "off");
vlib_cli_output
(vm, " Barrier sync trace: %s",