diff --git a/0001-add-realtime-compile-macro.patch b/0001-add-realtime-compile-macro.patch deleted file mode 100644 index 594449c7d147a7781bc23ddecabe85a4a74f5d23..0000000000000000000000000000000000000000 --- a/0001-add-realtime-compile-macro.patch +++ /dev/null @@ -1,111 +0,0 @@ -From da4ae191c21dd3908a8a96984ea6f53de7d8cb99 Mon Sep 17 00:00:00 2001 -From: fly_1997 -Date: Wed, 25 Jun 2025 11:07:21 +0800 -Subject: [PATCH] add realtime compile macro - ---- - build.sh | 11 +++++++++-- - src/plugin/tune/system/CMakeLists.txt | 11 ++++++++--- - src/plugin/tune/system/system_tune.cpp | 4 ++++ - 3 files changed, 21 insertions(+), 5 deletions(-) - -diff --git a/build.sh b/build.sh -index 428b222..93d5253 100644 ---- a/build.sh -+++ b/build.sh -@@ -10,9 +10,10 @@ build_kperf_by_src="ON" - with_test="OFF" - with_debug="OFF" - with_asan="OFF" -+with_realtime="OFF" # enable realtime mode, default is OFF - with_optimization="OFF" - enable_ebpf="ON" --params="kperfrpm,help,test,with_asan,with_optimization,debug,release,disable_ebpf" -+params="kperfrpm,help,test,with_asan,with_realtime,with_optimization,debug,release,disable_ebpf" - function usage() { - echo "" - echo "usage: build.sh [OPTIONS] [ARGS]" -@@ -22,6 +23,7 @@ function usage() { - echo " -t |--test build tests case" - echo " --with_asan open AddressSanitizer compilation option" - echo " --with_optimization open optimization compilation option" -+ echo " --with_realtime open realtime compilation option" - echo " --disable_ebpf disable eBPF" - echo " --debug compile the debug version" - echo " --release compile the release version" -@@ -54,6 +56,10 @@ while true; do - with_asan="ON" - shift - ;; -+ --with_realtime) -+ with_realtime="ON" -+ shift -+ ;; - --with_optimization) - with_optimization="ON" - shift -@@ -102,5 +108,6 @@ fi - - cmake .. -DLIB_KPERF_LIBPATH=${libkperf_lib} -DLIB_KPERF_INCPATH=${script_dir}/include/oeaware/data \ - -DWITH_TEST=${with_test} -DWITH_DEBUG=${with_debug} -DWITH_ASAN=${with_asan} \ -- -DWITH_OPTIMIZATION=${with_optimization} -DENABLE_EBPF=${enable_ebpf} -+ -DWITH_OPTIMIZATION=${with_optimization} -DENABLE_EBPF=${enable_ebpf} \ -+ -DWITH_REALTIME=${with_realtime} - make -j$(nproc) -\ No newline at end of file -diff --git a/src/plugin/tune/system/CMakeLists.txt b/src/plugin/tune/system/CMakeLists.txt -index 0562095..c756ae0 100644 ---- a/src/plugin/tune/system/CMakeLists.txt -+++ b/src/plugin/tune/system/CMakeLists.txt -@@ -13,8 +13,9 @@ add_subdirectory(power/seep_tune) - add_subdirectory(transparent_hugepage_tune) - add_subdirectory(preload) - add_subdirectory(binary) --add_subdirectory(realtime) -- -+if (WITH_REALTIME) -+ add_subdirectory(realtime) -+endif() - add_library(system_tune SHARED - system_tune.cpp) - -@@ -22,7 +23,11 @@ if (WITH_ASAN) - enable_asan(system_tune) - endif() - --target_link_libraries(system_tune stealtask_tune dynamic_smt_tune smc_tune xcall_tune numa_sched_tune seep_tune preload_tune transparent_hugepage_tune binary_tune realtime_tune) -+target_link_libraries(system_tune stealtask_tune dynamic_smt_tune smc_tune xcall_tune numa_sched_tune seep_tune preload_tune transparent_hugepage_tune binary_tune) -+if(WITH_REALTIME) -+ target_compile_definitions(system_tune PRIVATE BUILD_REALTIME) -+ target_link_libraries(system_tune realtime_tune) -+endif() - if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") - target_compile_definitions(system_tune PRIVATE BUILD_NETIRQ_TUNE) - target_compile_definitions(system_tune PRIVATE BUILD_MULTI_NET_PATH_TUNE) -diff --git a/src/plugin/tune/system/system_tune.cpp b/src/plugin/tune/system/system_tune.cpp -index 6e7b49f..7423350 100644 ---- a/src/plugin/tune/system/system_tune.cpp -+++ b/src/plugin/tune/system/system_tune.cpp -@@ -20,7 +20,9 @@ - #include "cpu/numa_sched_tune/numa_sched_tune.h" - #include "preload/preload_tune.h" - #include "binary/binary_tune.h" -+#ifdef BUILD_REALTIME - #include "realtime/realtime_tune.h" -+#endif - #ifdef BUILD_NETIRQ_TUNE - #include "network/hardirq_tune/hardirq_tune.h" - #endif -@@ -40,7 +42,9 @@ extern "C" void GetInstance(std::vector> &in - interface.emplace_back(std::make_shared()); - interface.emplace_back(std::make_shared()); - interface.emplace_back(std::make_shared()); -+#ifdef BUILD_REALTIME - interface.emplace_back(std::make_shared()); -+#endif - #ifdef BUILD_NETIRQ_TUNE - interface.emplace_back(std::make_shared()); - #endif --- -2.33.0 - diff --git a/0002-adapt-dynamicsmt-analysis-if-smt-is-not-enable.patch b/0002-adapt-dynamicsmt-analysis-if-smt-is-not-enable.patch deleted file mode 100644 index 65984b84e9b7ce2ff9701fceebad4ad8785f7bae..0000000000000000000000000000000000000000 --- a/0002-adapt-dynamicsmt-analysis-if-smt-is-not-enable.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 3a21f791a4f526c7cb993b3f9ab4fb06360213b0 Mon Sep 17 00:00:00 2001 -From: zhaolichang -Date: Sat, 28 Jun 2025 17:05:41 +0800 -Subject: [PATCH] adapt dynamicsmt analysis if smt is not enable - ---- - include/oeaware/utils.h | 1 + - src/common/utils.cpp | 12 ++++++++++++ - .../analysis/dynamic_smt/dynamic_smt_analysis.cpp | 6 +++++- - src/plugin/tune/system/binary/binary_tune.cpp | 15 ++------------- - 4 files changed, 20 insertions(+), 14 deletions(-) - -diff --git a/include/oeaware/utils.h b/include/oeaware/utils.h -index c0a4c33..6c493a2 100644 ---- a/include/oeaware/utils.h -+++ b/include/oeaware/utils.h -@@ -55,6 +55,7 @@ bool SetFileDescriptorLimit(long limit); - bool SetMemLockRlimt(rlim_t limit); - std::string ReplaceString(const std::string &input, const std::string &target, const std::string &replacement); - bool ReadSchedFeatures(std::string &schedPath, std::vector &features); -+bool IsSmtEnable(); - void AnalysisResultItemFree(AnalysisResultItem *analysisResultItem); - - namespace DockerUtils { -diff --git a/src/common/utils.cpp b/src/common/utils.cpp -index 4b0ba2d..36bd074 100644 ---- a/src/common/utils.cpp -+++ b/src/common/utils.cpp -@@ -516,6 +516,18 @@ bool ReadSchedFeatures(std::string &schedPath, std::vector &feature - return true; - } - -+bool IsSmtEnable() -+{ -+ std::string content; -+ std::ifstream inFile("/sys/devices/system/cpu/smt/active"); -+ if (!inFile.is_open()) { -+ return false; -+ } -+ inFile >> content; -+ inFile.close(); -+ return content == "1"; -+} -+ - void AnalysisResultItemFree(AnalysisResultItem *analysisResultItem) - { - if (analysisResultItem == nullptr) { -diff --git a/src/plugin/scenario/analysis/dynamic_smt/dynamic_smt_analysis.cpp b/src/plugin/scenario/analysis/dynamic_smt/dynamic_smt_analysis.cpp -index 683090a..5683855 100644 ---- a/src/plugin/scenario/analysis/dynamic_smt/dynamic_smt_analysis.cpp -+++ b/src/plugin/scenario/analysis/dynamic_smt/dynamic_smt_analysis.cpp -@@ -147,6 +147,10 @@ void DynamicSmtAnalysis::Analysis(const std::string &topicType) - } - bool DynamicSmtAnalysis::IsTuneSupport() - { -+ if (!oeaware::IsSmtEnable()) { -+ return false; -+ } -+ - std::vector features; - std::string path; - oeaware::ReadSchedFeatures(path, features); -@@ -157,4 +161,4 @@ bool DynamicSmtAnalysis::IsTuneSupport() - } - return false; - } --} -\ No newline at end of file -+} -diff --git a/src/plugin/tune/system/binary/binary_tune.cpp b/src/plugin/tune/system/binary/binary_tune.cpp -index da0546a..173f37a 100644 ---- a/src/plugin/tune/system/binary/binary_tune.cpp -+++ b/src/plugin/tune/system/binary/binary_tune.cpp -@@ -15,23 +15,12 @@ - #include - #include - #include -+#include "oeaware/utils.h" - #include "oeaware/data/env_data.h" - #include "oeaware/data/thread_info.h" - #include "oeaware/data/docker_data.h" - #include "binary_tune.h" - --bool IsSmtEnable() --{ -- std::string content; -- std::ifstream inFile("/sys/devices/system/cpu/smt/active"); -- if (!inFile.is_open()) { -- return false; -- } -- inFile >> content; -- inFile.close(); -- return content == "1"; --} -- - bool BinaryTune::ReadConfig(const std::string &path) - { - std::ifstream configFile(path); -@@ -145,7 +134,7 @@ void BinaryTune::UpdateData(const DataList &dataList) - oeaware::Result BinaryTune::Enable(const std::string ¶m) - { - (void)param; -- if (!IsSmtEnable()) { -+ if (!oeaware::IsSmtEnable()) { - WARN(logger, "smt is not enable, open binary tune failed."); - return oeaware::Result(FAILED); - } --- -2.43.0 - diff --git a/0003-fix-code-check.patch b/0003-fix-code-check.patch deleted file mode 100644 index 49a72ecec04fe1e2d6e0bbdfb21aa2985e63b541..0000000000000000000000000000000000000000 --- a/0003-fix-code-check.patch +++ /dev/null @@ -1,516 +0,0 @@ -From 96c7d4840eb202bb4b3d3f23c2f4dfa1049589fd Mon Sep 17 00:00:00 2001 -From: LHesperus <2639350497@qq.com> -Date: Mon, 14 Jul 2025 09:19:49 +0800 -Subject: [PATCH] fix: code check - ---- - src/client/analysis/analysis_report.cpp | 20 ++++++-- - src/client/arg_parse.cpp | 12 ++--- - src/plugin/collect/pmu/pmu_uncore.cpp | 2 +- - .../collect/system/command/command_base.cpp | 1 + - .../scenario/analysis/analysis/analysis.h | 22 ++++----- - src/plugin/scenario/analysis/analysis/env.h | 6 +-- - .../analysis/common/analysis_utils.cpp | 3 ++ - .../scenario/analysis/common/analysis_utils.h | 1 + - src/plugin/tune/system/binary/binary_tune.h | 9 +++- - .../network/hardirq_tune/hardirq_tune.cpp | 2 +- - .../tune/system/network/smc_tune/smc_common.h | 4 +- - .../tune/system/network/smc_tune/smc_ueid.cpp | 47 ++++++++----------- - .../tune/system/network/smc_tune/smc_ueid.h | 1 - - src/plugin_mgr/instance_run_handler.cpp | 14 +++--- - src/plugin_mgr/message_manager.cpp | 14 ++++-- - tests/safe_queue_test.cpp | 2 +- - .../read_proc_stat/read_proc_stat.cpp | 4 +- - 17 files changed, 91 insertions(+), 73 deletions(-) - -diff --git a/src/client/analysis/analysis_report.cpp b/src/client/analysis/analysis_report.cpp -index 33b98aa..2d2295d 100644 ---- a/src/client/analysis/analysis_report.cpp -+++ b/src/client/analysis/analysis_report.cpp -@@ -110,12 +110,24 @@ void AnalysisReport::Init(Config &config) - const int PARAM_INDEX = 2; - for (auto &topic : topics) { - char *insName = new char[topic[INS_NAME_INDEX].size() + 1]; -- strcpy_s(insName, topic[INS_NAME_INDEX].size() + 1, topic[INS_NAME_INDEX].data()); -+ errno_t ret = strcpy_s(insName, topic[INS_NAME_INDEX].size() + 1, topic[INS_NAME_INDEX].data()); -+ if (ret != EOK) { -+ std::cerr << "Error: insName strcpy_s failed with error code " << ret << std::endl; -+ return; -+ } - char *topicName = new char[topic[TOPIC_NAME_INDEX].size() + 1]; -- strcpy_s(topicName, topic[TOPIC_NAME_INDEX].size() + 1, topic[TOPIC_NAME_INDEX].data()); -+ ret = strcpy_s(topicName, topic[TOPIC_NAME_INDEX].size() + 1, topic[TOPIC_NAME_INDEX].data()); -+ if (ret != EOK) { -+ std::cerr << "Error: topicName strcpy_s failed with error code " << ret << std::endl; -+ return; -+ } - char *param = new char[topic[PARAM_INDEX].size() + 1]; -- strcpy_s(param, topic[PARAM_INDEX].size() + 1, topic[PARAM_INDEX].data()); -- CTopic cTopic{insName, topicName, param}; -+ ret = strcpy_s(param, topic[PARAM_INDEX].size() + 1, topic[PARAM_INDEX].data()); -+ if (ret != EOK) { -+ std::cerr << "Error: param strcpy_s failed with error code " << ret << std::endl; -+ return; -+ } -+ CTopic cTopic{ insName, topicName, param }; - OeSubscribe(&cTopic, CallBack); - delete []insName; - delete []topicName; -diff --git a/src/client/arg_parse.cpp b/src/client/arg_parse.cpp -index dd5dea5..5b87d1c 100644 ---- a/src/client/arg_parse.cpp -+++ b/src/client/arg_parse.cpp -@@ -130,16 +130,16 @@ int ArgParse::Init(int argc, char *argv[]) - help = true; - break; - case '?': { -- std::string optString; -+ std::string errOpt; - if (optind == argc) { -- optString += argv[optind - 1]; -+ errOpt += argv[optind - 1]; - } else { -- optString += argv[optind]; -+ errOpt += argv[optind]; - } -- if (!opts.count(optopt)) { -- ArgError("unknown option '" + optString + "'."); -+ if (opts.count(optopt) == 0) { -+ ArgError("unknown option '" + errOpt + "'."); - } else { -- ArgError("option " + optString + " requires an argument."); -+ ArgError("option " + errOpt + " requires an argument."); - } - break; - } -diff --git a/src/plugin/collect/pmu/pmu_uncore.cpp b/src/plugin/collect/pmu/pmu_uncore.cpp -index 66a6bf3..9c0b6ae 100644 ---- a/src/plugin/collect/pmu/pmu_uncore.cpp -+++ b/src/plugin/collect/pmu/pmu_uncore.cpp -@@ -46,7 +46,7 @@ static int ReadSingleUncoreEvent(const char *hhaName, struct UncoreConfig *uncor - char hhaPath[MAX_PATH_LEN] = {0}; - - // Read cfg -- snprintf_truncated_s(hhaPath, MAX_PATH_LEN, "%s/%s/", hhaName, eventName); -+ snprintf_truncated_s(hhaPath, sizeof(hhaPath), "%s/%s/", hhaName, eventName); - - strcpy_s(uncoreEvent->uncoreName, MAX_PATH_LEN, hhaPath); - -diff --git a/src/plugin/collect/system/command/command_base.cpp b/src/plugin/collect/system/command/command_base.cpp -index ebd3415..7e5a2c0 100644 ---- a/src/plugin/collect/system/command/command_base.cpp -+++ b/src/plugin/collect/system/command/command_base.cpp -@@ -41,6 +41,7 @@ void PopenProcess::Popen(const std::string &cmd) - close(pipeFd[0]); - dup2(pipeFd[1], STDOUT_FILENO); - close(pipeFd[1]); -+ // 使用白名单检查命令是否合法,外部无法随意控制 - execl("/bin/bash", "bash", "-c", cmd.data(), nullptr); - _exit(1); - } -diff --git a/src/plugin/scenario/analysis/analysis/analysis.h b/src/plugin/scenario/analysis/analysis/analysis.h -index 16ff733..7316db2 100644 ---- a/src/plugin/scenario/analysis/analysis/analysis.h -+++ b/src/plugin/scenario/analysis/analysis/analysis.h -@@ -55,6 +55,17 @@ struct CollectDataInfo { - }; - - class Analysis { -+public: -+ Env &env = Env::GetInstance(); -+ int GetPeriod(); -+ void Init(); -+ void UpdatePmu(const std::string &topicName, int dataLen, const PmuData *data, uint64_t interval); -+ void Analyze(bool isSummary); -+ const std::string &GetReport(bool isSummary) -+ { -+ return isSummary ? summaryReport : realtimeReport; -+ } -+ void Exit(); - private: - SystemInfo sysInfo; - std::vector recNetQueue; -@@ -84,17 +95,6 @@ private: - std::string GetNetInfoReport(const NetworkInfo &netInfo); - std::string GetSuggestReport(const std::unordered_map &tuneInstances); - std::string GetSolutionReport(const std::unordered_map &tuneInstances); --public: -- Env &env = Env::GetInstance(); -- int GetPeriod(); -- void Init(); -- void UpdatePmu(const std::string &topicName, int dataLen, const PmuData *data, uint64_t interval); -- void Analyze(bool isSummary); -- const std::string &GetReport(bool isSummary) -- { -- return isSummary ? summaryReport : realtimeReport; -- } -- void Exit(); - }; - - #endif -\ No newline at end of file -diff --git a/src/plugin/scenario/analysis/analysis/env.h b/src/plugin/scenario/analysis/analysis/env.h -index 28b21f4..b3abf93 100644 ---- a/src/plugin/scenario/analysis/analysis/env.h -+++ b/src/plugin/scenario/analysis/analysis/env.h -@@ -19,9 +19,6 @@ - - - class Env { --private: -- Env() = default; -- ~Env() = default; - public: - static Env &GetInstance() - { -@@ -44,6 +41,9 @@ public: - int diffDistance; - bool Init(); - void InitDistance(); -+private: -+ Env() = default; -+ ~Env() = default; - }; - - #endif -\ No newline at end of file -diff --git a/src/plugin/scenario/analysis/common/analysis_utils.cpp b/src/plugin/scenario/analysis/common/analysis_utils.cpp -index cf82575..7367e81 100644 ---- a/src/plugin/scenario/analysis/common/analysis_utils.cpp -+++ b/src/plugin/scenario/analysis/common/analysis_utils.cpp -@@ -16,6 +16,9 @@ void CreateAnalysisResultItem(const std::vector> &metri - const std::vector &suggestionItem, const std::vector type, AnalysisResultItem *analysisResultItem) - { - auto len = metrics.size(); -+ if (len > MAX_ANALYSIS_ITEMS) { -+ len = MAX_ANALYSIS_ITEMS; -+ } - analysisResultItem->dataItemLen = len; - analysisResultItem->dataItem = new DataItem[len]; - const int METRIC_INDEX = 0; -diff --git a/src/plugin/scenario/analysis/common/analysis_utils.h b/src/plugin/scenario/analysis/common/analysis_utils.h -index d012a47..c63cc8b 100644 ---- a/src/plugin/scenario/analysis/common/analysis_utils.h -+++ b/src/plugin/scenario/analysis/common/analysis_utils.h -@@ -16,6 +16,7 @@ - #include - #include "oeaware/data/analysis_data.h" - namespace oeaware { -+const int MAX_ANALYSIS_ITEMS = 10000; - const int PERCENTAGE_FACTOR = 100; - const int DYNAMIC_SMT_THRESHOLD = 40; - const int THP_THRESHOLD1 = 5; -diff --git a/src/plugin/tune/system/binary/binary_tune.h b/src/plugin/tune/system/binary/binary_tune.h -index da1f6e1..3246d90 100644 ---- a/src/plugin/tune/system/binary/binary_tune.h -+++ b/src/plugin/tune/system/binary/binary_tune.h -@@ -31,8 +31,13 @@ private: - struct InternalContainer { - InternalContainer() = default; - InternalContainer(std::string name, int64_t period, int64_t quota, int64_t burst, -- std::string cpus, std::vector tasks):id(std::move(name)), cfsPeriodUs(period), -- cfsQuotaUs(quota), cfsBurstUs(burst), cpus(std::move(cpus)), tasks(std::move(tasks)) { -+ std::string cpus, std::vector tasks) -+ : id(std::move(name)), -+ cfsPeriodUs(period), -+ cfsQuotaUs(quota), -+ cfsBurstUs(burst), -+ cpus(std::move(cpus)), -+ tasks(std::move(tasks)) { - } - std::string id; - int64_t cfsPeriodUs = 0; -diff --git a/src/plugin/tune/system/network/hardirq_tune/hardirq_tune.cpp b/src/plugin/tune/system/network/hardirq_tune/hardirq_tune.cpp -index 73bcc7c..7e33fd2 100644 ---- a/src/plugin/tune/system/network/hardirq_tune/hardirq_tune.cpp -+++ b/src/plugin/tune/system/network/hardirq_tune/hardirq_tune.cpp -@@ -333,7 +333,7 @@ void NetHardIrq::UpdateThreadAndQueueInfo(const RecNetQueue &queData, const RecN - int core = thrData.core; - int node = cpu2Numa[core]; - QueueInfo &info = netQueue[queData.dev][queueId]; -- int size = info.numaRxTimes.size(); -+ size_t size = info.numaRxTimes.size(); - if (size < numaNum) { - info.numaRxTimes.resize(numaNum, 0); - } -diff --git a/src/plugin/tune/system/network/smc_tune/smc_common.h b/src/plugin/tune/system/network/smc_tune/smc_common.h -index 0d9911b..9ef2f0c 100644 ---- a/src/plugin/tune/system/network/smc_tune/smc_common.h -+++ b/src/plugin/tune/system/network/smc_tune/smc_common.h -@@ -34,7 +34,7 @@ constexpr int SMC_MAX_EID_LEN = 32; /* Max length of eid */ - #define SMC_DISABLE 1 - - /* SMC_GENL_FAMILY commands */ --enum { -+using SMC_ACC_NL_OPTS = enum { - SMC_ACC_NL_GET_SYS_INFO = 1, - SMC_ACC_NL_GET_LGR_SMCR, - SMC_ACC_NL_GET_LINK_SMCR, -@@ -53,7 +53,7 @@ enum { - }; - - /* SMC_ACC_NL_UEID attributes */ --enum { -+using SMC_ACC_NLA_EID_ATTRS = enum { - SMC_ACC_NLA_EID_TABLE_UNSPEC, - SMC_ACC_NLA_EID_TABLE_ENTRY, /* string */ - __SMC_ACC_NLA_EID_TABLE_MAX, -diff --git a/src/plugin/tune/system/network/smc_tune/smc_ueid.cpp b/src/plugin/tune/system/network/smc_tune/smc_ueid.cpp -index 48ef4f9..719ed0e 100644 ---- a/src/plugin/tune/system/network/smc_tune/smc_ueid.cpp -+++ b/src/plugin/tune/system/network/smc_tune/smc_ueid.cpp -@@ -12,6 +12,7 @@ - - #include "smc_ueid.h" - -+static const int SMC_CMD_MAX_LEN = 128; - const struct nla_policy smc_gen_ueid_policy[SMC_ACC_NLA_EID_TABLE_MAX + 1] = { - [SMC_ACC_NLA_EID_TABLE_UNSPEC] = {.type = NLA_UNSPEC}, - [SMC_ACC_NLA_EID_TABLE_ENTRY] = {.type = NLA_NUL_STRING}, -@@ -58,11 +59,11 @@ static inline bool IsValidCmd(const std::string& cmd) - return false; - } - --static int Exec(const char *cmd, size_t len) -+static int Exec(const std::string &cmd) - { - FILE *output; -- char buffer[128]; -- if (len > sizeof(buffer)) { -+ char buffer[SMC_CMD_MAX_LEN]; -+ if (cmd.length() > SMC_CMD_MAX_LEN) { - SMCLOG_ERROR("Too many words"); - } - int status; -@@ -71,10 +72,12 @@ static int Exec(const char *cmd, size_t len) - SMCLOG_ERROR("Invalid command: " << cmd); - return -1; - } -- output = popen(cmd, "r"); -+ // 使用白名单检查命令是否合法,外部无法随意控制 -+ output = popen(cmd.c_str(), "r"); - if (output == NULL) { - return -1; - } -+ // Discard all output to avoid blocking pipe - while (fgets(buffer, sizeof(buffer), output) != NULL) { - } - -@@ -83,20 +86,6 @@ static int Exec(const char *cmd, size_t len) - return WEXITSTATUS(status); - } - --static inline int SimpleExec(char *cmd, ...) --{ -- char cmd_format[512]; -- va_list valist; -- -- va_start(valist, cmd); -- if (!vsprintf(cmd_format, cmd, valist)) { -- SMCLOG_ERROR("get cmd format error."); -- return -1; -- } -- va_end(valist); -- return Exec(cmd_format, strlen(cmd_format)); --} -- - int SmcOperator::InvokeUeid(int act) - { - int rc = EXIT_SUCCESS; -@@ -144,8 +133,8 @@ int SmcOperator::RunSmcAcc() - std::stringstream args; - - if (enable == SMC_DISABLE) { -- if (!SimpleExec((char *)"lsmod | grep -w smc_acc")) { -- rc = SimpleExec((char *)"rmmod smc_acc"); -+ if (!Exec("lsmod | grep -w smc_acc")) { -+ rc = Exec("rmmod smc_acc"); - goto out; - } - goto out; -@@ -163,8 +152,9 @@ int SmcOperator::RunSmcAcc() - rc = EXIT_FAILURE; - goto out; - } -- if (SimpleExec((char *)"lsmod | grep -w smc_acc")) { -- rc = SimpleExec((char *)"insmod %s %s", SMC_ACC_KO_PATH, args.str().c_str()); -+ if (Exec("lsmod | grep -w smc_acc")) { -+ std::string cmd = std::string("insmod ") + SMC_ACC_KO_PATH + args.str(); -+ rc = Exec(cmd); - } - - out: -@@ -174,11 +164,11 @@ out: - int SmcOperator::CheckSmcKo() - { - int rc = EXIT_SUCCESS; -- if (SimpleExec((char *)"lsmod | grep -w smc") == EXIT_FAILURE) { -+ if (Exec("lsmod | grep -w smc") == EXIT_FAILURE) { - rc = EXIT_FAILURE; - SMCLOG_ERROR("smc ko is not running"); - } -- if (SimpleExec((char *)"lsmod | grep -w smc_acc") == EXIT_FAILURE) { -+ if (Exec("lsmod | grep -w smc_acc") == EXIT_FAILURE) { - rc = EXIT_FAILURE; - SMCLOG_ERROR("smc_acc ko is not running"); - } -@@ -271,8 +261,8 @@ int SmcOperator::ReRunSmcAcc() - int rc = EXIT_SUCCESS; - std::stringstream args; - -- if (!SimpleExec((char *)"lsmod | grep -w smc_acc")) { -- rc = SimpleExec((char *)"rmmod smc_acc"); -+ if (!Exec("lsmod | grep -w smc_acc")) { -+ rc = Exec("rmmod smc_acc"); - } - - if (!blackPortList.empty()) { -@@ -288,8 +278,9 @@ int SmcOperator::ReRunSmcAcc() - rc = EXIT_FAILURE; - goto out; - } -- if (SimpleExec((char *)"lsmod | grep -w smc_acc")) { -- rc = SimpleExec((char *)"insmod %s %s", SMC_ACC_KO_PATH, args.str().c_str()); -+ if (Exec("lsmod | grep -w smc_acc")) { -+ std::string cmd = std::string("insmod ") + SMC_ACC_KO_PATH + args.str(); -+ rc = Exec(cmd); - } - - out: -diff --git a/src/plugin/tune/system/network/smc_tune/smc_ueid.h b/src/plugin/tune/system/network/smc_tune/smc_ueid.h -index ce7aab2..2760529 100644 ---- a/src/plugin/tune/system/network/smc_tune/smc_ueid.h -+++ b/src/plugin/tune/system/network/smc_tune/smc_ueid.h -@@ -51,7 +51,6 @@ private: - ~SmcOperator() - { - } -- int act; - int enable; - struct nl_sock *sk; - bool isInit; -diff --git a/src/plugin_mgr/instance_run_handler.cpp b/src/plugin_mgr/instance_run_handler.cpp -index c6971e8..eae4533 100644 ---- a/src/plugin_mgr/instance_run_handler.cpp -+++ b/src/plugin_mgr/instance_run_handler.cpp -@@ -202,7 +202,7 @@ bool InstanceRunHandler::HandleMessage() - { - std::shared_ptr msg; - bool shutdown = false; -- while (true) { -+ while (!shutdown) { - if (!this->RecvQueueTryPop(msg)) { - break; - } -@@ -246,9 +246,9 @@ bool InstanceRunHandler::HandleMessage() - } - } - msg->NotifyOne(); -- if (shutdown) { -- return false; -- } -+ } -+ if (shutdown) { -+ return false; - } - return true; - } -@@ -292,8 +292,10 @@ void InstanceRunHandler::Start() - { - INFO(logger, "instance schedule started!"); - const static uint64_t millisecond = 1000; -- while (true) { -- if (!HandleMessage()) { -+ bool quit = false; -+ while (!quit) { -+ quit = !HandleMessage(); -+ if (quit) { - INFO(logger, "instance schedule shutdown!"); - break; - } -diff --git a/src/plugin_mgr/message_manager.cpp b/src/plugin_mgr/message_manager.cpp -index a921caf..973f3a0 100644 ---- a/src/plugin_mgr/message_manager.cpp -+++ b/src/plugin_mgr/message_manager.cpp -@@ -265,10 +265,12 @@ bool TcpMessageHandler::HandleMessage(int fd) - - void TcpMessageHandler::Start() - { -- while (true) { -+ bool quit = false; -+ while (!quit) { - Event event; - recvData->WaitAndPop(event); - if (event.opt == Opt::SHUTDOWN) { -+ quit = true; - break; - } - if (event.opt != Opt::DATA) { -@@ -315,7 +317,7 @@ void TcpSocket::SaveConnection() - return; - } - len -= offsetof(struct sockaddr_un, sun_path); -- memcpy_s(name, maxNameLength, un.sun_path, len); -+ memcpy_s(name, sizeof(name), un.sun_path, len); - name[len] = 0; - bool isSdk = false; - if (len > 0) { -@@ -376,15 +378,17 @@ void TcpSocket::Close() - - void TcpSocket::ServeAccept() - { -- std::thread t([&]() { -- tcpMessageHandler.Start(); -+ std::thread t([this]() { -+ this->tcpMessageHandler.Start(); - }); - t.detach(); - struct epoll_event evs[MAX_EVENT_SIZE]; - int sz = sizeof(evs) / sizeof(struct epoll_event); -- while (true) { -+ bool quit = false; -+ while (!quit) { - auto num = epoll->EventWait(evs, sz, -1); - if (num <= 0 || tcpMessageHandler.shutdown) { -+ quit = true; - break; - } - HandleEvents(evs, num); -diff --git a/tests/safe_queue_test.cpp b/tests/safe_queue_test.cpp -index 2cc9ba5..9acc346 100644 ---- a/tests/safe_queue_test.cpp -+++ b/tests/safe_queue_test.cpp -@@ -38,7 +38,7 @@ TEST(SafeQueue, WaitAndPop) - { - oeaware::SafeQueue q; - int x = 0; -- auto future = std::async([&]() { -+ auto future = std::async([&q, &x]() { - q.WaitAndPop(x); - }); - auto status = future.wait_for(std::chrono::seconds(2)); -diff --git a/tests/workload/read_proc_stat/read_proc_stat.cpp b/tests/workload/read_proc_stat/read_proc_stat.cpp -index b9b47a0..099b649 100644 ---- a/tests/workload/read_proc_stat/read_proc_stat.cpp -+++ b/tests/workload/read_proc_stat/read_proc_stat.cpp -@@ -10,7 +10,7 @@ - * g++ read_proc_stat.cpp -o read_proc_stat -lboundscheck -O2 - * ./read_proc_stat 4 1000 - */ --typedef enum { -+using EnvCpuUtilType = enum { - CPU_USER, - CPU_NICE, - CPU_SYSTEM, -@@ -23,7 +23,7 @@ typedef enum { - CPU_GNICE, - CPU_TIME_SUM, // sum of all above - CPU_UTIL_TYPE_MAX, --} EnvCpuUtilType; -+}; - - // 生成随机 CPU 时间数据 - bool UpdateProcStat(const std::string &statpath, int cpuNum, std::vector> &cpuTime) --- -2.43.0 - diff --git a/0004-add-trace-log-and-change-level-intf-and-delete-logge.patch b/0004-add-trace-log-and-change-level-intf-and-delete-logge.patch deleted file mode 100644 index 4fb7a1452b9a399f4bbc0596b8943a738dd59398..0000000000000000000000000000000000000000 --- a/0004-add-trace-log-and-change-level-intf-and-delete-logge.patch +++ /dev/null @@ -1,406 +0,0 @@ -From a3e1475434026b9ea2992fa5dd7b20b83c5d3cfe Mon Sep 17 00:00:00 2001 -From: LHesperus <2639350497@qq.com> -Date: Mon, 21 Jul 2025 10:13:43 +0800 -Subject: [PATCH] add trace log and change level intf and delete logger.h from - devel - ---- - CMakeLists.txt | 1 - - include/oeaware/interface.h | 16 ++++-- - .../analysis/numa_analysis/numa_analysis.cpp | 3 +- - .../system/network/smc_tune/smc_common.cpp | 2 +- - .../tune/system/network/smc_tune/smc_common.h | 3 +- - .../tune/system/network/smc_tune/smc_tune.cpp | 1 + - src/plugin_mgr/config.cpp | 1 + - src/plugin_mgr/event/event_handler.h | 2 +- - src/plugin_mgr/instance_run_handler.h | 2 +- - src/{common => plugin_mgr}/logger.cpp | 5 +- - {include/oeaware => src/plugin_mgr}/logger.h | 36 ++++++++++--- - src/plugin_mgr/message_manager.h | 2 +- - src/plugin_mgr/plugin.cpp | 3 +- - tests/CMakeLists.txt | 8 ++- - tests/logger_test.cpp | 52 +++++++++++++++---- - 15 files changed, 108 insertions(+), 29 deletions(-) - rename src/{common => plugin_mgr}/logger.cpp (96%) - rename {include/oeaware => src/plugin_mgr}/logger.h (70%) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1f00ba2..0f8cbcf 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -54,7 +54,6 @@ file(COPY "${CMAKE_SOURCE_DIR}/include/oeaware/data_list.h" - "${CMAKE_SOURCE_DIR}/include/oeaware/default_path.h" - "${CMAKE_SOURCE_DIR}/include/oeaware/instance_run_message.h" - "${CMAKE_SOURCE_DIR}/include/oeaware/interface.h" -- "${CMAKE_SOURCE_DIR}/include/oeaware/logger.h" - "${CMAKE_SOURCE_DIR}/include/oeaware/safe_queue.h" - "${CMAKE_SOURCE_DIR}/include/oeaware/serialize.h" - "${CMAKE_SOURCE_DIR}/include/oeaware/topic.h" -diff --git a/include/oeaware/interface.h b/include/oeaware/interface.h -index 50dee2d..24904e8 100644 ---- a/include/oeaware/interface.h -+++ b/include/oeaware/interface.h -@@ -12,8 +12,10 @@ - #ifndef OEAWARE_INTERFACE_H - #define OEAWARE_INTERFACE_H - #include --#include - #include -+#include -+#include -+#include - #include - - namespace oeaware { -@@ -22,6 +24,13 @@ const int TUNE = 0b10000; - const int SCENARIO = 0b01000; - const int RUN_ONCE = 0b00010; - -+#define TRACE(logger, fmt) LOG4CPLUS_TRACE(logger, fmt) -+#define INFO(logger, fmt) LOG4CPLUS_INFO(logger, fmt) -+#define DEBUG(logger, fmt) LOG4CPLUS_DEBUG(logger, fmt) -+#define WARN(logger, fmt) LOG4CPLUS_WARN(logger, fmt) -+#define ERROR(logger, fmt) LOG4CPLUS_ERROR(logger, fmt) -+#define FATAL(logger, fmt) LOG4CPLUS_FATAL(logger, fmt) -+ - class Interface { - public: - Interface() = default; -@@ -73,6 +82,7 @@ protected: - std::string version; - std::string description; - std::vector supportTopics; -+ // not use logger before subclass constructor ends, because it's not assign a value before getInstance(name) - log4cplus::Logger logger; - int priority; - int type; -@@ -93,7 +103,7 @@ protected: - } - void Publish(DataList &dataList, bool isFree = true) - { -- Topic topic{dataList.topic.instanceName, dataList.topic.topicName, dataList.topic.params}; -+ Topic topic{ dataList.topic.instanceName, dataList.topic.topicName, dataList.topic.params }; - auto msg = std::make_shared(RunType::PUBLISH_DATA, - std::vector{topic.GetType()}); - msg->isFree = isFree; -@@ -107,6 +117,6 @@ protected: - private: - std::shared_ptr>> recvQueue; - }; --} -+} // namespace oeaware - - #endif -diff --git a/src/plugin/scenario/analysis/numa_analysis/numa_analysis.cpp b/src/plugin/scenario/analysis/numa_analysis/numa_analysis.cpp -index be175d1..d6b7aac 100644 ---- a/src/plugin/scenario/analysis/numa_analysis/numa_analysis.cpp -+++ b/src/plugin/scenario/analysis/numa_analysis/numa_analysis.cpp -@@ -13,7 +13,8 @@ - #include - #include - #include --#include "oeaware/logger.h" -+#include -+#include - #include "oeaware/utils.h" - #include "analysis_utils.h" - #include "oeaware/interface.h" -diff --git a/src/plugin/tune/system/network/smc_tune/smc_common.cpp b/src/plugin/tune/system/network/smc_tune/smc_common.cpp -index 38900c6..2a08866 100644 ---- a/src/plugin/tune/system/network/smc_tune/smc_common.cpp -+++ b/src/plugin/tune/system/network/smc_tune/smc_common.cpp -@@ -1,3 +1,3 @@ - #include "smc_common.h" - --log4cplus::Logger g_smcLogger = oeaware::Logger::GetInstance().Get("Plugin"); -+log4cplus::Logger g_smcLogger; -diff --git a/src/plugin/tune/system/network/smc_tune/smc_common.h b/src/plugin/tune/system/network/smc_tune/smc_common.h -index 9ef2f0c..b670b00 100644 ---- a/src/plugin/tune/system/network/smc_tune/smc_common.h -+++ b/src/plugin/tune/system/network/smc_tune/smc_common.h -@@ -15,7 +15,8 @@ - #define PF_SMC 43 - - #include --#include "oeaware/logger.h" -+#include -+#include - - - constexpr int SMC_MAX_EID_LEN = 32; /* Max length of eid */ -diff --git a/src/plugin/tune/system/network/smc_tune/smc_tune.cpp b/src/plugin/tune/system/network/smc_tune/smc_tune.cpp -index b9d2614..6ef92ff 100644 ---- a/src/plugin/tune/system/network/smc_tune/smc_tune.cpp -+++ b/src/plugin/tune/system/network/smc_tune/smc_tune.cpp -@@ -48,6 +48,7 @@ void SmcTune::UpdateData(const DataList &dataList) - - oeaware::Result SmcTune::Enable(const std::string ¶m) - { -+ g_smcLogger = logger; - (void)param; - auto ret = ReadConfig(SMC_CONFIG_PATH); - if (ret.code != OK) { -diff --git a/src/plugin_mgr/config.cpp b/src/plugin_mgr/config.cpp -index 4553c93..721ad3c 100644 ---- a/src/plugin_mgr/config.cpp -+++ b/src/plugin_mgr/config.cpp -@@ -12,6 +12,7 @@ - #include "config.h" - #include - #include -+#include "logger.h" - #include "oeaware/default_path.h" - - namespace oeaware { -diff --git a/src/plugin_mgr/event/event_handler.h b/src/plugin_mgr/event/event_handler.h -index fa636fd..db05706 100644 ---- a/src/plugin_mgr/event/event_handler.h -+++ b/src/plugin_mgr/event/event_handler.h -@@ -13,7 +13,7 @@ - #define PLUGIN_MGR_EVENT_EVENT_HANDLER_H - #include "event.h" - #include "memory_store.h" --#include "oeaware/logger.h" -+#include "logger.h" - #include "error_code.h" - - namespace oeaware { -diff --git a/src/plugin_mgr/instance_run_handler.h b/src/plugin_mgr/instance_run_handler.h -index 9b144cd..a3d3ae1 100644 ---- a/src/plugin_mgr/instance_run_handler.h -+++ b/src/plugin_mgr/instance_run_handler.h -@@ -13,8 +13,8 @@ - #define PLUGIN_MGR_INSTANCE_RUN_HANDLER_H - #include - #include -+#include "logger.h" - #include "event.h" --#include "oeaware/logger.h" - #include "memory_store.h" - #include "data_register.h" - #include "oeaware/instance_run_message.h" -diff --git a/src/common/logger.cpp b/src/plugin_mgr/logger.cpp -similarity index 96% -rename from src/common/logger.cpp -rename to src/plugin_mgr/logger.cpp -index 0165283..d560107 100644 ---- a/src/common/logger.cpp -+++ b/src/plugin_mgr/logger.cpp -@@ -9,7 +9,7 @@ - * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - ******************************************************************************/ --#include "oeaware/logger.h" -+#include "logger.h" - #include - #include - #include -@@ -32,6 +32,9 @@ log4cplus::SharedAppenderPtr Logger::GenerateAppender(log4cplus::Appender *appen - - void Logger::Register(const std::string &name) - { -+ if (loggers.find(name) != loggers.end()) { -+ return; // already registered -+ } - auto logger = log4cplus::Logger::getInstance(name); - logger.setLogLevel(logLevel); - logger.addAppender(GenerateAppender(new log4cplus::ConsoleAppender())); -diff --git a/include/oeaware/logger.h b/src/plugin_mgr/logger.h -similarity index 70% -rename from include/oeaware/logger.h -rename to src/plugin_mgr/logger.h -index 5dd4f12..34a4ebf 100644 ---- a/include/oeaware/logger.h -+++ b/src/plugin_mgr/logger.h -@@ -18,11 +18,17 @@ - #include - - namespace oeaware { --#define INFO(logger, fmt) LOG4CPLUS_INFO(logger, fmt) --#define DEBUG(logger, fmt) LOG4CPLUS_DEBUG(logger, fmt) --#define WARN(logger, fmt) LOG4CPLUS_WARN(logger, fmt) --#define ERROR(logger, fmt) LOG4CPLUS_ERROR(logger, fmt) --#define FATAL(logger, fmt) LOG4CPLUS_FATAL(logger, fmt) -+ -+using OeLogLevel = enum { -+ OE_TRACE_LEVEL = 0, -+ OE_DEBUG_LEVEL, -+ OE_INFO_LEVEL, -+ OE_WARN_LEVEL , -+ OE_ERROR_LEVEL, -+ OE_FATAL_LEVEL, -+ OE_MAX_LOG_LEVELS -+}; -+ - class Logger { - public: - Logger(const Logger&) = delete; -@@ -36,8 +42,26 @@ public: - void Register(const std::string &name); - log4cplus::Logger Get(const std::string &name) - { -+ if (loggers.count(name) == 0) { -+ Register(name); -+ } - return loggers[name]; - } -+ -+ bool ChangeAllLogLevel(const int level) -+ { -+ int len = sizeof(LOG_LEVELS) / sizeof(LOG_LEVELS[0]); -+ if (level < 0 || level >= len) { -+ return false; -+ } -+ int log4Level = LOG_LEVELS[level]; -+ for (auto &it : loggers) { -+ it.second.setLogLevel(log4Level); -+ } -+ logLevel = log4Level; -+ return true; -+ } -+ - private: - Logger() noexcept - { -@@ -49,7 +73,7 @@ private: - std::unordered_map loggers; - std::string logPath; - int logLevel; -- const int LOG_LEVELS[6] = {log4cplus::TRACE_LOG_LEVEL, log4cplus::DEBUG_LOG_LEVEL, log4cplus::INFO_LOG_LEVEL, -+ const int LOG_LEVELS[OE_MAX_LOG_LEVELS] = {log4cplus::TRACE_LOG_LEVEL, log4cplus::DEBUG_LOG_LEVEL, log4cplus::INFO_LOG_LEVEL, - log4cplus::WARN_LOG_LEVEL, log4cplus::ERROR_LOG_LEVEL, log4cplus::FATAL_LOG_LEVEL}; - }; - std::string LogText(const std::string &text); -diff --git a/src/plugin_mgr/message_manager.h b/src/plugin_mgr/message_manager.h -index ab692e8..17ddc85 100644 ---- a/src/plugin_mgr/message_manager.h -+++ b/src/plugin_mgr/message_manager.h -@@ -16,7 +16,7 @@ - #include - #include - #include --#include "oeaware/logger.h" -+#include "logger.h" - #include "config.h" - #include "event.h" - #include "domain_socket.h" -diff --git a/src/plugin_mgr/plugin.cpp b/src/plugin_mgr/plugin.cpp -index bb91d67..bde27c4 100644 ---- a/src/plugin_mgr/plugin.cpp -+++ b/src/plugin_mgr/plugin.cpp -@@ -10,6 +10,7 @@ - * See the Mulan PSL v2 for more details. - ******************************************************************************/ - #include "plugin.h" -+#include "logger.h" - - namespace oeaware { - const std::string Instance::pluginEnabled = "running"; -@@ -34,7 +35,7 @@ void Plugin::SaveInstance(std::vector> &interfaceList - std::shared_ptr instance = std::make_shared(); - std::string instanceName = interface->GetName(); - interface->SetRecvQueue(recvQueue); -- interface->SetLogger(Logger::GetInstance().Get("Plugin")); -+ interface->SetLogger(Logger::GetInstance().Get(interface->GetName())); - instance->interface = interface; - for (auto &topic : interface->GetSupportTopics()) { - instance->supportTopics[topic.topicName] = topic; -diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 5d75ffd..8e3fc37 100644 ---- a/tests/CMakeLists.txt -+++ b/tests/CMakeLists.txt -@@ -13,7 +13,7 @@ add_executable(serialize_test - ) - - add_executable(logger_test -- ${SRC_DIR}/common/logger.cpp -+ ${SRC_DIR}/plugin_mgr/logger.cpp - logger_test.cpp - ) - -@@ -25,7 +25,7 @@ add_executable(pmu_count_test - pmu_count_test.cpp - ) - --add_executable(utils_test -+add_executable(utils_test - utils_test.cpp - ) - -@@ -53,6 +53,10 @@ target_include_directories(table_test PUBLIC - ${SRC_DIR}/client/analysis - ) - -+target_include_directories(logger_test PUBLIC -+ ${SRC_DIR}/plugin_mgr -+) -+ - target_link_libraries(serialize_test PRIVATE common GTest::gtest_main) - target_link_libraries(logger_test PRIVATE GTest::gtest_main log4cplus bpf) - target_link_libraries(safe_queue_test PRIVATE GTest::gtest_main) -diff --git a/tests/logger_test.cpp b/tests/logger_test.cpp -index 107bc1b..4827a20 100644 ---- a/tests/logger_test.cpp -+++ b/tests/logger_test.cpp -@@ -10,15 +10,49 @@ - * See the Mulan PSL v2 for more details. - ******************************************************************************/ - #include --#include "oeaware/logger.h" -+#include "logger.h" -+#include "oeaware/interface.h" -+bool LoggerTestLevelOutHelp(int level) -+{ -+ auto logger = oeaware::Logger::GetInstance().Get("LoggerTestLevelOut"); -+ if (!oeaware::Logger::GetInstance().ChangeAllLogLevel(level)) { -+ std::cout << "Change log level to " << level << " failed" << std::endl; -+ return false; -+ } -+ -+ TRACE(logger, "Trace log output at level " << level); -+ DEBUG(logger, "Debug log output at level " << level); -+ INFO(logger, "Info log output at level " << level); -+ WARN(logger, "Warn log output at level " << level); -+ ERROR(logger, "Error log output at level " << level); -+ FATAL(logger, "Fatal log output at level " << level); -+ return true; -+} - --TEST(Serialize, Logger) -+TEST(LoggerTestLevelOut, Logger) - { -- oeaware::Logger::GetInstance().Init("./", 1); -- oeaware::Logger::GetInstance().Register("test1"); -- auto logger = oeaware::Logger::GetInstance().Get("test1"); -- DEBUG(logger, "Debug world"); -- INFO(logger, "Hello world"); -- WARN(logger, "wrang world"); -- ERROR(logger, "Error world"); -+ oeaware::Logger::GetInstance().Init("./", oeaware::OE_TRACE_LEVEL); -+ oeaware::Logger::GetInstance().Register("LoggerTestLevelOut"); -+ bool ret = true; -+ std::cout << "LoggerTestLevelOut oeaware::OE_TRACE_LEVEL" << std::endl; -+ ret = LoggerTestLevelOutHelp(oeaware::OE_TRACE_LEVEL); -+ EXPECT_EQ(ret, true); -+ std::cout << "LoggerTestLevelOut oeaware::OE_DEBUG_LEVEL" << std::endl; -+ ret = LoggerTestLevelOutHelp(oeaware::OE_DEBUG_LEVEL); -+ EXPECT_EQ(ret, true); -+ std::cout << "LoggerTestLevelOut oeaware::OE_INFO_LEVEL" << std::endl; -+ ret = LoggerTestLevelOutHelp(oeaware::OE_INFO_LEVEL); -+ EXPECT_EQ(ret, true); -+ std::cout << "LoggerTestLevelOut oeaware::OE_WARN_LEVEL" << std::endl; -+ ret = LoggerTestLevelOutHelp(oeaware::OE_WARN_LEVEL); -+ EXPECT_EQ(ret, true); -+ std::cout << "LoggerTestLevelOut oeaware::OE_ERROR_LEVEL" << std::endl; -+ ret = LoggerTestLevelOutHelp(oeaware::OE_ERROR_LEVEL); -+ EXPECT_EQ(ret, true); -+ std::cout << "LoggerTestLevelOut oeaware::OE_FATAL_LEVEL" << std::endl; -+ ret = LoggerTestLevelOutHelp(oeaware::OE_FATAL_LEVEL); -+ EXPECT_EQ(ret, true); -+ std::cout << "LoggerTestLevelOut oeaware::OE_MAX_LOG_LEVELS" << std::endl; -+ ret = LoggerTestLevelOutHelp(oeaware::OE_MAX_LOG_LEVELS); -+ EXPECT_EQ(ret, false); - } --- -2.43.0 - diff --git a/0005-smc-d-analysis-fix-inconsistency-in-the-display-of-z.patch b/0005-smc-d-analysis-fix-inconsistency-in-the-display-of-z.patch deleted file mode 100644 index 3a6017cc8968b194fe7a687ba115bbbe858bb816..0000000000000000000000000000000000000000 --- a/0005-smc-d-analysis-fix-inconsistency-in-the-display-of-z.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a799a99e3b8554f691871e8f562e33f946f4ea68 Mon Sep 17 00:00:00 2001 -From: ye yiyang <850219375@qq.com> -Date: Wed, 23 Jul 2025 09:36:46 +0800 -Subject: [PATCH] smc-d analysis fix inconsistency in the display of zero state - ---- - src/plugin/scenario/analysis/smc_d_scenario/smc_d_analysis.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/plugin/scenario/analysis/smc_d_scenario/smc_d_analysis.cpp b/src/plugin/scenario/analysis/smc_d_scenario/smc_d_analysis.cpp -index 8c5c2b9..e68203e 100644 ---- a/src/plugin/scenario/analysis/smc_d_scenario/smc_d_analysis.cpp -+++ b/src/plugin/scenario/analysis/smc_d_scenario/smc_d_analysis.cpp -@@ -208,7 +208,7 @@ void *SmcDAnalysis::GetResult() - conclusion = conclusionNoSupport; - } else if (isSilence) { - metrics.emplace_back(std::vector{ -- smcDTcpChangeRate, "0%", "low" -+ smcDTcpChangeRate, "0%", isSmcDUsable ? "low" : "high" - }); - metrics.emplace_back(std::vector{ - loNetFlow, std::to_string(netFlow)+"(MB/s)", isHighFlow ? "high" : "low" --- -2.43.0 - diff --git a/oeAware-manager-v2.0.6.tar.gz b/oeAware-manager-v2.0.6.tar.gz deleted file mode 100644 index b8ec8dd1e7bd27d426885a1895ade433cd7e967f..0000000000000000000000000000000000000000 Binary files a/oeAware-manager-v2.0.6.tar.gz and /dev/null differ diff --git a/oeAware-manager-v2.1.0.tar.gz b/oeAware-manager-v2.1.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..0d9038a8ab492c7dfccbadc65b60cc499a98ec9d Binary files /dev/null and b/oeAware-manager-v2.1.0.tar.gz differ diff --git a/oeAware-manager.spec b/oeAware-manager.spec index a3d6b26b0952dad68a397403f9f30a9c8dfaaadd..5766a76139ec53b84d3febbd8f28daed76371ccd 100644 --- a/oeAware-manager.spec +++ b/oeAware-manager.spec @@ -1,15 +1,10 @@ Name: oeAware-manager -Version: v2.0.6 -Release: 3 +Version: v2.1.0 +Release: 1 Summary: OeAware is a framework for implementing low-load collection, sensing, and tuning on openEuler. License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} Source0: %{name}-%{version}.tar.gz -Patch1: 0001-add-realtime-compile-macro.patch -Patch2: 0002-adapt-dynamicsmt-analysis-if-smt-is-not-enable.patch -Patch3: 0003-fix-code-check.patch -Patch4: 0004-add-trace-log-and-change-level-intf-and-delete-logge.patch -Patch5: 0005-smc-d-analysis-fix-inconsistency-in-the-display-of-z.patch BuildRequires: cmake make gcc-c++ BuildRequires: boost-devel @@ -111,6 +106,12 @@ fi %attr(0644, root, root) %{_includedir}/oeaware/data/*.h %changelog +* Mon Aug 11 2025 LHesperus -v2.1.0-1 +- remove the logger.h interface and add TRACE interface, increase safe_queue wait time to 5s +- support reload log-level online +- adapt analysis on riscv +- add load base sched instance + * Wed Jul 23 2025 yeyiyang -v2.0.6-3 - add adapt dynamicsmt analysis if smt is not enable - fix code check