diff options
author | John Reck <jreck@google.com> | 2016-03-28 10:38:19 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2016-03-30 10:08:13 -0700 |
commit | c7cd9cf25d9775446ffcb6b5f20b0a4c1e3c99c5 (patch) | |
tree | f03bd3caf0f50e1fafcdca4ec0cf419fa68a4ac6 /libs/hwui/JankTracker.cpp | |
parent | a5c45459d3f114f125da3357c36b5a3f659d2229 (diff) |
Add an option to try and filter out test overhead
Bug: 26912651
By setting debug.hwui.filter_test_overhead to true, hwui's
janktracker will attempt to filter out overhead caused
by the event injection that automated testing uses
Change-Id: I75c8dc5e7798e06e3009baf396108507c7240eec
Diffstat (limited to 'libs/hwui/JankTracker.cpp')
-rw-r--r-- | libs/hwui/JankTracker.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp index 76e587e162b6..47d01088f6f7 100644 --- a/libs/hwui/JankTracker.cpp +++ b/libs/hwui/JankTracker.cpp @@ -15,6 +15,8 @@ */ #include "JankTracker.h" +#include "Properties.h" + #include <algorithm> #include <cutils/ashmem.h> #include <cutils/log.h> @@ -77,6 +79,11 @@ static const uint32_t kBucket2msIntervals = 32; // If a frame is > this, start counting in increments of 4ms static const uint32_t kBucket4msIntervals = 48; +// For testing purposes to try and eliminate test infra overhead we will +// consider any unknown delay of frame start as part of the test infrastructure +// and filter it out of the frame profile data +static FrameInfoIndex sFrameStart = FrameInfoIndex::IntendedVsync; + // This will be called every frame, performance sensitive // Uses bit twiddling to avoid branching while achieving the packing desired static uint32_t frameCountIndexForFrameTime(nsecs_t frameTime, uint32_t max) { @@ -242,7 +249,7 @@ void JankTracker::addFrame(const FrameInfo& frame) { mData->totalFrameCount++; // Fast-path for jank-free frames int64_t totalDuration = - frame[FrameInfoIndex::FrameCompleted] - frame[FrameInfoIndex::IntendedVsync]; + frame[FrameInfoIndex::FrameCompleted] - frame[sFrameStart]; uint32_t framebucket = frameCountIndexForFrameTime( totalDuration, mData->frameCounts.size() - 1); // Keep the fast path as fast as possible. @@ -280,6 +287,9 @@ void JankTracker::dumpBuffer(const void* buffer, size_t bufsize, int fd) { } void JankTracker::dumpData(const ProfileData* data, int fd) { + if (sFrameStart != FrameInfoIndex::IntendedVsync) { + dprintf(fd, "\nNote: Data has been filtered!"); + } dprintf(fd, "\nStats since: %" PRIu64 "ns", data->statStartTime); dprintf(fd, "\nTotal frames rendered: %u", data->totalFrameCount); dprintf(fd, "\nJanky frames: %u (%.2f%%)", data->jankFrameCount, @@ -305,6 +315,9 @@ void JankTracker::reset() { mData->totalFrameCount = 0; mData->jankFrameCount = 0; mData->statStartTime = systemTime(CLOCK_MONOTONIC); + sFrameStart = Properties::filterOutTestOverhead + ? FrameInfoIndex::HandleInputStart + : FrameInfoIndex::IntendedVsync; } uint32_t JankTracker::findPercentile(const ProfileData* data, int percentile) { |