ART: add dump region info runtime option
Introduce two new runtime options, DumpRegionInfoBeforeGC and
DumpRegionInfoAfterGC, for printing the live bytes ratio for non-free
regions before and after each GC cycle.
Test: Run art with -XX:DumpRegionInfoBeforeGC and -XX:DumpRegionInfoAfterGC on some benchmarks.
Bug: 119486919
Change-Id: I0d6f210669b85d94034178815f6cae6fd19ca397
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index d47aca9..d868aba 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -201,7 +201,9 @@
bool gc_stress_mode,
bool measure_gc_performance,
bool use_homogeneous_space_compaction_for_oom,
- uint64_t min_interval_homogeneous_space_compaction_by_oom)
+ uint64_t min_interval_homogeneous_space_compaction_by_oom,
+ bool dump_region_info_before_gc,
+ bool dump_region_info_after_gc)
: non_moving_space_(nullptr),
rosalloc_space_(nullptr),
dlmalloc_space_(nullptr),
@@ -300,7 +302,9 @@
backtrace_lock_(nullptr),
seen_backtrace_count_(0u),
unique_backtrace_count_(0u),
- gc_disabled_for_shutdown_(false) {
+ gc_disabled_for_shutdown_(false),
+ dump_region_info_before_gc_(dump_region_info_before_gc),
+ dump_region_info_after_gc_(dump_region_info_after_gc) {
if (VLOG_IS_ON(heap) || VLOG_IS_ON(startup)) {
LOG(INFO) << "Heap() entering";
}