From aefbedeb5da326475230c31e75d0d9d6d0de8656 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 19 Dec 2018 13:07:49 -0800 Subject: session: add cli option to dump session elog Change-Id: I1f42644f143bb65ee764c0f869b402595126adac Signed-off-by: Florin Coras --- src/vppinfra/elog.c | 25 ++++++++++++++++++++++++- src/vppinfra/elog.h | 3 ++- src/vppinfra/test_elog.c | 3 ++- 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'src/vppinfra') diff --git a/src/vppinfra/elog.c b/src/vppinfra/elog.c index 8e3f6c18dfa..6daed96719c 100644 --- a/src/vppinfra/elog.c +++ b/src/vppinfra/elog.c @@ -396,7 +396,7 @@ format_elog_event (u8 * s, va_list * va) } u8 * -format_elog_track (u8 * s, va_list * va) +format_elog_track_name (u8 * s, va_list * va) { elog_main_t *em = va_arg (*va, elog_main_t *); elog_event_t *e = va_arg (*va, elog_event_t *); @@ -404,6 +404,29 @@ format_elog_track (u8 * s, va_list * va) return format (s, "%s", t->name); } +u8 * +format_elog_track (u8 * s, va_list * args) +{ + elog_main_t *em = va_arg (*args, elog_main_t *); + f64 dt = va_arg (*args, f64); + int track_index = va_arg (*args, int); + elog_event_t *e, *es; + u8 indent; + + indent = format_get_indent (s) + 1; + + es = elog_peek_events (em); + vec_foreach (e, es) + { + if (e->track != track_index) + continue; + s = format (s, "%U%18.9f: %U\n", format_white_space, indent, e->time + dt, + format_elog_event, em, e); + } + vec_free (es); + return s; +} + void elog_time_now (elog_time_stamp_t * et) { diff --git a/src/vppinfra/elog.h b/src/vppinfra/elog.h index 322c2c63ae7..26352f7d608 100644 --- a/src/vppinfra/elog.h +++ b/src/vppinfra/elog.h @@ -515,7 +515,8 @@ void elog_merge (elog_main_t * dst, u8 * dst_tag, /* 2 arguments elog_main_t and elog_event_t to format event or track name. */ u8 *format_elog_event (u8 * s, va_list * va); -u8 *format_elog_track (u8 * s, va_list * va); +u8 *format_elog_track_name (u8 * s, va_list * va); +u8 *format_elog_track (u8 * s, va_list * args); void serialize_elog_main (serialize_main_t * m, va_list * va); void unserialize_elog_main (serialize_main_t * m, va_list * va); diff --git a/src/vppinfra/test_elog.c b/src/vppinfra/test_elog.c index 1cf5ba1f75c..6abd334e405 100644 --- a/src/vppinfra/test_elog.c +++ b/src/vppinfra/test_elog.c @@ -244,7 +244,8 @@ test_elog_main (unformat_input_t * input) vec_foreach (e, es) { clib_warning ("%18.9f: %12U %U\n", e->time, - format_elog_track, em, e, format_elog_event, em, e); + format_elog_track_name, em, e, format_elog_event, em, + e); } } -- cgit 1.2.3-korg