File 0876-erts-Fix-LTTng-allocation-statistics.patch of Package erlang
From c0c144ee10dd2190e8bb3aed3291003e5bd5190e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org>
Date: Thu, 26 Mar 2020 08:11:33 +0100
Subject: [PATCH] erts: Fix LTTng allocation statistics
This broke when refactoring carrier statistics to allow
cross-carrier migration.
---
erts/emulator/beam/erl_alloc_util.h | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/erts/emulator/beam/erl_alloc_util.h b/erts/emulator/beam/erl_alloc_util.h
index 7dba7286e3..732a4c7886 100644
--- a/erts/emulator/beam/erl_alloc_util.h
+++ b/erts/emulator/beam/erl_alloc_util.h
@@ -517,14 +517,32 @@ typedef struct {
} CarriersStats_t;
#ifdef USE_LTTNG_VM_TRACEPOINTS
-#define LTTNG_CARRIER_STATS_TO_LTTNG_STATS(CSP, LSP) \
- do { \
- (LSP)->carriers.size = (CSP)->curr.norm.mseg.size \
- + (CSP)->curr.norm.sys_alloc.size; \
- (LSP)->carriers.no = (CSP)->curr.norm.mseg.no \
- + (CSP)->curr.norm.sys_alloc.no; \
- (LSP)->blocks.size = (CSP)->blocks.curr.size; \
- (LSP)->blocks.no = (CSP)->blocks.curr.no; \
+#define LTTNG_CARRIER_STATS_TO_LTTNG_STATS(CSP, LSP) \
+ do { \
+ UWord no_sum__, size_sum__; \
+ int alloc_no__, i__; \
+ /* Carrier counters */ \
+ no_sum__ = size_sum__ = 0; \
+ for (i__ = ERTS_CRR_ALLOC_MIN; i__ <= ERTS_CRR_ALLOC_MAX; i__++) { \
+ StatValues_t *curr__ = &((CSP)->carriers[i__]); \
+ no_sum__ += curr__->no; \
+ size_sum__ += curr__->size; \
+ } \
+ (LSP)->carriers.size = size_sum__; \
+ (LSP)->carriers.no = no_sum__; \
+ /* Block counters */ \
+ no_sum__ = size_sum__ = 0; \
+ for (alloc_no__ = ERTS_ALC_A_MIN; \
+ alloc_no__ <= ERTS_ALC_A_MAX; \
+ alloc_no__++) { \
+ StatValues_t *curr__; \
+ i__ = alloc_no__ - ERTS_ALC_A_MIN; \
+ curr__ = &((CSP)->blocks[i__].curr); \
+ no_sum__ += curr__->no; \
+ size_sum__ += curr__->size; \
+ } \
+ (LSP)->blocks.size = size_sum__; \
+ (LSP)->blocks.no = no_sum__; \
} while (0)
#endif
--
2.16.4