Merge "Add an option to try and filter out test overhead" into nyc-dev
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "JankTracker.h"
|
#include "JankTracker.h"
|
||||||
|
|
||||||
|
#include "Properties.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cutils/ashmem.h>
|
#include <cutils/ashmem.h>
|
||||||
#include <cutils/log.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
|
// If a frame is > this, start counting in increments of 4ms
|
||||||
static const uint32_t kBucket4msIntervals = 48;
|
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
|
// This will be called every frame, performance sensitive
|
||||||
// Uses bit twiddling to avoid branching while achieving the packing desired
|
// Uses bit twiddling to avoid branching while achieving the packing desired
|
||||||
static uint32_t frameCountIndexForFrameTime(nsecs_t frameTime, uint32_t max) {
|
static uint32_t frameCountIndexForFrameTime(nsecs_t frameTime, uint32_t max) {
|
||||||
@@ -242,7 +249,7 @@ void JankTracker::addFrame(const FrameInfo& frame) {
|
|||||||
mData->totalFrameCount++;
|
mData->totalFrameCount++;
|
||||||
// Fast-path for jank-free frames
|
// Fast-path for jank-free frames
|
||||||
int64_t totalDuration =
|
int64_t totalDuration =
|
||||||
frame[FrameInfoIndex::FrameCompleted] - frame[FrameInfoIndex::IntendedVsync];
|
frame[FrameInfoIndex::FrameCompleted] - frame[sFrameStart];
|
||||||
uint32_t framebucket = frameCountIndexForFrameTime(
|
uint32_t framebucket = frameCountIndexForFrameTime(
|
||||||
totalDuration, mData->frameCounts.size() - 1);
|
totalDuration, mData->frameCounts.size() - 1);
|
||||||
// Keep the fast path as fast as possible.
|
// 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) {
|
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, "\nStats since: %" PRIu64 "ns", data->statStartTime);
|
||||||
dprintf(fd, "\nTotal frames rendered: %u", data->totalFrameCount);
|
dprintf(fd, "\nTotal frames rendered: %u", data->totalFrameCount);
|
||||||
dprintf(fd, "\nJanky frames: %u (%.2f%%)", data->jankFrameCount,
|
dprintf(fd, "\nJanky frames: %u (%.2f%%)", data->jankFrameCount,
|
||||||
@@ -305,6 +315,9 @@ void JankTracker::reset() {
|
|||||||
mData->totalFrameCount = 0;
|
mData->totalFrameCount = 0;
|
||||||
mData->jankFrameCount = 0;
|
mData->jankFrameCount = 0;
|
||||||
mData->statStartTime = systemTime(CLOCK_MONOTONIC);
|
mData->statStartTime = systemTime(CLOCK_MONOTONIC);
|
||||||
|
sFrameStart = Properties::filterOutTestOverhead
|
||||||
|
? FrameInfoIndex::HandleInputStart
|
||||||
|
: FrameInfoIndex::IntendedVsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t JankTracker::findPercentile(const ProfileData* data, int percentile) {
|
uint32_t JankTracker::findPercentile(const ProfileData* data, int percentile) {
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ bool Properties::sDisableProfileBars = false;
|
|||||||
|
|
||||||
bool Properties::waitForGpuCompletion = false;
|
bool Properties::waitForGpuCompletion = false;
|
||||||
|
|
||||||
|
bool Properties::filterOutTestOverhead = false;
|
||||||
|
|
||||||
static int property_get_int(const char* key, int defaultValue) {
|
static int property_get_int(const char* key, int defaultValue) {
|
||||||
char buf[PROPERTY_VALUE_MAX] = {'\0',};
|
char buf[PROPERTY_VALUE_MAX] = {'\0',};
|
||||||
|
|
||||||
@@ -156,6 +158,8 @@ bool Properties::load() {
|
|||||||
textureCacheFlushRate = std::max(0.0f, std::min(1.0f,
|
textureCacheFlushRate = std::max(0.0f, std::min(1.0f,
|
||||||
property_get_float(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, DEFAULT_TEXTURE_CACHE_FLUSH_RATE)));
|
property_get_float(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, DEFAULT_TEXTURE_CACHE_FLUSH_RATE)));
|
||||||
|
|
||||||
|
filterOutTestOverhead = property_get_bool(PROPERTY_FILTER_TEST_OVERHEAD, false);
|
||||||
|
|
||||||
return (prevDebugLayersUpdates != debugLayersUpdates)
|
return (prevDebugLayersUpdates != debugLayersUpdates)
|
||||||
|| (prevDebugOverdraw != debugOverdraw)
|
|| (prevDebugOverdraw != debugOverdraw)
|
||||||
|| (prevDebugStencilClip != debugStencilClip);
|
|| (prevDebugStencilClip != debugStencilClip);
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ enum DebugLevel {
|
|||||||
*/
|
*/
|
||||||
#define PROPERTY_ENABLE_PARTIAL_UPDATES "debug.hwui.enable_partial_updates"
|
#define PROPERTY_ENABLE_PARTIAL_UPDATES "debug.hwui.enable_partial_updates"
|
||||||
|
|
||||||
|
#define PROPERTY_FILTER_TEST_OVERHEAD "debug.hwui.filter_test_overhead"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Runtime configuration properties
|
// Runtime configuration properties
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -294,6 +296,10 @@ public:
|
|||||||
// Should be used only by test apps
|
// Should be used only by test apps
|
||||||
static bool waitForGpuCompletion;
|
static bool waitForGpuCompletion;
|
||||||
|
|
||||||
|
// Should only be set by automated tests to try and filter out
|
||||||
|
// any overhead they add
|
||||||
|
static bool filterOutTestOverhead;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static ProfileType sProfileType;
|
static ProfileType sProfileType;
|
||||||
static bool sDisableProfileBars;
|
static bool sDisableProfileBars;
|
||||||
|
|||||||
Reference in New Issue
Block a user