-void dbg_hit_on(bool b) { ++hits[0]; if (b) ++hits[1]; }
-void dbg_hit_on(bool c, bool b) { if (c) dbg_hit_on(b); }
-void dbg_mean_of(int v) { ++means[0]; means[1] += v; }
+namespace {
+
+template<size_t N>
+struct DebugInfo {
+ std::atomic<int64_t> data[N] = { 0 };
+
+ constexpr inline std::atomic<int64_t>& operator[](int index) { return data[index]; }
+};
+
+DebugInfo<2> hit[MaxDebugSlots];
+DebugInfo<2> mean[MaxDebugSlots];
+DebugInfo<3> stdev[MaxDebugSlots];
+DebugInfo<6> correl[MaxDebugSlots];
+
+} // namespace
+
+void dbg_hit_on(bool cond, int slot) {
+
+ ++hit[slot][0];
+ if (cond)
+ ++hit[slot][1];
+}
+
+void dbg_mean_of(int64_t value, int slot) {
+
+ ++mean[slot][0];
+ mean[slot][1] += value;
+}
+
+void dbg_stdev_of(int64_t value, int slot) {
+
+ ++stdev[slot][0];
+ stdev[slot][1] += value;
+ stdev[slot][2] += value * value;
+}
+
+void dbg_correl_of(int64_t value1, int64_t value2, int slot) {
+
+ ++correl[slot][0];
+ correl[slot][1] += value1;
+ correl[slot][2] += value1 * value1;
+ correl[slot][3] += value2;
+ correl[slot][4] += value2 * value2;
+ correl[slot][5] += value1 * value2;
+}