diff options
| -rw-r--r-- | runtime/gc/heap.cc | 7 | ||||
| -rw-r--r-- | runtime/gc/heap.h | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 67e8a0d02f..7328063486 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -93,6 +93,9 @@ namespace gc { static constexpr size_t kCollectorTransitionStressIterations = 0; static constexpr size_t kCollectorTransitionStressWait = 10 * 1000; // Microseconds + +DEFINE_RUNTIME_DEBUG_FLAG(Heap, kStressCollectorTransition); + // Minimum amount of remaining bytes before a concurrent GC is triggered. static constexpr size_t kMinConcurrentRemainingBytes = 128 * KB; static constexpr size_t kMaxConcurrentRemainingBytes = 512 * KB; @@ -889,7 +892,9 @@ void Heap::UpdateProcessState(ProcessState old_process_state, ProcessState new_p // the collector. Similarly, we invoke a full compaction for kCollectorTypeCC but don't // transition the collector. RequestCollectorTransition(background_collector_type_, - kIsDebugBuild ? 0 : kCollectorTransitionWait); + kStressCollectorTransition + ? 0 + : kCollectorTransitionWait); } } } diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h index d673b4ac29..7b4fab607f 100644 --- a/runtime/gc/heap.h +++ b/runtime/gc/heap.h @@ -25,6 +25,7 @@ #include "allocator_type.h" #include "arch/instruction_set.h" #include "atomic.h" +#include "base/logging.h" #include "base/mutex.h" #include "base/time_utils.h" #include "gc/collector/gc_type.h" @@ -155,6 +156,9 @@ class Heap { static constexpr uint64_t kHeapTrimWait = MsToNs(5000); // How long we wait after a transition request to perform a collector transition (nanoseconds). static constexpr uint64_t kCollectorTransitionWait = MsToNs(5000); + // Whether the transition-wait applies or not. Zero wait will stress the + // transition code and collector, but increases jank probability. + DECLARE_RUNTIME_DEBUG_FLAG(kStressCollectorTransition); // Create a heap with the requested sizes. The possible empty // image_file_names names specify Spaces to load based on |