From: Mathieu Desnoyers Date: Tue, 6 Dec 2011 15:29:24 +0000 (-0500) Subject: Support activation of loglevel by number X-Git-Tag: v1.9.1~19 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=48740cab6057816414ac66a16c17275a7713ba16;p=lttng-ust.git Support activation of loglevel by number Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index bcc432e7..7f5cff84 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -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); diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index b2c3a46f..7882f6d2 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -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; diff --git a/liblttng-ust/ltt-probes.c b/liblttng-ust/ltt-probes.c index 25eb3f60..a8ca9dae 100644 --- a/liblttng-ust/ltt-probes.c +++ b/liblttng-ust/ltt-probes.c @@ -15,6 +15,7 @@ #include #include #include +#include #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;