Add snapshot mode to lttng list session
authorDavid Goulet <dgoulet@efficios.com>
Thu, 11 Jul 2013 19:13:23 +0000 (15:13 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 12 Jul 2013 15:18:28 +0000 (11:18 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
include/lttng/lttng.h
src/bin/lttng-sessiond/cmd.c
src/bin/lttng/commands/list.c

index 9e3924e67656bf174dc373beb689078d715bc510..4ffffd84ff237bedddbf1bbc27c325c32136b521 100644 (file)
@@ -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];
 };
index 6000d198ca2c153b5791e57f7fd4e63f75a47e02..850bac508fb4972793c5991050d5c39f56a3f9fd 100644 (file)
@@ -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++;
        }
 }
index c96d27c2aad8bada8657687993412f8f9d25bfc8..75862ffb4ba224cbc402cda0bb4c7a87625d6690 100644 (file)
@@ -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));
                }
        }
 
This page took 0.030311 seconds and 4 git commands to generate.