+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: MIT
+
/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
* LTTng-UST ABI header
*/
#define LTTNG_UST_ABI_COMM_MAGIC 0xC57C57C5
/* Version for ABI between liblttng-ust, sessiond, consumerd */
-#define LTTNG_UST_ABI_MAJOR_VERSION 9
+#define LTTNG_UST_ABI_MAJOR_VERSION 10
#define LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE 8
#define LTTNG_UST_ABI_MINOR_VERSION 0
+#define LTTNG_UST_ABI_CMD_MAX_LEN 4096U
+
enum lttng_ust_abi_instrumentation {
LTTNG_UST_ABI_TRACEPOINT = 0,
LTTNG_UST_ABI_PROBE = 1,
*/
} __attribute__((packed));
-#define LTTNG_UST_ABI_COUNTER_DIMENSION_MAX 4
-
-enum lttng_ust_abi_counter_arithmetic {
- LTTNG_UST_ABI_COUNTER_ARITHMETIC_MODULAR = 0,
- LTTNG_UST_ABI_COUNTER_ARITHMETIC_SATURATION = 1,
-};
-
-enum lttng_ust_abi_counter_bitness {
- LTTNG_UST_ABI_COUNTER_BITNESS_32 = 0,
- LTTNG_UST_ABI_COUNTER_BITNESS_64 = 1,
-};
-
-struct lttng_ust_abi_counter_dimension {
- uint64_t size;
- uint64_t underflow_index;
- uint64_t overflow_index;
- uint8_t has_underflow;
- uint8_t has_overflow;
-} __attribute__((packed));
-
-#define LTTNG_UST_ABI_COUNTER_CONF_PADDING1 67
-struct lttng_ust_abi_counter_conf {
- uint32_t arithmetic; /* enum lttng_ust_abi_counter_arithmetic */
- uint32_t bitness; /* enum lttng_ust_abi_counter_bitness */
- uint32_t number_dimensions;
- int64_t global_sum_step;
- struct lttng_ust_abi_counter_dimension dimensions[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX];
- uint8_t coalesce_hits;
- char padding[LTTNG_UST_ABI_COUNTER_CONF_PADDING1];
-} __attribute__((packed));
-
-struct lttng_ust_abi_counter_value {
- uint32_t number_dimensions;
- uint64_t dimension_indexes[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX];
- int64_t value;
-} __attribute__((packed));
-
#define LTTNG_UST_ABI_EVENT_PADDING1 8
#define LTTNG_UST_ABI_EVENT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_event {
char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING];
} __attribute__((packed));
-#define LTTNG_UST_ABI_COUNTER_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
-#define LTTNG_UST_ABI_COUNTER_DATA_MAX_LEN 4096U
-struct lttng_ust_abi_counter {
- uint64_t len;
- char padding[LTTNG_UST_ABI_COUNTER_PADDING1];
- char data[]; /* variable sized data */
+enum lttng_ust_abi_key_token_type {
+ LTTNG_UST_ABI_KEY_TOKEN_STRING = 0, /* arg: strtab_offset. */
+ LTTNG_UST_ABI_KEY_TOKEN_EVENT_NAME = 1, /* no arg. */
+ LTTNG_UST_ABI_KEY_TOKEN_PROVIDER_NAME = 2, /* no arg. */
+};
+
+enum lttng_ust_abi_counter_arithmetic {
+ LTTNG_UST_ABI_COUNTER_ARITHMETIC_MODULAR = 0,
+ LTTNG_UST_ABI_COUNTER_ARITHMETIC_SATURATION = 1,
+};
+
+enum lttng_ust_abi_counter_bitness {
+ LTTNG_UST_ABI_COUNTER_BITNESS_32 = 0,
+ LTTNG_UST_ABI_COUNTER_BITNESS_64 = 1,
+};
+
+struct lttng_ust_abi_key_token {
+ uint32_t len; /* length of child structure. */
+ uint32_t type; /* enum lttng_ust_abi_key_token_type */
+ /*
+ * The size of this structure is fixed because it is embedded into
+ * children structures.
+ */
+} __attribute__((packed));
+
+/* Length of this structure excludes the following string. */
+struct lttng_ust_abi_key_token_string {
+ struct lttng_ust_abi_key_token parent;
+ uint32_t string_len; /* string length (includes \0) */
+
+ char str[]; /* Null-terminated string following this structure. */
+} __attribute__((packed));
+
+/*
+ * token types event_name and provider_name don't have specific fields,
+ * so they do not need to derive their own specific child structure.
+ */
+
+/*
+ * Dimension indexing: All events should use the same key type to index
+ * a given map dimension.
+ */
+enum lttng_ust_abi_key_type {
+ LTTNG_UST_ABI_KEY_TYPE_TOKENS = 0, /* Dimension key is a set of tokens. */
+ LTTNG_UST_ABI_KEY_TYPE_INTEGER = 1, /* Dimension key is an integer value. */
+};
+
+struct lttng_ust_abi_counter_key_dimension {
+ uint32_t len; /* length of child structure */
+ uint32_t key_type; /* enum lttng_ust_abi_key_type */
+ /*
+ * The size of this structure is fixed because it is embedded into
+ * children structures.
+ */
+} __attribute__((packed));
+
+struct lttng_ust_abi_counter_key_dimension_tokens {
+ struct lttng_ust_abi_counter_key_dimension parent;
+ uint32_t nr_key_tokens;
+
+ /* Followed by an array of nr_key_tokens struct lttng_ust_abi_key_token elements. */
+} __attribute__((packed));
+
+/*
+ * The "integer" key type is not implemented yet, but when it will be
+ * introduced in the future, its specific key dimension will allow
+ * defining the function to apply over input argument, bytecode to run
+ * and so on.
+ */
+
+enum lttng_ust_abi_counter_action {
+ LTTNG_UST_ABI_COUNTER_ACTION_INCREMENT = 0,
+
+ /*
+ * Can be extended with additional actions, such as decrement,
+ * set value, run bytecode, and so on.
+ */
+};
+
+struct lttng_ust_abi_counter_event {
+ uint32_t len; /* length of this structure */
+ uint32_t action; /* enum lttng_ust_abi_counter_action */
+
+ struct lttng_ust_abi_event event;
+ uint32_t number_key_dimensions; /* array of dimensions is an array of var. len. elements. */
+
+ /*
+ * Followed by additional data specific to the action, and by a
+ * variable-length array of key dimensions.
+ */
+} __attribute__((packed));
+
+enum lttng_ust_abi_counter_dimension_flags {
+ LTTNG_UST_ABI_COUNTER_DIMENSION_FLAG_UNDERFLOW = (1 << 0),
+ LTTNG_UST_ABI_COUNTER_DIMENSION_FLAG_OVERFLOW = (1 << 1),
+};
+
+struct lttng_ust_abi_counter_dimension {
+ uint32_t key_type; /* enum lttng_ust_abi_key_type */
+ uint32_t flags; /* enum lttng_ust_abi_counter_dimension_flags */
+ uint64_t size; /* dimension size (count of entries) */
+ uint64_t underflow_index;
+ uint64_t overflow_index;
+} __attribute__((packed));
+
+enum lttng_ust_abi_counter_conf_flags {
+ LTTNG_UST_ABI_COUNTER_CONF_FLAG_COALESCE_HITS = (1 << 0),
+};
+
+struct lttng_ust_abi_counter_conf {
+ uint32_t len; /* Length of fields before var. len. data. */
+ uint32_t flags; /* enum lttng_ust_abi_counter_conf_flags */
+ uint32_t arithmetic; /* enum lttng_ust_abi_counter_arithmetic */
+ uint32_t bitness; /* enum lttng_ust_abi_counter_bitness */
+ int64_t global_sum_step;
+ uint32_t number_dimensions;
+ uint32_t elem_len; /* array stride (size of lttng_ust_abi_counter_dimension) */
} __attribute__((packed));
-#define LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_counter_global {
- uint64_t len; /* shm len */
- char padding[LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1];
+ uint32_t len; /* Length of this structure */
+ uint64_t shm_len; /* shm len */
} __attribute__((packed));
-#define LTTNG_UST_ABI_COUNTER_CPU_PADDING1 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
struct lttng_ust_abi_counter_cpu {
- uint64_t len; /* shm len */
+ uint32_t len; /* Length of this structure */
+ uint64_t shm_len; /* shm len */
uint32_t cpu_nr;
- char padding[LTTNG_UST_ABI_COUNTER_CPU_PADDING1];
} __attribute__((packed));
enum lttng_ust_abi_field_type {
LTTNG_UST_ABI_OBJECT_TYPE_COUNTER = 6,
LTTNG_UST_ABI_OBJECT_TYPE_COUNTER_GLOBAL = 7,
LTTNG_UST_ABI_OBJECT_TYPE_COUNTER_CPU = 8,
+ LTTNG_UST_ABI_OBJECT_TYPE_COUNTER_EVENT = 9,
};
#define LTTNG_UST_ABI_OBJECT_DATA_PADDING1 32
char names[LTTNG_UST_ABI_SYM_NAME_LEN][0];
} __attribute__((packed));
-#define LTTNG_UST_ABI_CMD(minor) (minor)
-#define LTTNG_UST_ABI_CMDR(minor, type) (minor)
-#define LTTNG_UST_ABI_CMDW(minor, type) (minor)
+#define LTTNG_UST_ABI_CMD(minor) (minor)
+#define LTTNG_UST_ABI_CMDR(minor, type) (minor)
+#define LTTNG_UST_ABI_CMDW(minor, type) (minor)
+#define LTTNG_UST_ABI_CMDV(minor, var_len_cmd_type) (minor)
/* Handled by object descriptor */
#define LTTNG_UST_ABI_RELEASE LTTNG_UST_ABI_CMD(0x1)
/* Event notifier group commands */
#define LTTNG_UST_ABI_EVENT_NOTIFIER_CREATE \
- LTTNG_UST_ABI_CMDW(0xB0, struct lttng_ust_abi_event_notifier)
+ LTTNG_UST_ABI_CMDV(0xB0, struct lttng_ust_abi_event_notifier)
/* Event notifier commands */
#define LTTNG_UST_ABI_CAPTURE LTTNG_UST_ABI_CMD(0xB6)
/* Session and event notifier group commands */
+/* (0xC0) reserved for old ABI. */
#define LTTNG_UST_ABI_COUNTER \
- LTTNG_UST_ABI_CMDW(0xC0, struct lttng_ust_abi_counter)
+ LTTNG_UST_ABI_CMDV(0xC1, struct lttng_ust_abi_counter_conf)
/* Counter commands */
+/* (0xD0, 0xD1) reserved for old ABI. */
#define LTTNG_UST_ABI_COUNTER_GLOBAL \
- LTTNG_UST_ABI_CMDW(0xD0, struct lttng_ust_abi_counter_global)
+ LTTNG_UST_ABI_CMDV(0xD2, struct lttng_ust_abi_counter_global)
#define LTTNG_UST_ABI_COUNTER_CPU \
- LTTNG_UST_ABI_CMDW(0xD1, struct lttng_ust_abi_counter_cpu)
+ LTTNG_UST_ABI_CMDV(0xD3, struct lttng_ust_abi_counter_cpu)
+#define LTTNG_UST_ABI_COUNTER_EVENT \
+ LTTNG_UST_ABI_CMDV(0xD4, struct lttng_ust_abi_counter_event)
#define LTTNG_UST_ABI_ROOT_HANDLE 0