From bc826918cd6df347776ae44f9ac8a67995e50434 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 2 Sep 2022 16:13:46 -0400 Subject: [PATCH] Fix: libcounter: __lttng_counter_add global sum step alloc vs sync mixup The global sum step needs to be handled on per-cpu allocated counters, not per-cpu sync. Signed-off-by: Mathieu Desnoyers Change-Id: I9b6ef221fb099c9fc602dfdb9a93d70ae2192500 --- include/counter/counter-api.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/counter/counter-api.h b/include/counter/counter-api.h index c9f2b141..be372f45 100644 --- a/include/counter/counter-api.h +++ b/include/counter/counter-api.h @@ -56,8 +56,8 @@ static __always_inline int __lttng_counter_add(const struct lib_counter_config * int8_t global_sum_step = counter->global_sum_step.s8; res = *int_p; - switch (sync) { - case COUNTER_SYNC_PER_CPU: + switch (alloc) { + case COUNTER_ALLOC_PER_CPU: { do { move_sum = 0; @@ -72,7 +72,7 @@ static __always_inline int __lttng_counter_add(const struct lib_counter_config * } while (old != res); break; } - case COUNTER_SYNC_GLOBAL: + case COUNTER_ALLOC_GLOBAL: { do { old = res; @@ -97,8 +97,8 @@ static __always_inline int __lttng_counter_add(const struct lib_counter_config * int16_t global_sum_step = counter->global_sum_step.s16; res = *int_p; - switch (sync) { - case COUNTER_SYNC_PER_CPU: + switch (alloc) { + case COUNTER_ALLOC_PER_CPU: { do { move_sum = 0; @@ -113,7 +113,7 @@ static __always_inline int __lttng_counter_add(const struct lib_counter_config * } while (old != res); break; } - case COUNTER_SYNC_GLOBAL: + case COUNTER_ALLOC_GLOBAL: { do { old = res; @@ -138,8 +138,8 @@ static __always_inline int __lttng_counter_add(const struct lib_counter_config * int32_t global_sum_step = counter->global_sum_step.s32; res = *int_p; - switch (sync) { - case COUNTER_SYNC_PER_CPU: + switch (alloc) { + case COUNTER_ALLOC_PER_CPU: { do { move_sum = 0; @@ -154,7 +154,7 @@ static __always_inline int __lttng_counter_add(const struct lib_counter_config * } while (old != res); break; } - case COUNTER_SYNC_GLOBAL: + case COUNTER_ALLOC_GLOBAL: { do { old = res; @@ -180,8 +180,8 @@ static __always_inline int __lttng_counter_add(const struct lib_counter_config * int64_t global_sum_step = counter->global_sum_step.s64; res = *int_p; - switch (sync) { - case COUNTER_SYNC_PER_CPU: + switch (alloc) { + case COUNTER_ALLOC_PER_CPU: { do { move_sum = 0; @@ -196,7 +196,7 @@ static __always_inline int __lttng_counter_add(const struct lib_counter_config * } while (old != res); break; } - case COUNTER_SYNC_GLOBAL: + case COUNTER_ALLOC_GLOBAL: { do { old = res; -- 2.34.1