From: Mathieu Desnoyers Date: Wed, 23 Mar 2022 20:23:45 +0000 (-0400) Subject: Introduce event counter extensible ABI structure layout X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2e041896459b3b1115cee9fedcfe6afa145a94a4;p=lttng-modules.git Introduce event counter extensible ABI structure layout Introduce event counter ioctl argument structure with extensible layout for new ioctls. Signed-off-by: Mathieu Desnoyers Change-Id: I120e057d136951973b9af801fd4940fb9866ce94 --- diff --git a/include/lttng/abi.h b/include/lttng/abi.h index 8e9b4c0f..a512c54c 100644 --- a/include/lttng/abi.h +++ b/include/lttng/abi.h @@ -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.