summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/cli.c18
-rw-r--r--src/vlib/main.c25
-rw-r--r--src/vlib/threads.c30
-rw-r--r--src/vlib/threads.h2
4 files changed, 40 insertions, 35 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",
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 3c0e754169f..055ea93cec1 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -1990,6 +1990,29 @@ clib_error_t *name (vlib_main_t *vm) { return 0; }
foreach_weak_reference_stub;
#undef _
+void vl_api_set_elog_main (elog_main_t * m) __attribute__ ((weak));
+void
+vl_api_set_elog_main (elog_main_t * m)
+{
+ clib_warning ("STUB");
+}
+
+int vl_api_set_elog_trace_api_messages (int enable) __attribute__ ((weak));
+int
+vl_api_set_elog_trace_api_messages (int enable)
+{
+ clib_warning ("STUB");
+ return 0;
+}
+
+int vl_api_get_elog_trace_api_messages (void) __attribute__ ((weak));
+int
+vl_api_get_elog_trace_api_messages (void)
+{
+ clib_warning ("STUB");
+ return 0;
+}
+
/* Main function. */
int
vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
@@ -2006,6 +2029,8 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
vm->elog_main.event_ring_size = 128 << 10;
elog_init (&vm->elog_main, vm->elog_main.event_ring_size);
elog_enable_disable (&vm->elog_main, 1);
+ vl_api_set_elog_main (&vm->elog_main);
+ (void) vl_api_set_elog_trace_api_messages (1);
/* Default name. */
if (!vm->name)
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 91125387248..e59919e7a26 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -44,28 +44,6 @@ vlib_thread_main_t vlib_thread_main;
* imapacts observed timings.
*/
-u32
-elog_global_id_for_msg_name (const char *msg_name)
-{
- uword *p, r;
- static uword *h;
- u8 *name_copy;
-
- if (!h)
- h = hash_create_string (0, sizeof (uword));
-
- p = hash_get_mem (h, msg_name);
- if (p)
- return p[0];
- r = elog_string (&vlib_global_main.elog_main, "%s", msg_name);
-
- name_copy = format (0, "%s%c", msg_name, 0);
-
- hash_set_mem (h, name_copy, r);
-
- return r;
-}
-
static inline void
barrier_trace_sync (f64 t_entry, f64 t_open, f64 t_closed)
{
@@ -86,8 +64,8 @@ barrier_trace_sync (f64 t_entry, f64 t_open, f64 t_closed)
ed = ELOG_DATA (&vlib_global_main.elog_main, e);
ed->count = (int) vlib_worker_threads[0].barrier_sync_count;
- ed->caller = elog_global_id_for_msg_name
- (vlib_worker_threads[0].barrier_caller);
+ ed->caller = elog_string (&vlib_global_main.elog_main,
+ (char *) vlib_worker_threads[0].barrier_caller);
ed->t_entry = (int) (1000000.0 * t_entry);
ed->t_open = (int) (1000000.0 * t_open);
ed->t_closed = (int) (1000000.0 * t_closed);
@@ -113,8 +91,8 @@ barrier_trace_sync_rec (f64 t_entry)
ed = ELOG_DATA (&vlib_global_main.elog_main, e);
ed->depth = (int) vlib_worker_threads[0].recursion_level - 1;
- ed->caller = elog_global_id_for_msg_name
- (vlib_worker_threads[0].barrier_caller);
+ ed->caller = elog_string (&vlib_global_main.elog_main,
+ (char *) vlib_worker_threads[0].barrier_caller);
}
static inline void
diff --git a/src/vlib/threads.h b/src/vlib/threads.h
index fc34074127f..79f44c8f502 100644
--- a/src/vlib/threads.h
+++ b/src/vlib/threads.h
@@ -613,8 +613,6 @@ void
vlib_process_signal_event_mt_helper (vlib_process_signal_event_mt_args_t *
args);
void vlib_rpc_call_main_thread (void *function, u8 * args, u32 size);
-
-u32 elog_global_id_for_msg_name (const char *msg_name);
#endif /* included_vlib_threads_h */
/*