Loading services/gpuservice/gpumem/GpuMem.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -43,18 +43,21 @@ void GpuMem::initialize() { // Make sure bpf programs are loaded bpf::waitForProgsLoaded(); int fd = bpf::bpfFdGet(kGpuMemTotalProgPath, BPF_F_RDONLY); errno = 0; int fd = bpf::retrieveProgram(kGpuMemTotalProgPath); if (fd < 0) { ALOGE("Failed to retrieve pinned program from %s", kGpuMemTotalProgPath); ALOGE("Failed to retrieve pinned program from %s [%d(%s)]", kGpuMemTotalProgPath, errno, strerror(errno)); return; } // Attach the program to the tracepoint, and the tracepoint is automatically enabled here. errno = 0; int count = 0; while (bpf_attach_tracepoint(fd, kGpuMemTraceGroup, kGpuMemTotalTracepoint) < 0) { if (++count > kGpuWaitTimeout) { ALOGE("Failed to attach bpf program to %s/%s tracepoint", kGpuMemTraceGroup, kGpuMemTotalTracepoint); ALOGE("Failed to attach bpf program to %s/%s tracepoint [%d(%s)]", kGpuMemTraceGroup, kGpuMemTotalTracepoint, errno, strerror(errno)); return; } // Retry until GPU driver loaded or timeout. Loading @@ -62,9 +65,11 @@ void GpuMem::initialize() { } // Use the read-only wrapper BpfMapRO to properly retrieve the read-only map. errno = 0; auto map = bpf::BpfMapRO<uint64_t, uint64_t>(kGpuMemTotalMapPath); if (!map.isValid()) { ALOGE("Failed to create bpf map from %s", kGpuMemTotalMapPath); ALOGE("Failed to create bpf map from %s [%d(%s)]", kGpuMemTotalMapPath, errno, strerror(errno)); return; } setGpuMemTotalMap(map); Loading Loading
services/gpuservice/gpumem/GpuMem.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -43,18 +43,21 @@ void GpuMem::initialize() { // Make sure bpf programs are loaded bpf::waitForProgsLoaded(); int fd = bpf::bpfFdGet(kGpuMemTotalProgPath, BPF_F_RDONLY); errno = 0; int fd = bpf::retrieveProgram(kGpuMemTotalProgPath); if (fd < 0) { ALOGE("Failed to retrieve pinned program from %s", kGpuMemTotalProgPath); ALOGE("Failed to retrieve pinned program from %s [%d(%s)]", kGpuMemTotalProgPath, errno, strerror(errno)); return; } // Attach the program to the tracepoint, and the tracepoint is automatically enabled here. errno = 0; int count = 0; while (bpf_attach_tracepoint(fd, kGpuMemTraceGroup, kGpuMemTotalTracepoint) < 0) { if (++count > kGpuWaitTimeout) { ALOGE("Failed to attach bpf program to %s/%s tracepoint", kGpuMemTraceGroup, kGpuMemTotalTracepoint); ALOGE("Failed to attach bpf program to %s/%s tracepoint [%d(%s)]", kGpuMemTraceGroup, kGpuMemTotalTracepoint, errno, strerror(errno)); return; } // Retry until GPU driver loaded or timeout. Loading @@ -62,9 +65,11 @@ void GpuMem::initialize() { } // Use the read-only wrapper BpfMapRO to properly retrieve the read-only map. errno = 0; auto map = bpf::BpfMapRO<uint64_t, uint64_t>(kGpuMemTotalMapPath); if (!map.isValid()) { ALOGE("Failed to create bpf map from %s", kGpuMemTotalMapPath); ALOGE("Failed to create bpf map from %s [%d(%s)]", kGpuMemTotalMapPath, errno, strerror(errno)); return; } setGpuMemTotalMap(map); Loading