blob: 0e4b01ca028260775bef3e00fa6a7d9af338c53e [file] [log] [blame]
Yiwei Zhang9feb4ae2020-04-30 10:48:35 -07001/*
2 * Copyright 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <bpf/BpfMap.h>
20#include <gpumem/GpuMem.h>
21
22namespace android {
23
24class TestableGpuMem {
25public:
26 TestableGpuMem() = default;
27 explicit TestableGpuMem(GpuMem *gpuMem) : mGpuMem(gpuMem) {}
28
29 void setGpuMemTotalMap(bpf::BpfMap<uint64_t, uint64_t>& map) {
30 mGpuMem->setGpuMemTotalMap(map);
31 }
32
33 std::string getGpuMemTraceGroup() { return mGpuMem->kGpuMemTraceGroup; }
34
35 std::string getGpuMemTotalTracepoint() { return mGpuMem->kGpuMemTotalTracepoint; }
36
37 std::string getGpuMemTotalProgPath() { return mGpuMem->kGpuMemTotalProgPath; }
38
39 std::string getGpuMemTotalMapPath() { return mGpuMem->kGpuMemTotalMapPath; }
40
41private:
42 GpuMem *mGpuMem;
43};
44
45} // namespace android