From ceb5dd0faf9609ab0b1da3d436a1f55d85d85915 Mon Sep 17 00:00:00 2001 From: Greg Hackmann Date: Tue, 28 Nov 2017 18:35:46 -0800 Subject: [PATCH] PaintMeasureTextTest: only pause/resume not_cached benchmarks Pausing and resuming the benchmark timer isn't needed unless we plan to flush the text layout cache. The cached benchmark runs are so fast on high-end devices, the overhead of these extra calls can be significant compared to the actual code being measured. Test: run PaintMeasureTextTest on sailfish Bug: 69634871 Change-Id: If8246154e50451d82ac96e026036aa4a42eaed8d Signed-off-by: Greg Hackmann --- .../src/android/graphics/perftests/PaintMeasureTextTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apct-tests/perftests/core/src/android/graphics/perftests/PaintMeasureTextTest.java b/apct-tests/perftests/core/src/android/graphics/perftests/PaintMeasureTextTest.java index b81908c34263f..b9ee613315af8 100644 --- a/apct-tests/perftests/core/src/android/graphics/perftests/PaintMeasureTextTest.java +++ b/apct-tests/perftests/core/src/android/graphics/perftests/PaintMeasureTextTest.java @@ -80,11 +80,11 @@ public class PaintMeasureTextTest { } while (state.keepRunning()) { - state.pauseTiming(); if (mCacheMode == DONT_USE_CACHE) { + state.pauseTiming(); Canvas.freeTextLayoutCaches(); + state.resumeTiming(); } - state.resumeTiming(); paint.measureText(mText); }