summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wilson Wu <wilsonwu@google.com> 2022-12-23 15:33:17 +0800
committer Wilson Wu <wilsonwu@google.com> 2022-12-23 15:33:17 +0800
commit2a4cf037f90bbddc4bbf3e46a43333ddef482eef (patch)
tree2ca56e1d6236e397bec4d9b846e175a7fef96b82
parent5fedb58a765bd48cd5169f830aa3a5cd65ad68dc (diff)
Don't add result if no enough samples
Only report the stats when data is enough to prevent Stats send an exception and cause the test failure. Bug: 180449530 Test: atest ImePerfTest#testShowImeCold --iterations 20 Change-Id: I3607009c527ee1f148c3530bf4f2bc63473b6a6c
-rw-r--r--apct-tests/perftests/inputmethod/src/android/inputmethod/ImePerfTest.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/apct-tests/perftests/inputmethod/src/android/inputmethod/ImePerfTest.java b/apct-tests/perftests/inputmethod/src/android/inputmethod/ImePerfTest.java
index a1383e620616..203bb5434e77 100644
--- a/apct-tests/perftests/inputmethod/src/android/inputmethod/ImePerfTest.java
+++ b/apct-tests/perftests/inputmethod/src/android/inputmethod/ImePerfTest.java
@@ -411,6 +411,10 @@ public class ImePerfTest extends ImePerfTestBase
private void addResultToState(ManualBenchmarkState state) {
mTraceMethods.forAllSlices((key, slices) -> {
+ if (slices.size() < 2) {
+ Log.w(TAG, "No enough samples for: " + key);
+ return;
+ }
for (TraceMarkSlice slice : slices) {
state.addExtraResult(key, (long) (slice.getDurationInSeconds() * NANOS_PER_S));
}