diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-03-26 16:51:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-03-26 16:51:02 +0000 |
commit | 223efbe5164f6fe83cf04e7f9121adb29b8dd231 (patch) | |
tree | f162c660d245e88f3043624195e096235e0df55e /runtime | |
parent | 4b4b43c225a34b734c69f32cd0336e4a5d4b8e38 (diff) | |
parent | 91e3063d97b4dba239682d00ecfb3ea8c0a96539 (diff) | |
download | art-223efbe5164f6fe83cf04e7f9121adb29b8dd231.zip art-223efbe5164f6fe83cf04e7f9121adb29b8dd231.tar.gz art-223efbe5164f6fe83cf04e7f9121adb29b8dd231.tar.bz2 |
Merge "Add GC mode for stressing testing heap transitions."
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/gc/heap.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index a256b67..7827261 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -70,6 +70,8 @@ namespace art { namespace gc { +static constexpr size_t kCollectorTransitionStressIterations = 0; +static constexpr size_t kCollectorTransitionStressWait = 10 * 1000; // Microseconds static constexpr bool kGCALotMode = false; static constexpr size_t kGcAlotInterval = KB; // Minimum amount of remaining bytes before a concurrent GC is triggered. @@ -482,6 +484,13 @@ void Heap::DecrementDisableMovingGC(Thread* self) { void Heap::UpdateProcessState(ProcessState process_state) { if (process_state_ != process_state) { process_state_ = process_state; + for (size_t i = 1; i <= kCollectorTransitionStressIterations; ++i) { + // Start at index 1 to avoid "is always false" warning. + // Have iteration 1 always transition the collector. + TransitionCollector((((i & 1) == 1) == (process_state_ == kProcessStateJankPerceptible)) + ? post_zygote_collector_type_ : background_collector_type_); + usleep(kCollectorTransitionStressWait); + } if (process_state_ == kProcessStateJankPerceptible) { // Transition back to foreground right away to prevent jank. RequestCollectorTransition(post_zygote_collector_type_, 0); |