From 28a20cd344bf8a6ca866d8faa6b325c7c97289bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 26 Mar 2019 19:43:50 -0400 Subject: [PATCH] lttng: clean-up printout of session output destination MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit fixes three UX problems with lttng's list command output. 1) The list command currently repeats the session's output location twice, e.g. auto-20190326-192630 (/home/jgalar/lttng-traces/auto-20190326-192630) [inactive] Trace path: /home/jgalar/lttng-traces/auto-20190326-192630 2) In the case of a snapshot session, the parentheses are empty and the "Trace path:" line is empty, e.g. auto-20190326-192613 () [inactive snapshot] Trace path: 3) The term "path" is used even though the output may be a network location, e.g. auto-20190326-194856 (tcp4://127.0.0.1:5342/ [data: 5343]) [inactive] Trace path: tcp4://127.0.0.1:5342/ [data: 5343] The new output omits the output location in parentheses, doesn't print the "Trace path" line if no output is specified, and uses the generic "output" terminology rather than "path". Signed-off-by: Jérémie Galarneau --- src/bin/lttng/commands/list.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index d43127d1d..28166c8be 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -24,6 +24,7 @@ #include #include +#include #include #include "../command.h" @@ -1858,7 +1859,6 @@ static int list_sessions(const char *session_name) MSG("Available tracing sessions:"); } - for (i = 0; i < count; i++) { if (session_name != NULL) { if (strncmp(sessions[i].name, session_name, NAME_MAX) == 0) { @@ -1866,20 +1866,25 @@ static int list_sessions(const char *session_name) MSG("Tracing session %s: [%s%s]", session_name, active_string(sessions[i].enabled), snapshot_string(sessions[i].snapshot_mode)); - MSG("%sTrace path: %s\n", indent4, sessions[i].path); + if (*sessions[i].path) { + MSG("%sTrace output: %s\n", indent4, sessions[i].path); + } memcpy(&listed_session, &sessions[i], sizeof(listed_session)); break; } } else { - MSG(" %d) %s (%s) [%s%s]", i + 1, - sessions[i].name, sessions[i].path, + MSG(" %d) %s [%s%s]", i + 1, + sessions[i].name, active_string(sessions[i].enabled), snapshot_string(sessions[i].snapshot_mode)); - MSG("%sTrace path: %s", indent4, sessions[i].path); + if (*sessions[i].path) { + MSG("%sTrace output: %s", indent4, sessions[i].path); + } if (sessions[i].live_timer_interval != 0) { - MSG("%sLive timer interval: %u µs", indent4, - sessions[i].live_timer_interval); + MSG("%sLive timer interval: %u %s", indent4, + sessions[i].live_timer_interval, + USEC_UNIT); } MSG(""); } -- 2.34.1