From a90b243e46da21a64872626e1e9bcaa18d51e437 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Thu, 5 Apr 2018 13:50:38 -0700 Subject: Improving jank tests diagnostics When there were 0 total frames, ProfileData generates something like: Janky frames: 0 (nan%) Then the test fails to parse it, and ends up with a mysterious "Failed to parse NUM_JANKY" diag (see the bug). Making the case 0/0 a 0%. Bug: 77528721 Test: atest google/perf/jank/SystemUI/UbSystemUIJankTests:android.platform.systemui.tests.jank.LauncherJankTests#testOpenAllAppsContainer Change-Id: Ib65b80dc689f7b6ee06b108114ffd7de9d739721 --- libs/hwui/ProfileData.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libs/hwui/ProfileData.cpp') diff --git a/libs/hwui/ProfileData.cpp b/libs/hwui/ProfileData.cpp index f9cf54998032..16966619aace 100644 --- a/libs/hwui/ProfileData.cpp +++ b/libs/hwui/ProfileData.cpp @@ -104,7 +104,8 @@ void ProfileData::dump(int fd) const { dprintf(fd, "\nStats since: %" PRIu64 "ns", mStatStartTime); dprintf(fd, "\nTotal frames rendered: %u", mTotalFrameCount); dprintf(fd, "\nJanky frames: %u (%.2f%%)", mJankFrameCount, - (float)mJankFrameCount / (float)mTotalFrameCount * 100.0f); + mTotalFrameCount == 0 ? 0.0f : + (float)mJankFrameCount / (float)mTotalFrameCount * 100.0f); dprintf(fd, "\n50th percentile: %ums", findPercentile(50)); dprintf(fd, "\n90th percentile: %ums", findPercentile(90)); dprintf(fd, "\n95th percentile: %ums", findPercentile(95)); -- cgit v1.2.3-59-g8ed1b