diff options
author | 2022-07-21 13:43:50 +0000 | |
---|---|---|
committer | 2022-07-21 13:43:50 +0000 | |
commit | db8f9c58d4e156638da862d5479c410b581e4418 (patch) | |
tree | 515a68920aa6fa3bbb7c6f0c7194c27e1f9d5b13 | |
parent | 777c8f5bffd7f1d6b930e312bbccc904091c2cff (diff) | |
parent | 9c34e71a25a19ba43554588ff7d36caca118c1bd (diff) |
Merge changes from topics "gpuMem", "timeInState"
* changes:
Rename time_in_state.o to timeInState.o
Rename gpu_mem.o to gpuMem.o
-rw-r--r-- | libs/cputimeinstate/cputimeinstate.cpp | 32 | ||||
-rw-r--r-- | libs/cputimeinstate/testtimeinstate.cpp | 6 | ||||
-rw-r--r-- | services/gpuservice/Android.bp | 2 | ||||
-rw-r--r-- | services/gpuservice/CleanSpec.mk | 10 | ||||
-rw-r--r-- | services/gpuservice/bpfprogs/Android.bp | 4 | ||||
-rw-r--r-- | services/gpuservice/bpfprogs/gpuMem.c (renamed from services/gpuservice/bpfprogs/gpu_mem.c) | 0 | ||||
-rw-r--r-- | services/gpuservice/gpumem/include/gpumem/GpuMem.h | 4 | ||||
-rw-r--r-- | services/gpuservice/tests/unittests/GpuMemTest.cpp | 4 |
8 files changed, 31 insertions, 31 deletions
diff --git a/libs/cputimeinstate/cputimeinstate.cpp b/libs/cputimeinstate/cputimeinstate.cpp index d1690437ef..706704ad34 100644 --- a/libs/cputimeinstate/cputimeinstate.cpp +++ b/libs/cputimeinstate/cputimeinstate.cpp @@ -131,24 +131,24 @@ static bool initGlobals() { } gTisTotalMapFd = - unique_fd{bpf_obj_get(BPF_FS_PATH "map_time_in_state_total_time_in_state_map")}; + unique_fd{bpf_obj_get(BPF_FS_PATH "map_timeInState_total_time_in_state_map")}; if (gTisTotalMapFd < 0) return false; - gTisMapFd = unique_fd{bpf_obj_get(BPF_FS_PATH "map_time_in_state_uid_time_in_state_map")}; + gTisMapFd = unique_fd{bpf_obj_get(BPF_FS_PATH "map_timeInState_uid_time_in_state_map")}; if (gTisMapFd < 0) return false; gConcurrentMapFd = - unique_fd{bpf_obj_get(BPF_FS_PATH "map_time_in_state_uid_concurrent_times_map")}; + unique_fd{bpf_obj_get(BPF_FS_PATH "map_timeInState_uid_concurrent_times_map")}; if (gConcurrentMapFd < 0) return false; gUidLastUpdateMapFd = - unique_fd{bpf_obj_get(BPF_FS_PATH "map_time_in_state_uid_last_update_map")}; + unique_fd{bpf_obj_get(BPF_FS_PATH "map_timeInState_uid_last_update_map")}; if (gUidLastUpdateMapFd < 0) return false; - gPidTisMapFd = unique_fd{mapRetrieveRO(BPF_FS_PATH "map_time_in_state_pid_time_in_state_map")}; + gPidTisMapFd = unique_fd{mapRetrieveRO(BPF_FS_PATH "map_timeInState_pid_time_in_state_map")}; if (gPidTisMapFd < 0) return false; - unique_fd trackedPidMapFd(mapRetrieveWO(BPF_FS_PATH "map_time_in_state_pid_tracked_map")); + unique_fd trackedPidMapFd(mapRetrieveWO(BPF_FS_PATH "map_timeInState_pid_tracked_map")); if (trackedPidMapFd < 0) return false; gInitialized = true; @@ -156,7 +156,7 @@ static bool initGlobals() { } static int retrieveProgramFd(const std::string &eventType, const std::string &eventName) { - std::string path = StringPrintf(BPF_FS_PATH "prog_time_in_state_tracepoint_%s_%s", + std::string path = StringPrintf(BPF_FS_PATH "prog_timeInState_tracepoint_%s_%s", eventType.c_str(), eventName.c_str()); return retrieveProgram(path.c_str()); } @@ -200,7 +200,7 @@ bool startTrackingUidTimes() { if (!initGlobals()) return false; if (gTracking) return true; - unique_fd cpuPolicyFd(mapRetrieveWO(BPF_FS_PATH "map_time_in_state_cpu_policy_map")); + unique_fd cpuPolicyFd(mapRetrieveWO(BPF_FS_PATH "map_timeInState_cpu_policy_map")); if (cpuPolicyFd < 0) return false; for (uint32_t i = 0; i < gPolicyCpus.size(); ++i) { @@ -209,7 +209,7 @@ bool startTrackingUidTimes() { } } - unique_fd freqToIdxFd(mapRetrieveWO(BPF_FS_PATH "map_time_in_state_freq_to_idx_map")); + unique_fd freqToIdxFd(mapRetrieveWO(BPF_FS_PATH "map_timeInState_freq_to_idx_map")); if (freqToIdxFd < 0) return false; freq_idx_key_t key; for (uint32_t i = 0; i < gNPolicies; ++i) { @@ -224,23 +224,23 @@ bool startTrackingUidTimes() { } } - unique_fd cpuLastUpdateFd(mapRetrieveWO(BPF_FS_PATH "map_time_in_state_cpu_last_update_map")); + unique_fd cpuLastUpdateFd(mapRetrieveWO(BPF_FS_PATH "map_timeInState_cpu_last_update_map")); if (cpuLastUpdateFd < 0) return false; std::vector<uint64_t> zeros(get_nprocs_conf(), 0); uint32_t zero = 0; if (writeToMapEntry(cpuLastUpdateFd, &zero, zeros.data(), BPF_ANY)) return false; - unique_fd nrActiveFd(mapRetrieveWO(BPF_FS_PATH "map_time_in_state_nr_active_map")); + unique_fd nrActiveFd(mapRetrieveWO(BPF_FS_PATH "map_timeInState_nr_active_map")); if (nrActiveFd < 0) return false; if (writeToMapEntry(nrActiveFd, &zero, &zero, BPF_ANY)) return false; - unique_fd policyNrActiveFd(mapRetrieveWO(BPF_FS_PATH "map_time_in_state_policy_nr_active_map")); + unique_fd policyNrActiveFd(mapRetrieveWO(BPF_FS_PATH "map_timeInState_policy_nr_active_map")); if (policyNrActiveFd < 0) return false; for (uint32_t i = 0; i < gNPolicies; ++i) { if (writeToMapEntry(policyNrActiveFd, &i, &zero, BPF_ANY)) return false; } - unique_fd policyFreqIdxFd(mapRetrieveWO(BPF_FS_PATH "map_time_in_state_policy_freq_idx_map")); + unique_fd policyFreqIdxFd(mapRetrieveWO(BPF_FS_PATH "map_timeInState_policy_freq_idx_map")); if (policyFreqIdxFd < 0) return false; for (uint32_t i = 0; i < gNPolicies; ++i) { auto freqIdx = getPolicyFreqIdx(i); @@ -560,10 +560,10 @@ bool startTrackingProcessCpuTimes(pid_t pid) { if (!gInitialized && !initGlobals()) return false; unique_fd trackedPidHashMapFd( - mapRetrieveWO(BPF_FS_PATH "map_time_in_state_pid_tracked_hash_map")); + mapRetrieveWO(BPF_FS_PATH "map_timeInState_pid_tracked_hash_map")); if (trackedPidHashMapFd < 0) return false; - unique_fd trackedPidMapFd(mapRetrieveWO(BPF_FS_PATH "map_time_in_state_pid_tracked_map")); + unique_fd trackedPidMapFd(mapRetrieveWO(BPF_FS_PATH "map_timeInState_pid_tracked_map")); if (trackedPidMapFd < 0) return false; for (uint32_t index = 0; index < MAX_TRACKED_PIDS; index++) { @@ -590,7 +590,7 @@ bool startAggregatingTaskCpuTimes(pid_t pid, uint16_t aggregationKey) { if (!gInitialized && !initGlobals()) return false; unique_fd taskAggregationMapFd( - mapRetrieveWO(BPF_FS_PATH "map_time_in_state_pid_task_aggregation_map")); + mapRetrieveWO(BPF_FS_PATH "map_timeInState_pid_task_aggregation_map")); if (taskAggregationMapFd < 0) return false; return writeToMapEntry(taskAggregationMapFd, &pid, &aggregationKey, BPF_ANY) == 0; diff --git a/libs/cputimeinstate/testtimeinstate.cpp b/libs/cputimeinstate/testtimeinstate.cpp index 45a6d47bb4..6ccc6cafb6 100644 --- a/libs/cputimeinstate/testtimeinstate.cpp +++ b/libs/cputimeinstate/testtimeinstate.cpp @@ -462,7 +462,7 @@ TEST_F(TimeInStateTest, AllUidConcurrentTimesFailsOnInvalidBucket) { ++uid; } android::base::unique_fd fd{ - bpf_obj_get(BPF_FS_PATH "map_time_in_state_uid_concurrent_times_map")}; + bpf_obj_get(BPF_FS_PATH "map_timeInState_uid_concurrent_times_map")}; ASSERT_GE(fd, 0); uint32_t nCpus = get_nprocs_conf(); uint32_t maxBucket = (nCpus - 1) / CPUS_PER_ENTRY; @@ -504,7 +504,7 @@ TEST_F(TimeInStateTest, RemoveUid) { { // Add a map entry for our fake UID by copying a real map entry android::base::unique_fd fd{ - bpf_obj_get(BPF_FS_PATH "map_time_in_state_uid_time_in_state_map")}; + bpf_obj_get(BPF_FS_PATH "map_timeInState_uid_time_in_state_map")}; ASSERT_GE(fd, 0); time_key_t k; ASSERT_FALSE(getFirstMapKey(fd, &k)); @@ -515,7 +515,7 @@ TEST_F(TimeInStateTest, RemoveUid) { ASSERT_FALSE(writeToMapEntry(fd, &k, vals.data(), BPF_NOEXIST)); android::base::unique_fd fd2{ - bpf_obj_get(BPF_FS_PATH "map_time_in_state_uid_concurrent_times_map")}; + bpf_obj_get(BPF_FS_PATH "map_timeInState_uid_concurrent_times_map")}; k.uid = copiedUid; k.bucket = 0; std::vector<concurrent_val_t> cvals(get_nprocs_conf()); diff --git a/services/gpuservice/Android.bp b/services/gpuservice/Android.bp index b9b6a19606..0411b31234 100644 --- a/services/gpuservice/Android.bp +++ b/services/gpuservice/Android.bp @@ -98,7 +98,7 @@ cc_binary { init_rc: ["gpuservice.rc"], required: [ "bpfloader", - "gpu_mem.o", + "gpuMem.o", ], srcs: [":gpuservice_binary_sources"], shared_libs: [ diff --git a/services/gpuservice/CleanSpec.mk b/services/gpuservice/CleanSpec.mk index 482fc6dfc3..c51f6aa5f0 100644 --- a/services/gpuservice/CleanSpec.mk +++ b/services/gpuservice/CleanSpec.mk @@ -44,9 +44,9 @@ #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) -# Remove gpu_mem.o +# Remove gpuMem.o $(call add-clean-step, rm -rf $(OUT_DIR)/soong/.intermediates/frameworks/native/services/gpuservice/bpf) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/FAKE/gpu_mem.o_intermediates) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/ETC/gpu_mem.o_gpu_mem.o_intermediates) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/bpf/gpu_mem.o) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/fake_packages/gpu_mem.o-timestamp) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/FAKE/gpuMem.o_intermediates) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/ETC/gpuMem.o_gpuMem.o_intermediates) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/bpf/gpuMem.o) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/fake_packages/gpuMem.o-timestamp) diff --git a/services/gpuservice/bpfprogs/Android.bp b/services/gpuservice/bpfprogs/Android.bp index 076affda5a..680b291fe3 100644 --- a/services/gpuservice/bpfprogs/Android.bp +++ b/services/gpuservice/bpfprogs/Android.bp @@ -22,8 +22,8 @@ package { } bpf { - name: "gpu_mem.o", - srcs: ["gpu_mem.c"], + name: "gpuMem.o", + srcs: ["gpuMem.c"], btf: true, cflags: [ "-Wall", diff --git a/services/gpuservice/bpfprogs/gpu_mem.c b/services/gpuservice/bpfprogs/gpuMem.c index 16e1e8a1ef..16e1e8a1ef 100644 --- a/services/gpuservice/bpfprogs/gpu_mem.c +++ b/services/gpuservice/bpfprogs/gpuMem.c diff --git a/services/gpuservice/gpumem/include/gpumem/GpuMem.h b/services/gpuservice/gpumem/include/gpumem/GpuMem.h index de691e2b75..7588b54818 100644 --- a/services/gpuservice/gpumem/include/gpumem/GpuMem.h +++ b/services/gpuservice/gpumem/include/gpumem/GpuMem.h @@ -57,9 +57,9 @@ private: static constexpr char kGpuMemTotalTracepoint[] = "gpu_mem_total"; // pinned gpu memory total bpf c program path in bpf sysfs static constexpr char kGpuMemTotalProgPath[] = - "/sys/fs/bpf/prog_gpu_mem_tracepoint_gpu_mem_gpu_mem_total"; + "/sys/fs/bpf/prog_gpuMem_tracepoint_gpu_mem_gpu_mem_total"; // pinned gpu memory total bpf map path in bpf sysfs - static constexpr char kGpuMemTotalMapPath[] = "/sys/fs/bpf/map_gpu_mem_gpu_mem_total_map"; + static constexpr char kGpuMemTotalMapPath[] = "/sys/fs/bpf/map_gpuMem_gpu_mem_total_map"; // 30 seconds timeout for trying to attach bpf program to tracepoint static constexpr int kGpuWaitTimeout = 30; }; diff --git a/services/gpuservice/tests/unittests/GpuMemTest.cpp b/services/gpuservice/tests/unittests/GpuMemTest.cpp index 36ae179ab7..8dabe4fbdb 100644 --- a/services/gpuservice/tests/unittests/GpuMemTest.cpp +++ b/services/gpuservice/tests/unittests/GpuMemTest.cpp @@ -90,8 +90,8 @@ TEST_F(GpuMemTest, validGpuMemTotalBpfPaths) { EXPECT_EQ(mTestableGpuMem.getGpuMemTraceGroup(), "gpu_mem"); EXPECT_EQ(mTestableGpuMem.getGpuMemTotalTracepoint(), "gpu_mem_total"); EXPECT_EQ(mTestableGpuMem.getGpuMemTotalProgPath(), - "/sys/fs/bpf/prog_gpu_mem_tracepoint_gpu_mem_gpu_mem_total"); - EXPECT_EQ(mTestableGpuMem.getGpuMemTotalMapPath(), "/sys/fs/bpf/map_gpu_mem_gpu_mem_total_map"); + "/sys/fs/bpf/prog_gpuMem_tracepoint_gpu_mem_gpu_mem_total"); + EXPECT_EQ(mTestableGpuMem.getGpuMemTotalMapPath(), "/sys/fs/bpf/map_gpuMem_gpu_mem_total_map"); } TEST_F(GpuMemTest, bpfInitializationFailed) { |