Update loglevel ABI: only loglevel value/enum is known by UST
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 2 Feb 2012 00:19:47 +0000 (19:19 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 2 Feb 2012 00:19:47 +0000 (19:19 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/tracepoint.h
include/lttng/ust-abi.h
include/lttng/ust-events.h
include/lttng/ust-tracepoint-event.h
liblttng-ust-ctl/ustctl.c
liblttng-ust/ltt-events.c
liblttng-ust/ltt-probes.c
liblttng-ust/tracepoint-internal.h

index 9f36d39a65cd676143a773e54edabb43204cf0f3..52513d1278f832a92fcaac8dc615e3e668891c43 100644 (file)
@@ -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 */
index c03a4da177d44ecb5811186433ca0eb342d4efe6..2f21e49b1d4f9efe69ca9395aa50a237ef399376 100644 (file)
@@ -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 {
index 249f42365ce31f90d6132bab4324d4254fbfadb8..5d469930fb47b3c880652bfe7a537e36833c419a 100644 (file)
@@ -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;
index 0bdc35be4f85ce6a7650efcea86745b5768b26cf..49cac590d421a689ab33855c6ebf63e22c863e99 100644 (file)
@@ -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 <lttng/ust-tracepoint-event-reset.h>
-
-#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 <lttng/ust-tracepoint-event-reset.h>
-
-#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.
  */
index fc7f57ca265173439fd4277e9ccbdf2107240ee2..a2746853ee532588ab24c90d1efa7e1fae8edf34 100644 (file)
@@ -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;
 }
index ea35f64745d275675b9d7fc21d81bc25aac41fde..911bf2929bd6a7bde214e315113163fff255e5b4 100644 (file)
@@ -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;
        }
index 903e05298a7c96a72f081265681d4d3c86ff8c0e..35f742a98074b1bb53b8d21de5af907e60d9cf0b 100644 (file)
@@ -17,6 +17,7 @@
 #include <helper.h>
 #include <ctype.h>
 
+#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) {
index 8ac6487f7b00078db5fa12496991b6d72decde5c..d736df4a1bd6a759753a75687af69057b73f301d 100644 (file)
 #include <urcu-bp.h>
 #include <lttng/tracepoint-types.h>
 
+/*
+ * default loglevel.
+ */
+#define TRACE_DEFAULT          15
+
 struct tracepoint_lib {
        struct cds_list_head list;
        struct tracepoint * const *tracepoints_start;
This page took 0.0314950000000001 seconds and 4 git commands to generate.