Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a4cf037 authored by Wilson Wu's avatar Wilson Wu
Browse files

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
parent 5fedb58a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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));
            }