SoW-2020-0002: Trace Hit Counters
[lttng-tools.git] / src / bin / lttng-sessiond / buffer-registry.h
index 0812414e5b4f260253f10f58d5dad2cbf4035e43..00be7b65ef66fac15862e7538e5a14d3fe9c37cc 100644 (file)
@@ -26,6 +26,14 @@ struct buffer_reg_stream {
        } obj;
 };
 
+struct buffer_reg_map_counter {
+       struct cds_list_head lnode;
+       union {
+               /* Original object data that MUST be copied over. */
+               struct lttng_ust_object_data *ust;
+       } obj;
+};
+
 struct buffer_reg_channel {
        /* This key is the same as a tracing channel key. */
        uint32_t key;
@@ -49,6 +57,25 @@ struct buffer_reg_channel {
        } obj;
 };
 
+struct buffer_reg_map {
+       /* This key is the same as a tracing map key. */
+       uint32_t key;
+       /* Per cpu counter registry object of this map registry. */
+       struct cds_list_head counters;
+       /* Total number of stream in the list. */
+       uint64_t counter_count;
+       /* Used to ensure mutual exclusion to the counter's list. */
+       pthread_mutex_t counter_list_lock;
+       /* Node for hash table usage. */
+       struct lttng_ht_node_u64 node;
+       union {
+               /* Original object data that MUST be copied over. */
+               struct lttng_ust_object_data *ust;
+       } obj;
+
+       struct ustctl_daemon_counter *daemon_counter;
+};
+
 struct buffer_reg_session {
        /* Registry per domain. */
        union {
@@ -57,6 +84,8 @@ struct buffer_reg_session {
 
        /* Contains buffer registry channel indexed by tracing channel key. */
        struct lttng_ht *channels;
+       /* Contains buffer registry map indexed by tracing map key. */
+       struct lttng_ht *maps;
 };
 
 /*
@@ -130,6 +159,17 @@ void buffer_reg_channel_remove(struct buffer_reg_session *session,
 void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
                enum lttng_domain_type domain);
 
+/* Map */
+int buffer_reg_map_create(uint64_t key, struct buffer_reg_map **regp);
+void buffer_reg_map_add(struct buffer_reg_session *session,
+               struct buffer_reg_map *map);
+struct buffer_reg_map *buffer_reg_map_find(uint64_t key,
+               struct buffer_reg_uid *reg);
+void buffer_reg_map_remove(struct buffer_reg_session *session,
+               struct buffer_reg_map *regp);
+void buffer_reg_map_destroy(struct buffer_reg_map *regp,
+               enum lttng_domain_type domain);
+
 /* Stream */
 int buffer_reg_stream_create(struct buffer_reg_stream **regp);
 void buffer_reg_stream_add(struct buffer_reg_stream *stream,
@@ -137,6 +177,13 @@ void buffer_reg_stream_add(struct buffer_reg_stream *stream,
 void buffer_reg_stream_destroy(struct buffer_reg_stream *regp,
                enum lttng_domain_type domain);
 
+/* Map counter */
+int buffer_reg_map_counter_create(struct buffer_reg_map_counter **regp);
+void buffer_reg_map_counter_add(struct buffer_reg_map_counter *map_counter,
+               struct buffer_reg_map *map);
+void buffer_reg_map_counter_destroy(struct buffer_reg_map_counter *regp,
+               enum lttng_domain_type domain);
+
 /* Global registry. */
 void buffer_reg_destroy_registries(void);
 
This page took 0.024753 seconds and 5 git commands to generate.