diff options
| author | 2025-02-12 05:34:50 -0800 | |
|---|---|---|
| committer | 2025-02-12 05:34:50 -0800 | |
| commit | dfa3845a8559177a2f1b3ee28888b65d7d4283d3 (patch) | |
| tree | 91a8d5c0b9a0e74fb249a650bbe7077bb9e500b2 | |
| parent | 61cf0de04e035f6c0fcc23dcca1dd4bdbbae7de2 (diff) | |
| parent | 8d6fd6ea5beb4c48a796834afbc0e198df2ef4dc (diff) | |
Merge "Periodically GC and finalize during Collators alloc test." into main am: 8d6fd6ea5b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3491733
Change-Id: I4f13c0dc6ae2a6f6cc77f955981fac7b3932a5a0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java index ecbfc7169945..10ec2bfcb49a 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java @@ -75,8 +75,19 @@ public class ExpensiveObjectsPerfTest { @Test(timeout = 900000) public void timeNewCollator() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + int i = 0; while (state.keepRunning()) { Collator.getInstance(Locale.US); + + if (++i % 1000 == 0) { + state.pauseTiming(); + // GC and finalize occasionally to avoid GC for alloc and/or + // blocking on finalization during benchmark time. + // See: b/394961590 + System.gc(); + System.runFinalization(); + state.resumeTiming(); + } } } @@ -84,8 +95,19 @@ public class ExpensiveObjectsPerfTest { public void timeClonedCollator() { Collator c = Collator.getInstance(Locale.US); BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + int i = 0; while (state.keepRunning()) { c.clone(); + + if (++i % 1000 == 0) { + state.pauseTiming(); + // GC and finalize occasionally to avoid GC for alloc and/or + // blocking on finalization during benchmark time. + // See: b/394961590 + System.gc(); + System.runFinalization(); + state.resumeTiming(); + } } } |