diff options
| author | 2017-01-19 15:56:21 -0800 | |
|---|---|---|
| committer | 2017-02-21 09:49:10 -0800 | |
| commit | df1742ed47da1e9b61afeae16fa448d5302a8aa0 (patch) | |
| tree | 7986faf156f39bbe218ab13bad3ae5a1ea3dd581 /libs/hwui/renderthread | |
| parent | f8a420097e54a369d3bd1aa152ea0eea58ff5c94 (diff) | |
Overhaul GraphicsStatsService
* LRU cache of recently-used is dead, replaced
disk storage
* ASHMEM size is read from native by the system service,
no longer requires keeping a sizeof() in sync with a
constant in Java
* Supports dumping in proto format by passing --proto
* Rotates logs on a daily basis
* Keeps a history of the most recent 3 days
Bug: 33705836
Test: Manual. Verified log rotating works by setting it up to
rotate every minute instead of day. Confirmed /data/system/graphicsstats
only has the most recent 3 entries after several minutes
Change-Id: Ib84bafb26c58701cc86f123236de4fff01aaa4aa
Diffstat (limited to 'libs/hwui/renderthread')
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 5 | ||||
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 3 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 17 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.h | 3 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderThread.h | 1 |
5 files changed, 24 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index a53e5e0d919a..02a9ffa3039c 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -590,6 +590,7 @@ DeferredLayerUpdater* CanvasContext::createTextureLayer() { } void CanvasContext::dumpFrames(int fd) { + mJankTracker.dump(fd); FILE* file = fdopen(fd, "a"); fprintf(file, "\n\n---PROFILEDATA---\n"); for (size_t i = 0; i < static_cast<size_t>(FrameInfoIndex::NumIndexes); i++) { @@ -615,6 +616,10 @@ void CanvasContext::resetFrameStats() { mRenderThread.jankTracker().reset(); } +void CanvasContext::setName(const std::string&& name) { + mJankTracker.setDescription(JankTrackerType::Window, std::move(name)); +} + void CanvasContext::serializeDisplayListTree() { #if ENABLE_RENDERNODE_SERIALIZATION using namespace google::protobuf::io; diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index aa01caa8fc25..738c09141a7a 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -155,8 +155,7 @@ public: void dumpFrames(int fd); void resetFrameStats(); - void setName(const std::string&& name) { mName = name; } - const std::string& name() { return mName; } + void setName(const std::string&& name); void serializeDisplayListTree(); diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index 11614fa144e3..f4a4773b2937 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -487,9 +487,22 @@ CREATE_BRIDGE2(setProcessStatsBuffer, RenderThread* thread, int fd) { void RenderProxy::setProcessStatsBuffer(int fd) { SETUP_TASK(setProcessStatsBuffer); - args->thread = &mRenderThread; + auto& rt = RenderThread::getInstance(); + args->thread = &rt; args->fd = dup(fd); - post(task); + rt.queue(task); +} + +CREATE_BRIDGE1(rotateProcessStatsBuffer, RenderThread* thread) { + args->thread->jankTracker().rotateStorage(); + return nullptr; +} + +void RenderProxy::rotateProcessStatsBuffer() { + SETUP_TASK(rotateProcessStatsBuffer); + auto& rt = RenderThread::getInstance(); + args->thread = &rt; + rt.queue(task); } int RenderProxy::getRenderThreadTid() { diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h index 1629090d84a4..a60ed55c70d2 100644 --- a/libs/hwui/renderthread/RenderProxy.h +++ b/libs/hwui/renderthread/RenderProxy.h @@ -113,7 +113,8 @@ public: uint32_t frameTimePercentile(int p); ANDROID_API static void dumpGraphicsMemory(int fd); - ANDROID_API void setProcessStatsBuffer(int fd); + ANDROID_API static void rotateProcessStatsBuffer(); + ANDROID_API static void setProcessStatsBuffer(int fd); ANDROID_API int getRenderThreadTid(); ANDROID_API void serializeDisplayListTree(); diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h index d121bcf5b084..9bc5985e5b16 100644 --- a/libs/hwui/renderthread/RenderThread.h +++ b/libs/hwui/renderthread/RenderThread.h @@ -74,6 +74,7 @@ protected: }; class ANDROID_API RenderThread : public Thread { + PREVENT_COPY_AND_ASSIGN(RenderThread); public: // RenderThread takes complete ownership of tasks that are queued // and will delete them after they are run |