From 81bc49723ae5d21739ebc70a656f403d3b88e9c8 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 10 Mar 2021 09:20:36 -0500 Subject: [PATCH] counters: add coalesce_hits to control API and protocol This will be required by an upcoming feature in a subsequent release, so plan ahead with a coalesce_hits field. It is currently unused by liblttng-ust. Signed-off-by: Mathieu Desnoyers Change-Id: Id15f573f523cd3873a7190135ff7009fbcfbb042 --- include/lttng/ust-abi.h | 5 ++++- include/lttng/ust-ctl.h | 3 ++- liblttng-ust-ctl/ustctl.c | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index 1c11f371..95d289da 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -85,6 +85,7 @@ struct lttng_ust_stream { */ } LTTNG_PACKED; +#define LTTNG_UST_COUNTER_DIMENSION_MAX 8 enum lttng_ust_counter_arithmetic { LTTNG_UST_COUNTER_ARITHMETIC_MODULAR = 0, @@ -104,13 +105,15 @@ struct lttng_ust_counter_dimension { uint8_t has_overflow; } LTTNG_PACKED; -#define LTTNG_UST_COUNTER_DIMENSION_MAX 8 +#define LTTNG_UST_COUNTER_CONF_PADDING1 67 struct lttng_ust_counter_conf { uint32_t arithmetic; /* enum lttng_ust_counter_arithmetic */ uint32_t bitness; /* enum lttng_ust_counter_bitness */ uint32_t number_dimensions; int64_t global_sum_step; struct lttng_ust_counter_dimension dimensions[LTTNG_UST_COUNTER_DIMENSION_MAX]; + uint8_t coalesce_hits; + char padding[LTTNG_UST_COUNTER_CONF_PADDING1]; } LTTNG_PACKED; struct lttng_ust_counter_value { diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h index 32604006..6bea1160 100644 --- a/include/lttng/ust-ctl.h +++ b/include/lttng/ust-ctl.h @@ -622,7 +622,8 @@ struct ustctl_daemon_counter * const int *counter_cpu_fds, enum ustctl_counter_bitness bitness, enum ustctl_counter_arithmetic arithmetic, - uint32_t alloc_flags); + uint32_t alloc_flags, + bool coalesce_hits); int ustctl_create_counter_data(struct ustctl_daemon_counter *counter, struct lttng_ust_object_data **counter_data); diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 14299b23..041434bd 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -72,6 +72,7 @@ struct ustctl_counter_attr { uint32_t nr_dimensions; int64_t global_sum_step; struct ustctl_counter_dimension dimensions[USTCTL_COUNTER_ATTR_DIMENSION_MAX]; + bool coalesce_hits; }; /* @@ -2568,7 +2569,8 @@ struct ustctl_daemon_counter * const int *counter_cpu_fds, enum ustctl_counter_bitness bitness, enum ustctl_counter_arithmetic arithmetic, - uint32_t alloc_flags) + uint32_t alloc_flags, + bool coalesce_hits) { const char *transport_name; struct ustctl_daemon_counter *counter; @@ -2634,6 +2636,7 @@ struct ustctl_daemon_counter * counter->attr->arithmetic = arithmetic; counter->attr->nr_dimensions = nr_dimensions; counter->attr->global_sum_step = global_sum_step; + counter->attr->coalesce_hits = coalesce_hits; for (i = 0; i < nr_dimensions; i++) counter->attr->dimensions[i] = dimensions[i]; @@ -2689,6 +2692,7 @@ int ustctl_create_counter_data(struct ustctl_daemon_counter *counter, } counter_conf.number_dimensions = counter->attr->nr_dimensions; counter_conf.global_sum_step = counter->attr->global_sum_step; + counter_conf.coalesce_hits = counter->attr->coalesce_hits; for (i = 0; i < counter->attr->nr_dimensions; i++) { counter_conf.dimensions[i].size = counter->attr->dimensions[i].size; counter_conf.dimensions[i].underflow_index = counter->attr->dimensions[i].underflow_index; -- 2.34.1