From: Mathieu Desnoyers Date: Thu, 2 Feb 2012 00:19:47 +0000 (-0500) Subject: Update loglevel ABI: only loglevel value/enum is known by UST X-Git-Tag: v1.9.5~5 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=882a56d75d6054e1bf35d1bcddd668be4da4980f;p=lttng-ust.git Update loglevel ABI: only loglevel value/enum is known by UST Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 9f36d39a..52513d12 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -377,7 +377,7 @@ static void __attribute__((destructor)) __tracepoints__destroy(void) * TRACE_INFO 6 * informational message * - * TRACE_DEBUG_SYSTEM 7 + * TRACE_SYSTEM 7 * information has system-level scope * * TRACE_PROCESS 8 @@ -416,7 +416,25 @@ static void __attribute__((destructor)) __tracepoints__destroy(void) * TRACEPOINT_LOGLEVEL. */ -#define TRACEPOINT_LOGLEVEL_ENUM(...) +enum { + TRACE_EMERG = 0, + TRACE_ALERT = 1, + TRACE_CRIT = 2, + TRACE_ERR = 3, + TRACE_WARNING = 4, + TRACE_NOTICE = 5, + TRACE_INFO = 6, + TRACE_SYSTEM = 7, + TRACE_PROCESS = 8, + TRACE_MODULE = 9, + TRACE_UNIT = 10, + TRACE_CLASS = 11, + TRACE_OBJECT = 12, + TRACE_FUNCTION = 13, + TRACE_PRINTF = 14, + TRACE_DEBUG = 15, +}; + #define TRACEPOINT_LOGLEVEL(provider, name, loglevel) #endif /* #ifndef TRACEPOINT_LOGLEVEL */ diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index c03a4da1..2f21e49b 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -32,8 +32,9 @@ enum lttng_ust_instrumentation { }; enum lttng_ust_loglevel_type { - LTTNG_UST_LOGLEVEL = 0, - LTTNG_UST_LOGLEVEL_ONLY = 1, + LTTNG_UST_LOGLEVEL_ALL = 0, + LTTNG_UST_LOGLEVEL_RANGE = 1, + LTTNG_UST_LOGLEVEL_SINGLE = 2, }; enum lttng_ust_output { @@ -63,7 +64,7 @@ struct lttng_ust_event { char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */ enum lttng_ust_loglevel_type loglevel_type; - char loglevel[LTTNG_UST_SYM_NAME_LEN]; /* loglevel name */ + int loglevel; /* value, -1: all */ /* Per instrumentation type configuration */ union { @@ -97,8 +98,7 @@ struct lttng_ust_channel_attr { struct lttng_ust_tracepoint_iter { char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */ - char loglevel[LTTNG_UST_SYM_NAME_LEN]; /* loglevel */ - int64_t loglevel_value; + int loglevel; }; struct lttng_ust_object_data { diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 249f4236..5d469930 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -184,11 +184,6 @@ struct lttng_ctx { unsigned int allocated_fields; }; -struct tracepoint_loglevel_entry { - const char *identifier; - long value; -}; - /* * Entry describing a per-session active wildcard, along with the event * attribute and channel information configuring the events that need to @@ -222,15 +217,13 @@ struct lttng_event_desc { const struct lttng_event_ctx *ctx; /* context */ const struct lttng_event_field *fields; /* event payload */ unsigned int nr_fields; - const struct tracepoint_loglevel_entry **loglevel; + const int **loglevel; }; struct lttng_probe_desc { const char *provider; const struct lttng_event_desc **event_desc; unsigned int nr_events; - const struct tracepoint_loglevel_entry **loglevels; - unsigned int nr_loglevels; struct cds_list_head head; /* chain registered probes */ }; @@ -249,9 +242,6 @@ struct ust_pending_probe; /* * ltt_event structure is referred to by the tracing fast path. It must be * kept small. - * Note about loglevel_list: this list is only used to enable/disable - * events on a per-loglevel basis. The events created internally by the - * loglevel are only freed when the session is destroyed. */ struct ltt_event { unsigned int id; diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 0bdc35be..49cac590 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -434,76 +434,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\ #undef __get_dynamic_len /* - * Stage 6.1 of tracepoint event generation. - * - * Tracepoint loglevel enumeration definition generation. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef TRACEPOINT_LOGLEVEL_ENUM -#define TRACEPOINT_LOGLEVEL_ENUM(...) __VA_ARGS__ - -#undef tp_loglevel -#define tp_loglevel(_identifier, _value) \ -static const struct tracepoint_loglevel_entry \ - _TP_COMBINE_TOKENS4(__tp_loglevel_entry__, TRACEPOINT_PROVIDER, ___, _identifier) = { \ - .identifier = #_identifier, \ - .value = (_value), \ - }; - -tp_loglevel(TRACE_EMERG, 0) -tp_loglevel(TRACE_ALERT, 1) -tp_loglevel(TRACE_CRIT, 2) -tp_loglevel(TRACE_ERR, 3) -tp_loglevel(TRACE_WARNING, 4) -tp_loglevel(TRACE_NOTICE, 5) -tp_loglevel(TRACE_INFO, 6) -tp_loglevel(TRACE_SYSTEM, 7) -tp_loglevel(TRACE_PROCESS, 8) -tp_loglevel(TRACE_MODULE, 9) -tp_loglevel(TRACE_UNIT, 10) -tp_loglevel(TRACE_CLASS, 11) -tp_loglevel(TRACE_OBJECT, 12) -tp_loglevel(TRACE_FUNCTION, 13) -tp_loglevel(TRACE_PRINTF, 14) -tp_loglevel(TRACE_DEBUG, 15) - -/* - * Stage 6.2 of tracepoint event generation. - * - * Tracepoint loglevel enumeration array generation. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef tp_loglevel -#define tp_loglevel(_identifier, _value) \ - &_TP_COMBINE_TOKENS4(__tp_loglevel_entry__, TRACEPOINT_PROVIDER, ___, _identifier), \ - -static const struct tracepoint_loglevel_entry *_TP_COMBINE_TOKENS(__tracepoint_loglevel_enum__, TRACEPOINT_PROVIDER)[] = { - tp_loglevel(TRACE_EMERG, 0) - tp_loglevel(TRACE_ALERT, 1) - tp_loglevel(TRACE_CRIT, 2) - tp_loglevel(TRACE_ERR, 3) - tp_loglevel(TRACE_WARNING, 4) - tp_loglevel(TRACE_NOTICE, 5) - tp_loglevel(TRACE_INFO, 6) - tp_loglevel(TRACE_SYSTEM, 7) - tp_loglevel(TRACE_PROCESS, 8) - tp_loglevel(TRACE_MODULE, 9) - tp_loglevel(TRACE_UNIT, 10) - tp_loglevel(TRACE_CLASS, 11) - tp_loglevel(TRACE_OBJECT, 12) - tp_loglevel(TRACE_FUNCTION, 13) - tp_loglevel(TRACE_PRINTF, 14) - tp_loglevel(TRACE_DEBUG, 15) -}; - -/* - * Stage 7 of tracepoint event generation. + * Stage 6 of tracepoint event generation. * * Tracepoint loglevel mapping definition generation. We generate a * symbol for each mapping for a provider/event to ensure at most a 1 to @@ -516,14 +447,12 @@ static const struct tracepoint_loglevel_entry *_TP_COMBINE_TOKENS(__tracepoint_l #undef TRACEPOINT_LOGLEVEL #define TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \ -static const struct tracepoint_loglevel_entry * \ - _loglevel_mapping___##__provider##___##__name = \ - &__tp_loglevel_entry__##__provider##___##__loglevel; +static const int _loglevel___##__provider##___##__name = __loglevel; #include TRACEPOINT_INCLUDE /* - * Stage 8.1 of tracepoint event generation. + * Stage 7.1 of tracepoint event generation. * * Create events description structures. We use a weakref because * loglevels are optional. If not declared, the event will point to the @@ -535,21 +464,21 @@ static const struct tracepoint_loglevel_entry * \ #undef TRACEPOINT_EVENT_INSTANCE #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ -static const struct tracepoint_loglevel_entry * \ - __ref_loglevel_mapping___##_provider##___##_name \ - __attribute__((weakref ("_loglevel_mapping___" #_provider "___" #_name))); \ +static const int * \ + __ref_loglevel___##_provider##___##_name \ + __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \ const struct lttng_event_desc __event_desc___##_provider##_##_name = { \ .fields = __event_fields___##_provider##___##_template, \ .name = #_provider ":" #_name, \ .probe_callback = (void *) &__event_probe__##_provider##___##_template,\ .nr_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_template), \ - .loglevel = &__ref_loglevel_mapping___##_provider##___##_name, \ + .loglevel = &__ref_loglevel___##_provider##___##_name, \ }; #include TRACEPOINT_INCLUDE /* - * Stage 8.2 of tracepoint event generation. + * Stage 7.2 of tracepoint event generation. * * Create array of events. */ @@ -567,7 +496,7 @@ static const struct lttng_event_desc *_TP_COMBINE_TOKENS(__event_desc___, TRACEP /* - * Stage 9 of tracepoint event generation. + * Stage 8 of tracepoint event generation. * * Create a toplevel descriptor for the whole probe. */ @@ -577,12 +506,10 @@ static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PR .provider = __tp_stringify(TRACEPOINT_PROVIDER), .event_desc = _TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER), .nr_events = _TP_ARRAY_SIZE(_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)), - .loglevels = _TP_COMBINE_TOKENS(__tracepoint_loglevel_enum__, TRACEPOINT_PROVIDER), - .nr_loglevels = _TP_ARRAY_SIZE(_TP_COMBINE_TOKENS(__tracepoint_loglevel_enum__, TRACEPOINT_PROVIDER)), }; /* - * Stage 10 of tracepoint event generation. + * Stage 9 of tracepoint event generation. * * Register/unregister probes at module load/unload. */ diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index fc7f57ca..a2746853 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -450,10 +450,9 @@ int ustctl_tracepoint_list_get(int sock, int tp_list_handle, ret = ustcomm_send_app_cmd(sock, &lum, &lur); if (ret) return ret; - DBG("received tracepoint list entry name %s loglevel %s loglevel_value %lld", + DBG("received tracepoint list entry name %s loglevel %d", lur.u.tracepoint.name, - lur.u.tracepoint.loglevel, - (unsigned long long) lur.u.tracepoint.loglevel_value); + lur.u.tracepoint.loglevel); memcpy(iter, &lur.u.tracepoint, sizeof(*iter)); return 0; } diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index ea35f647..911bf292 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -150,8 +150,6 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc) { struct wildcard_entry *wildcard; - /* TODO: get value from loglevel. */ - /* TODO: check if loglevel match */ wildcard = match_wildcard(desc->name); if (strcmp(desc->name, "lttng_ust:metadata") && wildcard) { @@ -191,8 +189,6 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc) struct ltt_event *event; struct ltt_channel *chan; - /* TODO: get value from loglevel. */ - /* TODO: check if loglevel match */ if (strncmp(name, e->name, LTTNG_UST_SYM_NAME_LEN - 1)) continue; @@ -472,8 +468,6 @@ int ltt_event_create(struct ltt_channel *chan, switch (event_param->instrumentation) { case LTTNG_UST_TRACEPOINT: event->desc = ltt_event_get(event_param->name); - /* TODO: get value from loglevel. */ - /* TODO: check if loglevel match */ if (event->desc) { ret = __tracepoint_probe_register(event_param->name, @@ -826,14 +820,12 @@ int _ltt_event_metadata_statedump(struct ltt_session *session, goto end; if (event->desc->loglevel) { - const struct tracepoint_loglevel_entry *ll_entry; + const int *ll_entry; ll_entry = *event->desc->loglevel; ret = lttng_metadata_printf(session, - " loglevel.identifier = \"%s\";\n" - " loglevel.value = %lld;\n", - ll_entry->identifier, - (long long) ll_entry->value); + " loglevel = %d;\n", + ll_entry); if (ret) goto end; } diff --git a/liblttng-ust/ltt-probes.c b/liblttng-ust/ltt-probes.c index 903e0529..35f742a9 100644 --- a/liblttng-ust/ltt-probes.c +++ b/liblttng-ust/ltt-probes.c @@ -17,6 +17,7 @@ #include #include +#include "tracepoint-internal.h" #include "ltt-tracer-core.h" #include "jhash.h" #include "error.h" @@ -168,15 +169,9 @@ int ltt_probes_get_event_list(struct lttng_ust_tracepoint_list *list) LTTNG_UST_SYM_NAME_LEN); list_entry->tp.name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0'; if (!probe_desc->event_desc[i]->loglevel) { - list_entry->tp.loglevel[0] = '\0'; - list_entry->tp.loglevel_value = 0; + list_entry->tp.loglevel = TRACE_DEFAULT; } else { - strncpy(list_entry->tp.loglevel, - (*probe_desc->event_desc[i]->loglevel)->identifier, - LTTNG_UST_SYM_NAME_LEN); - list_entry->tp.loglevel[LTTNG_UST_SYM_NAME_LEN - 1] = '\0'; - list_entry->tp.loglevel_value = - (*probe_desc->event_desc[i]->loglevel)->value; + list_entry->tp.loglevel = *(*probe_desc->event_desc[i]->loglevel); } } } @@ -259,11 +254,9 @@ void _probes_create_wildcard_events(struct wildcard_entry *entry, && (strlen(entry->name) == 1 || !strncmp(event_desc->name, entry->name, strlen(entry->name) - 1))) { - /* TODO: get value from loglevel. */ - /* TODO: check if loglevel match */ //if (event_desc->loglevel - // && (*event_desc->loglevel)->value ...) + // && (*event_desc->loglevel) ...) match = 1; } if (match) { diff --git a/liblttng-ust/tracepoint-internal.h b/liblttng-ust/tracepoint-internal.h index 8ac6487f..d736df4a 100644 --- a/liblttng-ust/tracepoint-internal.h +++ b/liblttng-ust/tracepoint-internal.h @@ -23,6 +23,11 @@ #include #include +/* + * default loglevel. + */ +#define TRACE_DEFAULT 15 + struct tracepoint_lib { struct cds_list_head list; struct tracepoint * const *tracepoints_start;