diff --git a/include/pmu.h b/include/pmu.h index f64f30304a40f7c141c311480acf78abb94fca98..e4ecc77905151fad20d8cc14143c1e28b80cc52d 100644 --- a/include/pmu.h +++ b/include/pmu.h @@ -421,7 +421,11 @@ enum PmuDeviceMetric { // Collect pcie tx latency. PMU_PCIE_TX_LAT, // Collect smmu address transaction. - PMU_SMMU_TRAN + PMU_SMMU_TRAN, + // Collect Ring2PA_ALL bandwidth. + PMU_RING2PA_ALL_BW, + // Collect PA2Ring_ALL bandwidth. + PMU_PA2RING_ALL_BW }; struct PmuDeviceAttr { diff --git a/pmu/pfm/uncore.cpp b/pmu/pfm/uncore.cpp index 75b4200bca51c31ab924926e4586c4ccc2cd5f07..b7e160b6b48be28209a030c301b0e69b1c3fdeef 100644 --- a/pmu/pfm/uncore.cpp +++ b/pmu/pfm/uncore.cpp @@ -360,21 +360,9 @@ struct PmuEvt* GetUncoreRawEvent(const char* pmuName, int collectType) } auto fieldsValues = unCoreRawFieldsValues[(std::string)pmuName]; auto* pmuEvtPtr = new PmuEvt {0}; - if (fieldsValues.find("config") == fieldsValues.end()) { - pmuEvtPtr->config = 0; - } else { - pmuEvtPtr->config = fieldsValues.at("config"); - } - if (fieldsValues.find("config1") == fieldsValues.end()) { - pmuEvtPtr->config1 = 0; - } else { - pmuEvtPtr->config1 = fieldsValues.at("config1"); - } - if (fieldsValues.find("config2") == fieldsValues.end()) { - pmuEvtPtr->config2 = 0; - } else { - pmuEvtPtr->config2 = fieldsValues.at("config2"); - } + pmuEvtPtr->config = fieldsValues.find("config") == fieldsValues.end() ? 0 : fieldsValues.at("config"); + pmuEvtPtr->config1 = fieldsValues.find("config1") == fieldsValues.end() ? 0 : fieldsValues.at("config1"); + pmuEvtPtr->config2 = fieldsValues.find("config2") == fieldsValues.end() ? 0 : fieldsValues.at("config2"); pmuEvtPtr->name = pmuName; pmuEvtPtr->pmuType = UNCORE_RAW_TYPE; diff --git a/python/modules/_libkperf/Pmu.py b/python/modules/_libkperf/Pmu.py index f6f66bc4c842ff0b724575dd86b1a0da3551a5cd..14c06b4e925f53d51467eae4ef6709bced8a1f66 100644 --- a/python/modules/_libkperf/Pmu.py +++ b/python/modules/_libkperf/Pmu.py @@ -100,15 +100,15 @@ class CtypesPmuAttr(ctypes.Structure): ('numCpu', ctypes.c_uint), ('evtAttr', ctypes.POINTER(CtypesEvtAttr)), ('sampleRate', SampleRateUnion), - ('useFreq', ctypes.c_bool), - ('excludeUser', ctypes.c_bool), - ('excludeKernel', ctypes.c_bool), + ('useFreq', ctypes.c_uint, 1), + ('excludeUser', ctypes.c_uint, 1), + ('excludeKernel', ctypes.c_uint, 1), ('symbolMode', ctypes.c_uint), - ('callStack', ctypes.c_bool), + ('callStack', ctypes.c_uint, 1), ('dataFilter', ctypes.c_uint64), # The enumeration for dataFilter will use 64 bits ('evFilter', ctypes.c_uint), ('minLatency', ctypes.c_ulong), - ('includeNewFork', ctypes.c_bool), + ('includeNewFork', ctypes.c_uint, 1), ('branchSampleFilter', ctypes.c_ulong), ] @@ -166,16 +166,16 @@ class CtypesPmuAttr(ctypes.Structure): else: self.evtAttr = None - self.useFreq = ctypes.c_bool(useFreq) - self.excludeUser = ctypes.c_bool(excludeUser) - self.excludeKernel = ctypes.c_bool(excludeKernel) + self.useFreq = useFreq + self.excludeUser = excludeUser + self.excludeKernel = excludeKernel + self.callStack = callStack + self.includeNewFork = includeNewFork self.symbolMode = ctypes.c_uint(symbolMode) - self.callStack = ctypes.c_bool(callStack) self.dataFilter = ctypes.c_uint64(dataFilter) self.evFilter = ctypes.c_uint(evFilter) self.minLatency = ctypes.c_ulong(minLatency) - self.includeNewFork = ctypes.c_bool(includeNewFork) self.branchSampleFilter = ctypes.c_ulong(branchSampleFilter) @@ -306,7 +306,7 @@ class PmuAttr: @useFreq.setter def useFreq(self, useFreq: bool) -> None: - self.c_pmu_attr.useFreq = ctypes.c_bool(useFreq) + self.c_pmu_attr.useFreq = int(useFreq) @property def excludeUser(self) -> bool: @@ -314,7 +314,7 @@ class PmuAttr: @excludeUser.setter def excludeUser(self, excludeUser: bool) -> None: - self.c_pmu_attr.excludeUser = ctypes.c_bool(excludeUser) + self.c_pmu_attr.excludeUser = int(excludeUser) @property def excludeKernel(self) -> bool: @@ -322,7 +322,7 @@ class PmuAttr: @excludeKernel.setter def excludeKernel(self, excludeKernel: bool) -> None: - self.c_pmu_attr.excludeKernel = ctypes.c_bool(excludeKernel) + self.c_pmu_attr.excludeKernel = int(excludeKernel) @property def symbolMode(self) -> int: @@ -338,7 +338,7 @@ class PmuAttr: @callStack.setter def callStack(self, callStack: bool) -> None: - self.c_pmu_attr.callStack = ctypes.c_bool(callStack) + self.c_pmu_attr.callStack = int(callStack) @property def dataFilter(self) -> int: @@ -370,7 +370,7 @@ class PmuAttr: @includeNewFork.setter def includeNewFork(self, includeNewFork: bool) -> None: - self.c_pmu_attr.includeNewFork = ctypes.c_bool(includeNewFork) + self.c_pmu_attr.includeNewFork = int(includeNewFork) @property def branchSampleFilter(self) -> int: