From bb66c98ac04dd08dc1d8b718af22a438ab194850 Mon Sep 17 00:00:00 2001 From: Adithya Srinivasan Date: Thu, 18 Jun 2020 11:28:12 -0700 Subject: GpuMem perfetto producer To overcome the problem of ftrace gpumem events not emitting anything during MEC (with apps that do launch-time allocations), this change adds a perfetto producer to emit initial counter values at the start of a trace, so that the visualization won't so zero usage. Test: adb shell perfetto --query | grep gpu. Test: Take a perfetto trace with android.gpumem enabled Bug: 157142645 Change-Id: I5c8278754549399ffa51e6e6fc2ca69b51976cb2 Merged-In: I5c8278754549399ffa51e6e6fc2ca69b51976cb2 --- services/gpuservice/GpuService.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'services/gpuservice/GpuService.cpp') diff --git a/services/gpuservice/GpuService.cpp b/services/gpuservice/GpuService.cpp index 84ae608148..52d5d4fc46 100644 --- a/services/gpuservice/GpuService.cpp +++ b/services/gpuservice/GpuService.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -48,8 +49,13 @@ const String16 sDump("android.permission.DUMP"); const char* const GpuService::SERVICE_NAME = "gpu"; GpuService::GpuService() - : mGpuMem(std::make_unique()), mGpuStats(std::make_unique()) { - std::thread asyncInitThread([this]() { mGpuMem->initialize(); }); + : mGpuMem(std::make_shared()), + mGpuStats(std::make_unique()), + mGpuMemTracer(std::make_unique()) { + std::thread asyncInitThread([this]() { + mGpuMem->initialize(); + mGpuMemTracer->initialize(mGpuMem); + }); asyncInitThread.detach(); }; -- cgit v1.2.3-59-g8ed1b