Fix: libcounter: __lttng_counter_add global sum step alloc vs sync mixup
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 2 Sep 2022 20:13:08 +0000 (16:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Jul 2024 15:39:51 +0000 (11:39 -0400)
The global sum step needs to be handled on per-cpu allocated counters,
not per-cpu sync.

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

src/common/counter/counter-api.h

index 955c5bb2927cbf621f007167a1d8feb30a032f5b..7b341d974d633ec397737495aa2345147be9316c 100644 (file)
@@ -24,7 +24,7 @@
  */
 static inline int __lttng_counter_add(const struct lib_counter_config *config,
                                      enum lib_counter_config_alloc alloc,
-                                     enum lib_counter_config_sync sync,
+                                     enum lib_counter_config_sync sync __attribute__((unused)),
                                      struct lib_counter *counter,
                                      const size_t *dimension_indexes, int64_t v,
                                      int64_t *remainder)
@@ -59,8 +59,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *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;
@@ -75,7 +75,7 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config,
                        } while (old != res);
                        break;
                }
-               case COUNTER_SYNC_GLOBAL:
+               case COUNTER_ALLOC_GLOBAL:
                {
                        do {
                                old = res;
@@ -100,8 +100,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *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;
@@ -116,7 +116,7 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config,
                        } while (old != res);
                        break;
                }
-               case COUNTER_SYNC_GLOBAL:
+               case COUNTER_ALLOC_GLOBAL:
                {
                        do {
                                old = res;
@@ -141,8 +141,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *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;
@@ -157,7 +157,7 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config,
                        } while (old != res);
                        break;
                }
-               case COUNTER_SYNC_GLOBAL:
+               case COUNTER_ALLOC_GLOBAL:
                {
                        do {
                                old = res;
@@ -183,8 +183,8 @@ static inline int __lttng_counter_add(const struct lib_counter_config *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;
@@ -199,7 +199,7 @@ static inline int __lttng_counter_add(const struct lib_counter_config *config,
                        } while (old != res);
                        break;
                }
-               case COUNTER_SYNC_GLOBAL:
+               case COUNTER_ALLOC_GLOBAL:
                {
                        do {
                                old = res;
This page took 0.026905 seconds and 4 git commands to generate.