From c25fdf08779620fd930cfbced5f68c6811cd6436 Mon Sep 17 00:00:00 2001
From: Andreas Gattringer <andreas.gattringer@univie.ac.at>
Date: Tue, 21 Mar 2023 23:22:15 +0100
Subject: [PATCH] grid_stats: consolidate thread stats for custom stats

---
 src/cats/stats/grid_stats.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/cats/stats/grid_stats.c b/src/cats/stats/grid_stats.c
index 98105fa..49b48a8 100644
--- a/src/cats/stats/grid_stats.c
+++ b/src/cats/stats/grid_stats.c
@@ -143,6 +143,10 @@ void consolidate_thread_stats(struct cats_grid *grid, struct cats_configuration
                         for (int32_t stat_idx = STAT_MIN; stat_idx < STAT_MAX; stat_idx++) {
                                 g->stats.stats[stat_idx] += threads[i].stats[class].stats[stat_idx];
                         }
+
+                        for (int64_t j = 0; j < threads[i].stats->custom_stat_count; j++){
+                                g->stats.custom_stats[j] += threads[i].stats[class].custom_stats[j];
+                        }
                 }
         }
 }
-- 
GitLab