Loading apct-tests/perftests/utils/src/android/perftests/utils/ManualBenchmarkState.java +2 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ public final class ManualBenchmarkState { final Bundle status = new Bundle(); status.putLong(key + "_median", mStats.getMedian()); status.putLong(key + "_mean", (long) mStats.getMean()); status.putLong(key + "_percentile90", mStats.getPercentile90()); status.putLong(key + "_percentile95", mStats.getPercentile95()); status.putLong(key + "_stddev", (long) mStats.getStandardDeviation()); instrumentation.sendStatus(Activity.RESULT_OK, status); } Loading apct-tests/perftests/utils/src/android/perftests/utils/Stats.java +23 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.List; public class Stats { private long mMedian, mMin, mMax; private long mMedian, mMin, mMax, mPercentile90, mPercentile95; private double mMean, mStandardDeviation; /* Calculate stats in constructor. */ Loading @@ -35,12 +35,14 @@ public class Stats { Collections.sort(values); mMedian = size % 2 == 0 ? (values.get(size / 2) + values.get(size / 2 - 1)) / 2 : values.get(size / 2); mMin = values.get(0); mMax = values.get(values.size() - 1); mMedian = size % 2 == 0 ? (values.get(size / 2) + values.get(size / 2 - 1)) / 2 : values.get(size / 2); mPercentile90 = getPercentile(values, 90); mPercentile95 = getPercentile(values, 95); for (int i = 0; i < size; ++i) { long result = values.get(i); mMean += result; Loading Loading @@ -73,4 +75,21 @@ public class Stats { public double getStandardDeviation() { return mStandardDeviation; } public long getPercentile90() { return mPercentile90; } public long getPercentile95() { return mPercentile95; } private static long getPercentile(List<Long> values, int percentile) { if (percentile < 0 || percentile > 100) { throw new IllegalArgumentException( "invalid percentile " + percentile + ", should be 0-100"); } int idx = (values.size() - 1) * percentile / 100; return values.get(idx); } } Loading
apct-tests/perftests/utils/src/android/perftests/utils/ManualBenchmarkState.java +2 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ public final class ManualBenchmarkState { final Bundle status = new Bundle(); status.putLong(key + "_median", mStats.getMedian()); status.putLong(key + "_mean", (long) mStats.getMean()); status.putLong(key + "_percentile90", mStats.getPercentile90()); status.putLong(key + "_percentile95", mStats.getPercentile95()); status.putLong(key + "_stddev", (long) mStats.getStandardDeviation()); instrumentation.sendStatus(Activity.RESULT_OK, status); } Loading
apct-tests/perftests/utils/src/android/perftests/utils/Stats.java +23 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.List; public class Stats { private long mMedian, mMin, mMax; private long mMedian, mMin, mMax, mPercentile90, mPercentile95; private double mMean, mStandardDeviation; /* Calculate stats in constructor. */ Loading @@ -35,12 +35,14 @@ public class Stats { Collections.sort(values); mMedian = size % 2 == 0 ? (values.get(size / 2) + values.get(size / 2 - 1)) / 2 : values.get(size / 2); mMin = values.get(0); mMax = values.get(values.size() - 1); mMedian = size % 2 == 0 ? (values.get(size / 2) + values.get(size / 2 - 1)) / 2 : values.get(size / 2); mPercentile90 = getPercentile(values, 90); mPercentile95 = getPercentile(values, 95); for (int i = 0; i < size; ++i) { long result = values.get(i); mMean += result; Loading Loading @@ -73,4 +75,21 @@ public class Stats { public double getStandardDeviation() { return mStandardDeviation; } public long getPercentile90() { return mPercentile90; } public long getPercentile95() { return mPercentile95; } private static long getPercentile(List<Long> values, int percentile) { if (percentile < 0 || percentile > 100) { throw new IllegalArgumentException( "invalid percentile " + percentile + ", should be 0-100"); } int idx = (values.size() - 1) * percentile / 100; return values.get(idx); } }