summaryrefslogtreecommitdiff
path: root/services/gpuservice/GpuService.cpp
diff options
context:
space:
mode:
author Adithya Srinivasan <adsrini@google.com> 2020-06-18 11:28:12 -0700
committer Yiwei Zhang <zzyiwei@google.com> 2020-10-23 14:01:20 -0700
commitbb66c98ac04dd08dc1d8b718af22a438ab194850 (patch)
tree02e940b586549b9cfbcc5eb6d943468464235e3f /services/gpuservice/GpuService.cpp
parenta3dae23fbe4c43c9d4754f8c0f24146acdbf91f5 (diff)
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
Diffstat (limited to 'services/gpuservice/GpuService.cpp')
-rw-r--r--services/gpuservice/GpuService.cpp10
1 files changed, 8 insertions, 2 deletions
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 <gpumem/GpuMem.h>
#include <gpustats/GpuStats.h>
#include <private/android_filesystem_config.h>
+#include <tracing/GpuMemTracer.h>
#include <utils/String8.h>
#include <utils/Trace.h>
#include <vkjson.h>
@@ -48,8 +49,13 @@ const String16 sDump("android.permission.DUMP");
const char* const GpuService::SERVICE_NAME = "gpu";
GpuService::GpuService()
- : mGpuMem(std::make_unique<GpuMem>()), mGpuStats(std::make_unique<GpuStats>()) {
- std::thread asyncInitThread([this]() { mGpuMem->initialize(); });
+ : mGpuMem(std::make_shared<GpuMem>()),
+ mGpuStats(std::make_unique<GpuStats>()),
+ mGpuMemTracer(std::make_unique<GpuMemTracer>()) {
+ std::thread asyncInitThread([this]() {
+ mGpuMem->initialize();
+ mGpuMemTracer->initialize(mGpuMem);
+ });
asyncInitThread.detach();
};