55 lines
1.6 KiB
Diff
55 lines
1.6 KiB
Diff
From e51951c9f047962a2dc1d6a1c0fe1407bafebe81 Mon Sep 17 00:00:00 2001
|
|
From: zhoukaiqi <zhoukaiqi@huawei.com>
|
|
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
|
|
|