Support activation of loglevel by number
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 6 Dec 2011 15:29:24 +0000 (10:29 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 6 Dec 2011 15:29:24 +0000 (10:29 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-events.h
liblttng-ust/ltt-events.c
liblttng-ust/ltt-probes.c

index bcc432e74a62a64df0b1ebf00388f4c0230de32b..7f5cff846f52dd2b2099023007421759ad9fa3d6 100644 (file)
@@ -422,6 +422,7 @@ struct lttng_ust_tracepoint_iter *
        lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list *list);
 
 struct loglevel_entry *get_loglevel(const char *name);
+struct loglevel_entry *get_loglevel_value(int64_t value);
 struct session_loglevel *add_loglevel(const char *name,
        struct ltt_channel *chan,
        struct lttng_ust_event *event_param);
index b2c3a46f8a6cf3bdab1709a8fcdba2fa803a422e..7882f6d2a63b84fdc0a2659b69d3e6e6d99027c0 100644 (file)
@@ -147,6 +147,8 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc)
 
                ev_ll = *desc->loglevel;
                loglevel = get_loglevel(ev_ll->identifier);
+               if (!loglevel)
+                       loglevel = get_loglevel_value(ev_ll->value);
                if (loglevel) {
                        struct session_loglevel *sl;
 
index 25eb3f608c95cb6cf1e3f8708ca2133c7d538c7e..a8ca9dae3ec64c610e4226df87a4c2bf832ed154 100644 (file)
@@ -15,6 +15,7 @@
 #include <lttng/ust-events.h>
 #include <assert.h>
 #include <helper.h>
+#include <ctype.h>
 
 #include "ltt-tracer-core.h"
 #include "jhash.h"
@@ -230,6 +231,17 @@ struct loglevel_entry *get_loglevel(const char *name)
        return NULL;
 }
 
+struct loglevel_entry *get_loglevel_value(int64_t value)
+{
+       char name[LTTNG_UST_SYM_NAME_LEN];
+       int ret;
+
+       ret = snprintf(name, LTTNG_UST_SYM_NAME_LEN, "%lld", (long long) value);
+       if (ret < 0)
+               return NULL;
+       return get_loglevel(name);
+}
+
 /*
  * marshall all probes/all events and create those that fit the
  * loglevel. Add them to the events list as created.
@@ -246,12 +258,21 @@ void _probes_create_loglevel_events(struct loglevel_entry *entry,
                for (i = 0; i < probe_desc->nr_events; i++) {
                        const struct tracepoint_loglevel_entry *ev_ll;
                        const struct lttng_event_desc *event_desc;
+                       int match;
 
                        event_desc = probe_desc->event_desc[i];
                        if (!(event_desc->loglevel))
                                continue;
                        ev_ll = *event_desc->loglevel;
-                       if (!strcmp(ev_ll->identifier, entry->name)) {
+                       if (isalpha(entry->name[0])) {
+                               if (atoll(entry->name) == ev_ll->value) {
+                                       match = 1;
+                               }
+                       } else if (!strcmp(ev_ll->identifier, entry->name)) {
+                               match = 1;
+                       }
+
+                       if (match) {
                                struct ltt_event *ev;
                                int ret;
 
This page took 0.027415 seconds and 4 git commands to generate.