From 003daa1e8d03b7b9429db73342bb3d627837a438 Mon Sep 17 00:00:00 2001 From: zhoukaiqi Date: Mon, 29 Apr 2024 17:36:57 +0800 Subject: [PATCH] fix log while not supporting pmu uncore (cherry picked from commit 27b1a2a9f88db276079d6a914022b5e14d625981) --- ...-log-while-not-supporting-pmu-uncore.patch | 54 +++++++++++++++++++ oeAware-collector.spec | 6 ++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 0001-fix-log-while-not-supporting-pmu-uncore.patch diff --git a/0001-fix-log-while-not-supporting-pmu-uncore.patch b/0001-fix-log-while-not-supporting-pmu-uncore.patch new file mode 100644 index 0000000..a1cbe22 --- /dev/null +++ b/0001-fix-log-while-not-supporting-pmu-uncore.patch @@ -0,0 +1,54 @@ +From e51951c9f047962a2dc1d6a1c0fe1407bafebe81 Mon Sep 17 00:00:00 2001 +From: zhoukaiqi +Date: Mon, 29 Apr 2024 16:57:00 +0800 +Subject: [PATCH] fix log while not supporting pmu uncore + +--- + pmu/plugin/plugin_uncore.c | 8 ++++++-- + pmu/plugin/pmu_uncore.c | 2 +- + 2 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/pmu/plugin/plugin_uncore.c b/pmu/plugin/plugin_uncore.c +index 007e72d..2042d16 100644 +--- a/pmu/plugin/plugin_uncore.c ++++ b/pmu/plugin/plugin_uncore.c +@@ -45,9 +45,14 @@ static int uncore_open() + int pd = -1; + int ret; + ++ // Base on oeAware framework, uncore_open is called within uncore_enable. ++ // If pmu_uncore is not supported, it will generate a large number of error logs. ++ // So temporarily set uncore_is_open = true util oeAware framework provides open API. ++ uncore_is_open = true; ++ + ret = hha_uncore_config_init(); + if (ret != 0) { +- printf("hha init failed\n"); ++ printf("This system not support pmu_uncore\n"); + return pd; + } + +@@ -76,7 +81,6 @@ static int uncore_open() + return pd; + } + +- uncore_is_open = true; + return pd; + } + +diff --git a/pmu/plugin/pmu_uncore.c b/pmu/plugin/pmu_uncore.c +index 0d1506c..56b9190 100644 +--- a/pmu/plugin/pmu_uncore.c ++++ b/pmu/plugin/pmu_uncore.c +@@ -97,7 +97,7 @@ int hha_uncore_config_init(void) + struct dirent **namelist; + + hha_num = scandir(DEVICE_PATH, &namelist, hha_scandir_select, alphasort); +- if (hha_num < 0) { ++ if (hha_num <= 0) { + printf("scandir failed\n"); + return -1; + } +-- +2.27.0 + diff --git a/oeAware-collector.spec b/oeAware-collector.spec index 2453bc8..5e5c6cd 100644 --- a/oeAware-collector.spec +++ b/oeAware-collector.spec @@ -1,10 +1,11 @@ Name: oeAware-collector Version: v1.0.0 -Release: 2 +Release: 3 Summary: %{name} provides low-overhead metrics collection capabilities, including microarchitecture, system, and kernel information. License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} Source0: %{name}-%{version}.tar.gz +Patch1: 0001-fix-log-while-not-supporting-pmu-uncore.patch %global libkperf_name libkperf %global libkperf_tagver v1.0 @@ -79,6 +80,9 @@ install -b -m740 ./thread_collector/build/libthread_collector.so ${RPM_BUIL %attr(0440, root, root) %{_libdir}/oeAware-plugin/collector/*.so %changelog +* Mon Apr 29 2024 zhoukaiqi - v1.0.0-3 +- fix log while not supporting pmu uncore + * Thu Apr 18 2024 liuchanggeng - v1.0.0-2 - add debug package -- Gitee