From: David Goulet Date: Thu, 11 Jul 2013 19:13:23 +0000 (-0400) Subject: Add snapshot mode to lttng list session X-Git-Tag: v2.3.0-rc1~44 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2cbf8fedb374f6a029811d685eca59b3c435f47e;p=lttng-tools.git Add snapshot mode to lttng list session Signed-off-by: David Goulet --- diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index 9e3924e67..4ffffd84f 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -326,12 +326,13 @@ struct lttng_calibrate { * * The structures should be initialized to zero before use. */ -#define LTTNG_SESSION_PADDING1 16 +#define LTTNG_SESSION_PADDING1 12 struct lttng_session { char name[NAME_MAX]; /* The path where traces are written */ char path[PATH_MAX]; uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */ + uint32_t snapshot_mode; char padding[LTTNG_SESSION_PADDING1]; }; diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 6000d198c..850bac508 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2160,6 +2160,7 @@ void cmd_list_lttng_sessions(struct lttng_session *sessions, uid_t uid, strncpy(sessions[i].name, session->name, NAME_MAX); sessions[i].name[NAME_MAX - 1] = '\0'; sessions[i].enabled = session->enabled; + sessions[i].snapshot_mode = session->snapshot_mode; i++; } } diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index c96d27c2a..75862ffb4 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -128,13 +128,23 @@ static const char *active_string(int value) { switch (value) { - case 0: return " [inactive]"; - case 1: return " [active]"; + case 0: return "inactive"; + case 1: return "active"; case -1: return ""; default: return NULL; } } +static const char *snapshot_string(int value) +{ + switch (value) { + case 1: + return " snapshot"; + default: + return ""; + } +} + static const char *enabled_string(int value) { @@ -620,13 +630,16 @@ static int list_sessions(const char *session_name) if (session_name != NULL) { if (strncmp(sessions[i].name, session_name, NAME_MAX) == 0) { session_found = 1; - MSG("Tracing session %s:%s", session_name, active_string(sessions[i].enabled)); + 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); break; } } else { - MSG(" %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path, - active_string(sessions[i].enabled)); + MSG(" %d) %s (%s) [%s%s]", i + 1, sessions[i].name, sessions[i].path, + active_string(sessions[i].enabled), + snapshot_string(sessions[i].snapshot_mode)); } }