From: Mathieu Desnoyers Date: Tue, 6 Dec 2011 01:20:10 +0000 (-0500) Subject: Add loglevel to event list X-Git-Tag: v2.0-pre15~35 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=81afa345f8c652911c0684bcaa854ca8a1429947;p=lttng-tools.git Add loglevel to event list Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index 6fd56fa3e..3dd915f61 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -68,6 +68,7 @@ enum lttng_event_type { LTTNG_EVENT_FUNCTION_ENTRY = 3, LTTNG_EVENT_NOOP = 4, LTTNG_EVENT_SYSCALL = 5, + LTTNG_EVENT_TRACEPOINT_LOGLEVEL = 6, }; /* @@ -143,6 +144,7 @@ struct lttng_event_function_attr { */ struct lttng_event { char name[LTTNG_SYMBOL_NAME_LEN]; + char loglevel[LTTNG_SYMBOL_NAME_LEN]; enum lttng_event_type type; uint32_t enabled; pid_t pid; diff --git a/lttng-sessiond/ust-app.c b/lttng-sessiond/ust-app.c index 3847004d4..f5dfb110b 100644 --- a/lttng-sessiond/ust-app.c +++ b/lttng-sessiond/ust-app.c @@ -1383,7 +1383,6 @@ int ust_app_list_events(struct lttng_event **events) while ((ret = ustctl_tracepoint_list_get(app->key.sock, handle, &iter)) != -ENOENT) { - /* TODO : get loglevel too */ if (count >= nbmem) { DBG2("Reallocating event list from %zu to %zu entries", nbmem, 2 * nbmem); @@ -1396,6 +1395,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].type = LTTNG_UST_TRACEPOINT; tmp[count].pid = app->key.pid; tmp[count].enabled = -1; diff --git a/lttng/commands/list.c b/lttng/commands/list.c index abbdea1ba..4b29d4dc9 100644 --- a/lttng/commands/list.c +++ b/lttng/commands/list.c @@ -131,6 +131,24 @@ const char *enabled_string(int value) } } +static +const char *loglevel_string_pre(const char *loglevel) +{ + if (loglevel[0] == '\0') + return ""; + else + return " (loglevel: "; +} + +static +const char *loglevel_string_post(const char *loglevel) +{ + if (loglevel[0] == '\0') + return ""; + else + return ")"; +} + /* * Pretty print single event. */ @@ -138,8 +156,12 @@ static void print_events(struct lttng_event *event) { switch (event->type) { case LTTNG_EVENT_TRACEPOINT: - MSG("%s%s (type: tracepoint)%s", indent6, - event->name, enabled_string(event->enabled)); + MSG("%s%s%s%s%s (type: tracepoint)%s", indent6, + event->name, + loglevel_string_pre(event->loglevel), + event->loglevel, + loglevel_string_post(event->loglevel), + enabled_string(event->enabled)); break; case LTTNG_EVENT_PROBE: MSG("%s%s (type: probe)%s", indent6, @@ -165,6 +187,10 @@ static void print_events(struct lttng_event *event) MSG("%s (type: noop)%s", indent6, enabled_string(event->enabled)); break; + case LTTNG_EVENT_TRACEPOINT_LOGLEVEL: + MSG("%s%s (type: tracepoint loglevel)%s", indent6, + event->name, enabled_string(event->enabled)); + break; case LTTNG_EVENT_ALL: /* We should never have "all" events in list. */ assert(0);