Add reporting of statistics for AllocationTraceRecorder
This CL introduces collection of statistics to the
AllocationTraceRecorder and periodic printing of these.
When MTE is enabled in synchronous mode, the AllocationTraceRecorder is
invoked upon each allocation or free. Therefore, its performance is
quite critical. To better understand certain properties like number of
allocations or number of collisions, we introduce a simple reporting
mechanism. This includes collection of additional information and
periodic output of the collected data. Since gathering the data incurs
a runtime overhead, we disable the feature by default.
Bug: 1137393
Change-Id: I5e8862d01f81896724b6d6d0b1aba0dcae535e10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4566075
Reviewed-by: David Roger <[email protected]>
Reviewed-by: Wez <[email protected]>
Reviewed-by: Joe Mason <[email protected]>
Commit-Queue: Andre Kempe <[email protected]>
Reviewed-by: Peter Beverloo <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1162435}
diff --git a/base/debug/debug.gni b/base/debug/debug.gni
index 2eba0e0d..73665c9 100644
--- a/base/debug/debug.gni
+++ b/base/debug/debug.gni
@@ -18,6 +18,16 @@
build_allocation_stack_trace_recorder = false
}
+declare_args() {
+ # If enabled, the recorder gathers some additional information, i.e. number of
+ # collisions of slots, and prints these periodically.
+ #
+ # Since this might impact performance negatively, it's disabled by default.
+ # Even if it's disabled we still collect some data, i.e. total number of
+ # allocations. All other data will be set to a default value.
+ build_allocation_trace_recorder_full_reporting = false
+}
+
assert(!(build_allocation_stack_trace_recorder && is_fuchsia),
"Stack trace recording is not supported on Fuchsia due to missing" +
" Crashpad!")
@@ -25,3 +35,8 @@
assert(!(build_allocation_stack_trace_recorder && is_linux),
"WARNING: Stack trace recording is not supported on Linux due to" +
" performance issues computing stack trace!")
+
+assert(
+ build_allocation_stack_trace_recorder ||
+ !build_allocation_trace_recorder_full_reporting,
+ "Report for stack trace recorder is enabled, but the recorder is disabled!")