Namespace 'struct channel' under 'lttng_ust_lib_ring_buffer_'
[lttng-ust.git] / libringbuffer / frontend_types.h
index 629abcbd5b4186592176f2609b03d4820a56b7b8..851c8da9ac45fb9e5fbefc2f7bad1b34e6491b9f 100644 (file)
@@ -1,33 +1,17 @@
-#ifndef _LTTNG_RING_BUFFER_FRONTEND_TYPES_H
-#define _LTTNG_RING_BUFFER_FRONTEND_TYPES_H
-
 /*
- * libringbuffer/frontend_types.h
- *
- * Ring Buffer Library Synchronization Header (types).
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
  * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; only
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- *     Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Ring Buffer Library Synchronization Header (types).
  *
  * See ring_buffer_frontend.c for more information on wait-free algorithms.
  */
 
+#ifndef _LTTNG_RING_BUFFER_FRONTEND_TYPES_H
+#define _LTTNG_RING_BUFFER_FRONTEND_TYPES_H
+
+#include <stdint.h>
 #include <string.h>
 #include <time.h>      /* for timer_t */
 
@@ -49,7 +33,7 @@ enum switch_mode { SWITCH_ACTIVE, SWITCH_FLUSH };
 
 /* channel: collection of per-cpu ring buffers. */
 #define RB_CHANNEL_PADDING             32
-struct channel {
+struct lttng_ust_lib_ring_buffer_channel {
        int record_disabled;
        unsigned long commit_count_mask;        /*
                                                 * Commit count mask, removing
@@ -202,6 +186,20 @@ struct lttng_ust_lib_ring_buffer {
 
        DECLARE_SHMP(struct commit_counters_cold, commit_cold);
                                        /* Commit count per sub-buffer */
+       DECLARE_SHMP(uint64_t, ts_end); /*
+                                        * timestamp_end per sub-buffer.
+                                        * Time is sampled by the
+                                        * switch_*_end() callbacks
+                                        * which are the last space
+                                        * reservation performed in the
+                                        * sub-buffer before it can be
+                                        * fully committed and
+                                        * delivered. This time value is
+                                        * then read by the deliver
+                                        * callback, performed by the
+                                        * last commit before the buffer
+                                        * becomes readable.
+                                        */
        long active_readers;            /*
                                         * Active readers count
                                         * standard atomic access (shared)
@@ -224,7 +222,7 @@ struct lttng_ust_lib_ring_buffer {
 } __attribute__((aligned(CAA_CACHE_LINE_SIZE)));
 
 static inline
-void *channel_get_private(struct channel *chan)
+void *channel_get_private(struct lttng_ust_lib_ring_buffer_channel *chan)
 {
        return ((char *) chan) + chan->priv_data_offset;
 }
@@ -240,14 +238,15 @@ void *channel_get_private(struct channel *chan)
  */
 #define CHAN_WARN_ON(c, cond)                                          \
        ({                                                              \
-               struct channel *__chan;                                 \
+               struct lttng_ust_lib_ring_buffer_channel *__chan;       \
                int _____ret = caa_unlikely(cond);                              \
                if (_____ret) {                                         \
                        if (__rb_same_type(*(c), struct channel_backend))       \
                                __chan = caa_container_of((void *) (c), \
-                                                       struct channel, \
-                                                       backend);       \
-                       else if (__rb_same_type(*(c), struct channel))  \
+                                       struct lttng_ust_lib_ring_buffer_channel, \
+                                       backend);                       \
+                       else if (__rb_same_type(*(c),                   \
+                                       struct lttng_ust_lib_ring_buffer_channel)) \
                                __chan = (void *) (c);                  \
                        else                                            \
                                BUG_ON(1);                              \
This page took 0.024788 seconds and 4 git commands to generate.