Introduce event counter extensible ABI structure layout
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 23 Mar 2022 20:23:45 +0000 (16:23 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 15 Jul 2024 21:01:43 +0000 (17:01 -0400)
Introduce event counter ioctl argument structure with extensible layout
for new ioctls.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I120e057d136951973b9af801fd4940fb9866ce94

include/lttng/abi.h

index 8e9b4c0fc57f280317e29487347e6186945967be..a512c54cd457d7b6ba0a4a515fbb74bef479ee8b 100644 (file)
@@ -258,6 +258,70 @@ struct lttng_kernel_abi_counter_event {
        char padding[LTTNG_KERNEL_ABI_COUNTER_EVENT_PADDING1];
 } __attribute__((packed));
 
+enum lttng_kernel_abi_counter_dimension_flags {
+       LTTNG_KERNEL_ABI_COUNTER_DIMENSION_FLAG_UNDERFLOW = (1 << 0),
+       LTTNG_KERNEL_ABI_COUNTER_DIMENSION_FLAG_OVERFLOW = (1 << 1),
+};
+
+struct lttng_kernel_abi_counter_dimension {
+       uint32_t flags;                 /* enum lttng_kernel_abi_counter_dimension_flags */
+       uint64_t size;                  /* dimension size */
+       uint64_t underflow_index;
+       uint64_t overflow_index;
+} __attribute__((packed));
+
+struct lttng_kernel_abi_counter_dimension_array {
+       uint32_t number_dimensions;
+       uint32_t elem_len;              /* array stride (size of struct lttng_kernel_abi_counter_dimension) */
+       uint64_t ptr;                   /* pointer to array of struct lttng_kernel_abi_counter_dimension */
+} __attribute__((packed));
+
+enum lttng_kernel_abi_counter_conf_flags {
+       LTTNG_KERNEL_ABI_COUNTER_CONF_FLAG_COALESCE_HITS = (1 << 0),
+};
+
+struct lttng_kernel_abi_counter_conf {
+       uint32_t len;                   /* length of this structure */
+       uint32_t flags;                 /* enum lttng_kernel_abi_counter_conf_flags */
+       uint32_t arithmetic;            /* enum lttng_kernel_abi_counter_arithmetic */
+       uint32_t bitness;               /* enum lttng_kernel_abi_counter_bitness */
+       int64_t global_sum_step;
+       struct lttng_kernel_abi_counter_dimension_array dimension_array;
+} __attribute__((packed));
+
+struct lttng_kernel_abi_counter_index {
+       uint32_t number_dimensions;
+       uint64_t ptr;                   /* pointer to dimension indexes (array of uint64_t) */
+} __attribute__((packed));
+
+enum lttng_kernel_abi_counter_value_flags {
+       LTTNG_KERNEL_ABI_COUNTER_VALUE_FLAG_UNDERFLOW = (1 << 0),
+       LTTNG_KERNEL_ABI_COUNTER_VALUE_FLAG_OVERFLOW = (1 << 1),
+};
+
+struct lttng_kernel_abi_counter_value {
+       int64_t value;
+       uint32_t flags;                 /* enum lttng_kernel_abi_counter_value_flags */
+} __attribute__((packed));
+
+struct lttng_kernel_abi_counter_read {
+       uint32_t len;                   /* length of this structure */
+       struct lttng_kernel_abi_counter_index index;
+       int32_t cpu;    /* -1 for global counter, >= 0 for specific cpu. */
+       struct lttng_kernel_abi_counter_value value;    /* output */
+} __attribute__((packed));
+
+struct lttng_kernel_abi_counter_aggregate {
+       uint32_t len;                   /* length of this structure */
+       struct lttng_kernel_abi_counter_index index;
+       struct lttng_kernel_abi_counter_value value;    /* output */
+} __attribute__((packed));
+
+struct lttng_kernel_abi_counter_clear {
+       uint32_t len;                   /* length of this structure */
+       struct lttng_kernel_abi_counter_index index;
+} __attribute__((packed));
+
 struct lttng_kernel_abi_tracer_version {
        uint32_t major;
        uint32_t minor;
@@ -445,11 +509,9 @@ struct lttng_kernel_abi_tracker_args {
 /* Trigger group and session ioctl */
 
 /* (0xF6, 0x84) is reserved for old ABI. */
-//TODO: new in 2.14, replace old (2.13) ioctl with extensible struct.
-#if 0
+
 #define LTTNG_KERNEL_ABI_COUNTER \
        _IOW(0xF6, 0x85, struct lttng_kernel_abi_counter_conf)
-#endif
 
 /* Event and Event notifier FD ioctl */
 #define LTTNG_KERNEL_ABI_FILTER                        _IO(0xF6, 0x90)
@@ -481,16 +543,12 @@ struct lttng_kernel_abi_tracker_args {
        _IOWR(0xF6, 0xC4, struct lttng_kernel_abi_counter_map_descriptor)
 #define LTTNG_KERNEL_ABI_COUNTER_EVENT \
        _IOW(0xF6, 0xC5, struct lttng_kernel_abi_counter_event)
-
-//TODO: new in 2.14, replace old (2.13) ioctls with variable length arrays.
-#if 0
 #define LTTNG_KERNEL_ABI_COUNTER_READ \
        _IOWR(0xF6, 0xC6, struct lttng_kernel_abi_counter_read)
 #define LTTNG_KERNEL_ABI_COUNTER_AGGREGATE \
        _IOWR(0xF6, 0xC7, struct lttng_kernel_abi_counter_aggregate)
 #define LTTNG_KERNEL_ABI_COUNTER_CLEAR \
        _IOW(0xF6, 0xC8, struct lttng_kernel_abi_counter_clear)
-#endif
 
 /*
  * LTTng-specific ioctls for the lib ringbuffer.
This page took 0.026964 seconds and 4 git commands to generate.