Refactoring: move event id field to lttng_ust_event_session_common_private
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 11 Nov 2021 19:14:06 +0000 (14:14 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Jul 2024 15:39:52 +0000 (11:39 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ideb8da3c1003872eeba6ed3c0d5ee6cf183934e3

src/common/counter-clients/percpu-32-modular.c
src/common/counter-clients/percpu-64-modular.c
src/common/events.h
src/common/ringbuffer-clients/template.h
src/lib/lttng-ust/lttng-events.c

index 9d0add6fda5bd5f92fac181c9d2431b34b49b6e3..8675dc3d1837bd22c0d9d2fb96639e31c268cee9 100644 (file)
@@ -71,7 +71,7 @@ static int counter_add(struct lttng_ust_channel_counter *counter,
 static int event_counter_add(struct lttng_ust_event_counter *event_counter, int64_t v)
 {
        struct lttng_ust_channel_counter *counter = event_counter->chan;
-       size_t index = event_counter->priv->counter_index;
+       size_t index = event_counter->priv->parent.id;
 
        return counter_add(counter, &index, v);
 }
index 98509b3456503d32136c55d919e8786663b67b2b..c73f8d99ffca2c372a02bb4d187754bad3bdb5c4 100644 (file)
@@ -71,7 +71,7 @@ static int counter_add(struct lttng_ust_channel_counter *counter,
 static int event_counter_add(struct lttng_ust_event_counter *event_counter, int64_t v)
 {
        struct lttng_ust_channel_counter *counter = event_counter->chan;
-       size_t index = event_counter->priv->counter_index;
+       size_t index = event_counter->priv->parent.id;
 
        return counter_add(counter, &index, v);
 }
index ff86c016204d1b50359d2fc5cf42e8adb99aa818..c8d370463383920d022a515641a4ce9d21775101 100644 (file)
@@ -310,13 +310,14 @@ struct lttng_ust_event_session_common_private {
        struct lttng_ust_ctx *ctx;
 
        struct lttng_ust_channel_common *chan;
+
+       uint64_t id;                            /* Event id */
 };
 
 struct lttng_ust_event_recorder_private {
        struct lttng_ust_event_session_common_private parent;
 
        struct lttng_ust_event_recorder *pub;   /* Public event interface */
-       unsigned int id;
 };
 
 struct lttng_ust_event_counter_private {
@@ -324,7 +325,6 @@ struct lttng_ust_event_counter_private {
 
        struct lttng_ust_event_counter *pub;    /* Public event interface */
        char key[LTTNG_KEY_TOKEN_STRING_LEN_MAX];
-       uint64_t counter_index;
 };
 
 struct lttng_ust_event_notifier_private {
index 98cc9ef5860d5ff68e7b61f20a3f361317fc4b4f..96c55d8bbfb4562c1c81f5ae01a8903d2291fadb 100644 (file)
@@ -687,7 +687,7 @@ int lttng_event_reserve(struct lttng_ust_ring_buffer_ctx *ctx)
        struct lttng_ust_ring_buffer_ctx_private *private_ctx;
        uint32_t event_id;
 
-       event_id = event_recorder->priv->id;
+       event_id = (uint32_t) event_recorder->priv->parent.id;
        client_ctx.chan_ctx = lttng_ust_rcu_dereference(lttng_chan->priv->ctx);
        client_ctx.event_ctx = lttng_ust_rcu_dereference(event_recorder->priv->parent.ctx);
        /* Compute internal size of context structures. */
index cbc887d03846647ed28399bcbbff3a5157bbce71..c5ca6aaa9d3263805f8e0a7fd649d539b010496c 100644 (file)
@@ -965,15 +965,13 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en
                struct lttng_ust_event_recorder_private *event_recorder_priv =
                        caa_container_of(event->priv, struct lttng_ust_event_recorder_private, parent.parent);
                struct lttng_ust_session *session = event_recorder_enabler->chan->parent->session;
-               uint64_t id;
-               int ret;
 
                notify_socket = lttng_get_notify_socket(session->priv->owner);
                if (notify_socket < 0)
                        return notify_socket;
 
                /* Fetch event ID from sessiond */
-               ret = ustcomm_register_event(notify_socket,
+               return ustcomm_register_event(notify_socket,
                        session,
                        session->priv->objd,
                        event_recorder_enabler->chan->priv->parent.objd,
@@ -984,11 +982,7 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en
                        desc->tp_class->fields,
                        uri,
                        0,
-                       &id);
-               if (ret)
-                       return ret;
-               event_recorder_priv->id = id;
-               return 0;
+                       &event_recorder_priv->parent.id);
        }
 
        case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
@@ -1018,7 +1012,7 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en
                        desc->tp_class->fields,
                        uri,
                        event_counter_enabler->parent.parent.user_token,
-                       &event_counter_priv->counter_index);
+                       &event_counter_priv->parent.id);
        }
        default:
                return -EINVAL;
This page took 0.028058 seconds and 4 git commands to generate.