!119 [sync] PR-117: add analysis args check
From: @openeuler-sync-bot Reviewed-by: @ksana123 Signed-off-by: @ksana123
This commit is contained in:
commit
ceb8dc9433
86
0009-add-analysis-args-check.patch
Normal file
86
0009-add-analysis-args-check.patch
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
From be52353bd6781be33ddcd5a665f94c2b3a01908c Mon Sep 17 00:00:00 2001
|
||||||
|
From: fly_1997 <flylove7@outlook.com>
|
||||||
|
Date: Mon, 24 Mar 2025 23:15:11 +0800
|
||||||
|
Subject: [PATCH] add analysis args check
|
||||||
|
|
||||||
|
---
|
||||||
|
src/client/analysis/analysis_cli.cpp | 1 +
|
||||||
|
src/client/analysis/analysis_report.cpp | 3 +++
|
||||||
|
src/client/analysis/config.cpp | 18 ++++++++++++++++++
|
||||||
|
3 files changed, 22 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/client/analysis/analysis_cli.cpp b/src/client/analysis/analysis_cli.cpp
|
||||||
|
index 47736a6..6497da6 100644
|
||||||
|
--- a/src/client/analysis/analysis_cli.cpp
|
||||||
|
+++ b/src/client/analysis/analysis_cli.cpp
|
||||||
|
@@ -65,6 +65,7 @@ void AnalysisCli::Run()
|
||||||
|
{
|
||||||
|
auto &analysisReport = oeaware::AnalysisReport::GetInstance();
|
||||||
|
analysisReport.Init(std::vector<std::string>{MEMORY_ANALYSIS}, config);
|
||||||
|
+ std::cout << "Analyzing... Please wait " << analysisTime << "s.\n";
|
||||||
|
sleep(analysisTime);
|
||||||
|
analysisReport.AnalyzeResult();
|
||||||
|
analysisReport.Print();
|
||||||
|
diff --git a/src/client/analysis/analysis_report.cpp b/src/client/analysis/analysis_report.cpp
|
||||||
|
index 801a81e..3f5c92e 100644
|
||||||
|
--- a/src/client/analysis/analysis_report.cpp
|
||||||
|
+++ b/src/client/analysis/analysis_report.cpp
|
||||||
|
@@ -67,6 +67,9 @@ void AnalysisReport::MemoryAnalyze()
|
||||||
|
memoryTable.SetColumnWidth(DEFAULT_SUGGESTION_WIDTH);
|
||||||
|
const TlbMiss &tlbMiss = tlbMissAnalysis.tlbMiss;
|
||||||
|
int cnt = tlbMissAnalysis.cnt;
|
||||||
|
+ if (cnt == 0) {
|
||||||
|
+ cnt = 1;
|
||||||
|
+ }
|
||||||
|
double l1dTlbMiss = tlbMiss.l1dTlbMiss * PERCENT / cnt;
|
||||||
|
double l1iTlbMiss = tlbMiss.l1iTlbMiss * PERCENT / cnt;
|
||||||
|
double l2dTlbMiss = tlbMiss.l2dTlbMiss * PERCENT / cnt;
|
||||||
|
diff --git a/src/client/analysis/config.cpp b/src/client/analysis/config.cpp
|
||||||
|
index 5760b91..ca4407f 100644
|
||||||
|
--- a/src/client/analysis/config.cpp
|
||||||
|
+++ b/src/client/analysis/config.cpp
|
||||||
|
@@ -11,6 +11,8 @@
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
+#include <regex>
|
||||||
|
+
|
||||||
|
void Config::PrintHelp()
|
||||||
|
{
|
||||||
|
std::string usage = "";
|
||||||
|
@@ -40,6 +42,12 @@ bool Config::ParseTime(const char *arg)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool IsNum(const std::string &s)
|
||||||
|
+{
|
||||||
|
+ std::regex num(R"(^[+]?\d+(\.\d+)?$)");
|
||||||
|
+ return std::regex_match(s, num);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
bool Config::Init(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (argv == nullptr) {
|
||||||
|
@@ -61,9 +69,19 @@ bool Config::Init(int argc, char **argv)
|
||||||
|
showVerbose = true;
|
||||||
|
break;
|
||||||
|
case L1_MISS_THRESHOLD:
|
||||||
|
+ if (!IsNum(optarg)) {
|
||||||
|
+ std::cerr << "Error: Invalid l1-miss-threshold: '" << optarg << "'\n";
|
||||||
|
+ PrintHelp();
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
l1MissThreshold = atof(optarg);
|
||||||
|
break;
|
||||||
|
case L2_MISS_THRESHOLD:
|
||||||
|
+ if (!IsNum(optarg)) {
|
||||||
|
+ std::cerr << "Error: Invalid l2-miss-threshold: '" << optarg << "'\n";
|
||||||
|
+ PrintHelp();
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
l2MissThreshold = atof(optarg);
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: oeAware-manager
|
Name: oeAware-manager
|
||||||
Version: v2.0.2
|
Version: v2.0.2
|
||||||
Release: 6
|
Release: 7
|
||||||
Summary: OeAware is a framework for implementing low-load collection, sensing, and tuning on openEuler.
|
Summary: OeAware is a framework for implementing low-load collection, sensing, and tuning on openEuler.
|
||||||
License: MulanPSL2
|
License: MulanPSL2
|
||||||
URL: https://gitee.com/openeuler/%{name}
|
URL: https://gitee.com/openeuler/%{name}
|
||||||
@ -13,6 +13,7 @@ Patch5: 0005-add-parameter-detection.patch
|
|||||||
Patch6: 0006-fix-issues.patch
|
Patch6: 0006-fix-issues.patch
|
||||||
Patch7: 0007-fix-return-value-type-of-the-function.patch
|
Patch7: 0007-fix-return-value-type-of-the-function.patch
|
||||||
Patch8: 0008-smc_tune-add-insmod-to-the-whilelist.patch
|
Patch8: 0008-smc_tune-add-insmod-to-the-whilelist.patch
|
||||||
|
Patch9: 0009-add-analysis-args-check.patch
|
||||||
|
|
||||||
BuildRequires: cmake make gcc-c++
|
BuildRequires: cmake make gcc-c++
|
||||||
BuildRequires: boost-devel
|
BuildRequires: boost-devel
|
||||||
@ -113,6 +114,9 @@ fi
|
|||||||
%attr(0644, root, root) %{_includedir}/oeaware/data/*.h
|
%attr(0644, root, root) %{_includedir}/oeaware/data/*.h
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 25 2025 fly_1997 <flylove7@outlook.com> -v2.0.2-7
|
||||||
|
- add analysis args check
|
||||||
|
|
||||||
* Mon Mar 24 2025 fly_1997 <flylove7@outlook.com> -v2.0.2-6
|
* Mon Mar 24 2025 fly_1997 <flylove7@outlook.com> -v2.0.2-6
|
||||||
- fix smc insmod error
|
- fix smc insmod error
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user