Loading services/gpuservice/GpuService.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,9 @@ GpuService::GpuService() }; GpuService::~GpuService() { mGpuMem->stop(); mGpuWork->stop(); mGpuWorkAsyncInitThread->join(); mGpuMemAsyncInitThread->join(); } Loading services/gpuservice/gpumem/GpuMem.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ void GpuMem::initialize() { return; } // Retry until GPU driver loaded or timeout. if (mStop.load()) return; sleep(1); } Loading services/gpuservice/gpumem/include/gpumem/GpuMem.h +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ public: // dumpsys interface void dump(const Vector<String16>& args, std::string* result); bool isInitialized() { return mInitialized.load(); } void stop() { mStop.store(true); } // Traverse the gpu memory total map to feed the callback function. void traverseGpuMemTotals(const std::function<void(int64_t ts, uint32_t gpuId, uint32_t pid, Loading @@ -48,6 +49,10 @@ private: // indicate whether ebpf has been initialized std::atomic<bool> mInitialized = false; // whether initialization should be stopped std::atomic<bool> mStop = false; // bpf map for GPU memory total data android::bpf::BpfMapRO<uint64_t, uint64_t> mGpuMemTotalMap; Loading services/gpuservice/gpuwork/GpuWork.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,7 @@ bool GpuWork::attachTracepoint(const char* programPath, const char* tracepointGr return false; } // Retry until GPU driver loaded or timeout. if (mStop.load()) return false; sleep(1); errno = 0; } Loading services/gpuservice/gpuwork/include/gpuwork/GpuWork.h +5 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public: ~GpuWork(); void initialize(); void stop() { mStop.store(true); } // Dumps the GPU work information. void dump(const Vector<String16>& args, std::string* result); Loading @@ -47,7 +48,7 @@ public: private: // Attaches tracepoint |tracepoint_group|/|tracepoint_name| to BPF program at path // |program_path|. The tracepoint is also enabled. static bool attachTracepoint(const char* program_path, const char* tracepoint_group, bool attachTracepoint(const char* program_path, const char* tracepoint_group, const char* tracepoint_name); // Native atom puller callback registered in statsd. Loading Loading @@ -80,6 +81,9 @@ private: // Indicates whether our eBPF components have been initialized. std::atomic<bool> mInitialized = false; // Indicates whether eBPF initialization should be stopped. std::atomic<bool> mStop = false; // A thread that periodically checks whether |mGpuWorkMap| is nearly full // and, if so, clears it. std::thread mMapClearerThread; Loading Loading
services/gpuservice/GpuService.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,9 @@ GpuService::GpuService() }; GpuService::~GpuService() { mGpuMem->stop(); mGpuWork->stop(); mGpuWorkAsyncInitThread->join(); mGpuMemAsyncInitThread->join(); } Loading
services/gpuservice/gpumem/GpuMem.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ void GpuMem::initialize() { return; } // Retry until GPU driver loaded or timeout. if (mStop.load()) return; sleep(1); } Loading
services/gpuservice/gpumem/include/gpumem/GpuMem.h +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ public: // dumpsys interface void dump(const Vector<String16>& args, std::string* result); bool isInitialized() { return mInitialized.load(); } void stop() { mStop.store(true); } // Traverse the gpu memory total map to feed the callback function. void traverseGpuMemTotals(const std::function<void(int64_t ts, uint32_t gpuId, uint32_t pid, Loading @@ -48,6 +49,10 @@ private: // indicate whether ebpf has been initialized std::atomic<bool> mInitialized = false; // whether initialization should be stopped std::atomic<bool> mStop = false; // bpf map for GPU memory total data android::bpf::BpfMapRO<uint64_t, uint64_t> mGpuMemTotalMap; Loading
services/gpuservice/gpuwork/GpuWork.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,7 @@ bool GpuWork::attachTracepoint(const char* programPath, const char* tracepointGr return false; } // Retry until GPU driver loaded or timeout. if (mStop.load()) return false; sleep(1); errno = 0; } Loading
services/gpuservice/gpuwork/include/gpuwork/GpuWork.h +5 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public: ~GpuWork(); void initialize(); void stop() { mStop.store(true); } // Dumps the GPU work information. void dump(const Vector<String16>& args, std::string* result); Loading @@ -47,7 +48,7 @@ public: private: // Attaches tracepoint |tracepoint_group|/|tracepoint_name| to BPF program at path // |program_path|. The tracepoint is also enabled. static bool attachTracepoint(const char* program_path, const char* tracepoint_group, bool attachTracepoint(const char* program_path, const char* tracepoint_group, const char* tracepoint_name); // Native atom puller callback registered in statsd. Loading Loading @@ -80,6 +81,9 @@ private: // Indicates whether our eBPF components have been initialized. std::atomic<bool> mInitialized = false; // Indicates whether eBPF initialization should be stopped. std::atomic<bool> mStop = false; // A thread that periodically checks whether |mGpuWorkMap| is nearly full // and, if so, clears it. std::thread mMapClearerThread; Loading