From 7f152acce09229a1238d59239412e0fe2f4b2a67 Mon Sep 17 00:00:00 2001 From: wuying39 <921169248@qq.com> Date: Wed, 10 Sep 2025 09:31:06 +0800 Subject: [PATCH] delete unused functions --- pmu/sample_process.cpp | 24 ------------------------ pmu/sample_process.h | 1 - util/common.cpp | 19 ------------------- util/common.h | 1 - util/linked_list.h | 8 -------- 5 files changed, 53 deletions(-) diff --git a/pmu/sample_process.cpp b/pmu/sample_process.cpp index 5f30eb6..670d0c8 100644 --- a/pmu/sample_process.cpp +++ b/pmu/sample_process.cpp @@ -29,30 +29,6 @@ void KUNPENG_PMU::PerfMmapReadDone(PerfMmap &map) map.prev = ReadOnce(&base->data_head); } -int KUNPENG_PMU::MmapInit(PerfMmap &sampleMmap) -{ - struct perf_event_mmap_page *base = (struct perf_event_mmap_page *)sampleMmap.base; - __u64 head = ReadOnce(&base->data_head); - __u64 prev = sampleMmap.prev; - unsigned long size; - - sampleMmap.start = sampleMmap.overwrite ? head : prev; - sampleMmap.end = sampleMmap.overwrite ? prev : head; - - if (__glibc_unlikely((sampleMmap.end - sampleMmap.start) < sampleMmap.flush)) { - return -EAGAIN; - } - - size = sampleMmap.end - sampleMmap.start; - if (size > (unsigned long)(sampleMmap.mask) + 1) { - if (!sampleMmap.overwrite) { - sampleMmap.prev = head; - PerfMmapConsume(sampleMmap); - } - } - return 0; -} - void CopyDataInWhileLoop(KUNPENG_PMU::PerfMmap& map, __u64 offset, unsigned char* data, __u64 len) { /* diff --git a/pmu/sample_process.h b/pmu/sample_process.h index 12f21ed..5802331 100644 --- a/pmu/sample_process.h +++ b/pmu/sample_process.h @@ -50,7 +50,6 @@ namespace KUNPENG_PMU { - int MmapInit(PerfMmap& sampleMmap); union PerfEvent* ReadEvent(PerfMmap& map); int RingbufferReadInit(PerfMmap& map); inline void PerfMmapConsume(PerfMmap& map) diff --git a/util/common.cpp b/util/common.cpp index 13ad204..7d2e234 100644 --- a/util/common.cpp +++ b/util/common.cpp @@ -85,17 +85,6 @@ std::string ReadFileContent(const std::string& filePath) return content; } -int ConvertHexStrToInt(const std::string& hexStr, uint64_t& bus) -{ - try { - bus = stoul(hexStr, nullptr, 16); - } catch (const std::exception& e) { - pcerr::New(LIBPERF_ERR_NOT_SUPPORT_PCIE_COUNTING, "hexStr: " + hexStr + " is invalid"); - return LIBPERF_ERR_NOT_SUPPORT_PCIE_COUNTING; - } - return SUCCESS; -} - int RaiseNumFd(uint64_t numFd) { unsigned long extra = 50; @@ -152,14 +141,6 @@ std::string GetTraceEventDir() return ""; } -bool StartWith(const std::string& str, const std::string& prefix) -{ - if (str.size() < prefix.size()) { - return false; - } - return str.substr(0, prefix.size()) == prefix; -} - bool ConvertStrToInt(const std::string &intValStr, int32_t &val) { try { diff --git a/util/common.h b/util/common.h index 3f0ba3e..e3d3bab 100644 --- a/util/common.h +++ b/util/common.h @@ -53,7 +53,6 @@ std::vector SplitStringByDelimiter(const std::string& str, char del int RaiseNumFd(uint64_t numFd); bool ExistPath(const std::string& filePath); std::string GetTraceEventDir(); -bool StartWith(const std::string& str, const std::string& prefix); bool ConvertStrToInt(const std::string& intValStr, int32_t& val); int GetParanoidVal(); std::string GetCgroupPath(const std::string& cgroupName); diff --git a/util/linked_list.h b/util/linked_list.h index 8ceb67e..9c1ba28 100644 --- a/util/linked_list.h +++ b/util/linked_list.h @@ -32,14 +32,6 @@ ListNode* CreateNode() return newNode; } -// Function to add a node at the head of the linked list -template -void addHead(ListNode** head, ListNode* newNode) -{ - newNode->next = *head; - *head = newNode; -} - // Function to add a node at the tail of the linked list template void AddTail(ListNode** head, ListNode** newNode) -- Gitee