Implement file-backed ring buffer
[lttng-ust.git] / include / lttng / ust-events.h
index ac412624054e16da6a0bc822ab03f82364e208b3..e4b4edeba005e25e926a54a7674d51915e766d65 100644 (file)
 #include <urcu/list.h>
 #include <urcu/hlist.h>
 #include <stdint.h>
+#include <lttng/ust-config.h>
 #include <lttng/ust-abi.h>
 #include <lttng/ust-tracer.h>
 #include <lttng/ust-endian.h>
 #include <float.h>
+#include <errno.h>
+#include <urcu/ref.h>
+#include <pthread.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -236,6 +240,8 @@ union lttng_ctx_value {
        double d;
 };
 
+struct lttng_perf_counter_field;
+
 #define LTTNG_UST_CTX_FIELD_PADDING    40
 struct lttng_ctx_field {
        struct lttng_event_field event_field;
@@ -246,16 +252,18 @@ struct lttng_ctx_field {
        void (*get_value)(struct lttng_ctx_field *field,
                         union lttng_ctx_value *value);
        union {
+               struct lttng_perf_counter_field *perf_counter;
                char padding[LTTNG_UST_CTX_FIELD_PADDING];
        } u;
        void (*destroy)(struct lttng_ctx_field *field);
 };
 
-#define LTTNG_UST_CTX_PADDING  24
+#define LTTNG_UST_CTX_PADDING  20
 struct lttng_ctx {
        struct lttng_ctx_field *fields;
        unsigned int nr_fields;
        unsigned int allocated_fields;
+       unsigned int largest_align;
        char padding[LTTNG_UST_CTX_PADDING];
 };
 
@@ -431,9 +439,13 @@ struct lttng_channel_ops {
                        unsigned int switch_timer_interval,
                        unsigned int read_timer_interval,
                        unsigned char *uuid,
-                       uint32_t chan_id);
+                       uint32_t chan_id,
+                       const char *shm_path);
        void (*channel_destroy)(struct lttng_channel *chan);
-       void *_deprecated1;
+       union {
+               void *_deprecated1;
+               unsigned long has_strcpy:1;             /* ABI has strcpy */
+       } u;
        void *_deprecated2;
        int (*event_reserve)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
                             uint32_t event_id);
@@ -452,6 +464,8 @@ struct lttng_channel_ops {
        int (*is_finalized)(struct channel *chan);
        int (*is_disabled)(struct channel *chan);
        int (*flush_buffer)(struct channel *chan, struct lttng_ust_shm_handle *handle);
+       void (*event_strcpy)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
+                       const char *src, size_t len);
 };
 
 /*
@@ -578,6 +592,7 @@ void lttng_probes_exit(void);
 int lttng_find_context(struct lttng_ctx *ctx, const char *name);
 int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
 struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p);
+void lttng_context_update(struct lttng_ctx *ctx);
 void lttng_remove_context_field(struct lttng_ctx **ctx_p,
                                struct lttng_ctx_field *field);
 void lttng_destroy_context(struct lttng_ctx *ctx);
@@ -589,6 +604,33 @@ int lttng_add_ip_to_ctx(struct lttng_ctx **ctx);
 void lttng_context_vtid_reset(void);
 void lttng_context_vpid_reset(void);
 
+#ifdef LTTNG_UST_HAVE_PERF_EVENT
+int lttng_add_perf_counter_to_ctx(uint32_t type,
+                                 uint64_t config,
+                                 const char *name,
+                                 struct lttng_ctx **ctx);
+int lttng_perf_counter_init(void);
+void lttng_perf_counter_exit(void);
+#else /* #ifdef LTTNG_UST_HAVE_PERF_EVENT */
+static inline
+int lttng_add_perf_counter_to_ctx(uint32_t type,
+                                 uint64_t config,
+                                 const char *name,
+                                 struct lttng_ctx **ctx)
+{
+       return -ENOSYS;
+}
+static inline
+int lttng_perf_counter_init(void)
+{
+       return 0;
+}
+static inline
+void lttng_perf_counter_exit(void)
+{
+}
+#endif /* #else #ifdef LTTNG_UST_HAVE_PERF_EVENT */
+
 extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_metadata;
 extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_discard;
 extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_overwrite;
This page took 0.024531 seconds and 4 git commands to generate.