libkperf/0011-add-perrno-operation-not-supported.patch
2024-11-19 20:29:04 +08:00

52 lines
1.5 KiB
Diff

From c9c20f95f9f58c10af07850bad2a0b33d97a71d8 Mon Sep 17 00:00:00 2001
From: eho <2220386943@qq.com>
Date: Thu, 24 Oct 2024 10:35:40 +0800
Subject: [PATCH 11/20] add perrno operation not supported.
---
pmu/pmu_event.cpp | 2 ++
test/test_perf/test_api.cpp | 16 +++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/pmu/pmu_event.cpp b/pmu/pmu_event.cpp
index 8a0bdc6..71a3616 100644
--- a/pmu/pmu_event.cpp
+++ b/pmu/pmu_event.cpp
@@ -30,6 +30,8 @@ namespace KUNPENG_PMU {
return LIBPERF_ERR_NO_PROC;
case EMFILE:
return LIBPERF_ERR_TOO_MANY_FD;
+ case EOPNOTSUPP:
+ return LIBPERF_ERR_INVALID_EVENT;
default:
return UNKNOWN_ERROR;
}
diff --git a/test/test_perf/test_api.cpp b/test/test_perf/test_api.cpp
index 20f0de2..5cf9213 100644
--- a/test/test_perf/test_api.cpp
+++ b/test/test_perf/test_api.cpp
@@ -601,4 +601,18 @@ TEST_F(TestAPI, TestSPEEventGroup)
attr.evtAttr = groupId;
pd = PmuOpen(SPE_SAMPLING, &attr);
ASSERT_TRUE(pd == -1);
-}
\ No newline at end of file
+}
+
+TEST_F(TestAPI, TestOperationNotSupported)
+{
+ PmuAttr attr = {0};
+ char* evtList[1] = {"hisi_sccl3_ddrc2/flux_rd/"};
+ attr.evtList = evtList;
+ attr.numEvt = 1;
+ attr.freq = 1000;
+ attr.useFreq = 1;
+ attr.symbolMode = RESOLVE_ELF;
+ int pd = PmuOpen(SAMPLING, &attr);
+ ASSERT_EQ(pd, -1);
+ ASSERT_EQ(Perrorno(), LIBPERF_ERR_INVALID_EVENT);
+}
--
2.43.0