listing and activation of loglevel by number
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 6 Dec 2011 15:29:06 +0000 (10:29 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 6 Dec 2011 15:29:06 +0000 (10:29 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/lttng.h
lttng-sessiond/main.c
lttng-sessiond/ust-app.c
lttng/commands/enable_events.c
lttng/commands/list.c

index 3dd915f61a6f10716df834072b35767e04e87d9b..a137a4385218c91f176c14f1dc83e06b66390119 100644 (file)
@@ -145,6 +145,7 @@ struct lttng_event_function_attr {
 struct lttng_event {
        char name[LTTNG_SYMBOL_NAME_LEN];
        char loglevel[LTTNG_SYMBOL_NAME_LEN];
+       int64_t loglevel_value;
        enum lttng_event_type type;
        uint32_t enabled;
        pid_t pid;
index 46fcba9391d6dba216a726b8771cd897263709ea..0a6319f357ac99c2ddf8d3ddf33efe6bf8de7189 100644 (file)
@@ -2093,9 +2093,7 @@ static int list_lttng_ust_global_events(char *channel_name,
                        tmp[i].type = LTTNG_EVENT_FUNCTION;
                        break;
                case LTTNG_UST_TRACEPOINT_LOGLEVEL:
-                       /* TODO */
-                       ret = -LTTCOMM_NOT_IMPLEMENTED;
-                       goto error;
+                       tmp[i].type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
                        break;
                }
                i++;
index f5dfb110bd15c8116017636a96420f0b89caddaa..bd4160b9abcf2642903aeff217b35981b267282a 100644 (file)
@@ -1396,6 +1396,7 @@ int ust_app_list_events(struct lttng_event **events)
                        }
                        memcpy(tmp[count].name, iter.name, LTTNG_UST_SYM_NAME_LEN);
                        memcpy(tmp[count].loglevel, iter.loglevel, LTTNG_UST_SYM_NAME_LEN);
+                       tmp[count].loglevel_value = iter.loglevel_value;
                        tmp[count].type = LTTNG_UST_TRACEPOINT;
                        tmp[count].pid = app->key.pid;
                        tmp[count].enabled = -1;
index 5740d3cbcf95547c72f8d20080da7d8f4318140d..45cef9f60c7a6b55cd76c3ad7dc6379b9e951a2e 100644 (file)
@@ -335,19 +335,21 @@ static int enable_events(char *session_name)
                        }
                        DBG("Enabling UST event %s for channel %s",
                                        event_name, channel_name);
-                       /* Copy name and type of the event */
-                       strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
-                       ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
-                       ev.type = opt_event_type;
 
                        switch (opt_event_type) {
                        case LTTNG_EVENT_ALL:   /* Default behavior is tracepoint */
-                               ev.type = LTTNG_EVENT_TRACEPOINT;
                                /* Fall-through */
                        case LTTNG_EVENT_TRACEPOINT:
+                               /* Copy name and type of the event */
+                               ev.type = LTTNG_EVENT_TRACEPOINT;
+                               strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
+                               ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                                break;
                        case LTTNG_EVENT_TRACEPOINT_LOGLEVEL:
+                               /* Copy name and type of the event */
                                ev.type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
+                               strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
+                               ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                                break;
                        case LTTNG_EVENT_PROBE:
                        case LTTNG_EVENT_FUNCTION:
index 4b29d4dc98dced934593c6f1317a6fb1730440d2..8c1dadac8e5dc66bddebe81d7a564c9fc7c20555 100644 (file)
@@ -134,19 +134,21 @@ const char *enabled_string(int value)
 static
 const char *loglevel_string_pre(const char *loglevel)
 {
-       if (loglevel[0] == '\0')
+       if (loglevel[0] == '\0') {
                return "";
-       else
+       } else {
                return " (loglevel: ";
+       }
 }
 
 static
 const char *loglevel_string_post(const char *loglevel)
 {
-       if (loglevel[0] == '\0')
+       if (loglevel[0] == '\0') {
                return "";
-       else
+       } else {
                return ")";
+       }
 }
 
 /*
@@ -156,13 +158,26 @@ static void print_events(struct lttng_event *event)
 {
        switch (event->type) {
        case LTTNG_EVENT_TRACEPOINT:
-               MSG("%s%s%s%s%s (type: tracepoint)%s", indent6,
+       {
+               char ll_value[LTTNG_SYMBOL_NAME_LEN] = "";
+
+               if (event->loglevel[0] != '\0') {
+                       int ret;
+
+                       ret = snprintf(ll_value, LTTNG_SYMBOL_NAME_LEN,
+                               ", %lld", (long long) event->loglevel_value);
+                       if (ret < 0)
+                               ERR("snprintf error");
+               }
+               MSG("%s%s%s%s%s%s (type: tracepoint)%s", indent6,
                                event->name,
                                loglevel_string_pre(event->loglevel),
                                event->loglevel,
+                               ll_value,
                                loglevel_string_post(event->loglevel),
                                enabled_string(event->enabled));
                break;
+       }
        case LTTNG_EVENT_PROBE:
                MSG("%s%s (type: probe)%s", indent6,
                                event->name, enabled_string(event->enabled));
@@ -189,7 +204,8 @@ static void print_events(struct lttng_event *event)
                break;
        case LTTNG_EVENT_TRACEPOINT_LOGLEVEL:
                MSG("%s%s (type: tracepoint loglevel)%s", indent6,
-                               event->name, enabled_string(event->enabled));
+                       event->name,
+                       enabled_string(event->enabled));
                break;
        case LTTNG_EVENT_ALL:
                /* We should never have "all" events in list. */
This page took 0.042527 seconds and 4 git commands to generate.