156 lines
5.6 KiB
Diff
156 lines
5.6 KiB
Diff
From 5906dfe108fcd6ecee57c6ed508f19e59b99b81a Mon Sep 17 00:00:00 2001
|
|
From: fly_1997 <flylove7@outlook.com>
|
|
Date: Tue, 4 Mar 2025 14:00:27 +0800
|
|
Subject: [PATCH 1/3] add analysis tlb miss parameter
|
|
|
|
---
|
|
src/client/analysis/analysis_cli.cpp | 2 +-
|
|
src/client/analysis/analysis_report.cpp | 5 ++++-
|
|
src/client/analysis/analysis_report.h | 3 ++-
|
|
src/client/analysis/config.cpp | 9 ++++++++-
|
|
src/client/analysis/config.h | 14 ++++++++++++++
|
|
5 files changed, 29 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/client/analysis/analysis_cli.cpp b/src/client/analysis/analysis_cli.cpp
|
|
index 7917517..47736a6 100644
|
|
--- a/src/client/analysis/analysis_cli.cpp
|
|
+++ b/src/client/analysis/analysis_cli.cpp
|
|
@@ -64,7 +64,7 @@ static void PrintProgressBar(const std::string &head, float progress, int barWid
|
|
void AnalysisCli::Run()
|
|
{
|
|
auto &analysisReport = oeaware::AnalysisReport::GetInstance();
|
|
- analysisReport.Init(std::vector<std::string>{MEMORY_ANALYSIS});
|
|
+ analysisReport.Init(std::vector<std::string>{MEMORY_ANALYSIS}, config);
|
|
sleep(analysisTime);
|
|
analysisReport.AnalyzeResult();
|
|
analysisReport.Print();
|
|
diff --git a/src/client/analysis/analysis_report.cpp b/src/client/analysis/analysis_report.cpp
|
|
index 9e1ada8..801a81e 100644
|
|
--- a/src/client/analysis/analysis_report.cpp
|
|
+++ b/src/client/analysis/analysis_report.cpp
|
|
@@ -13,6 +13,7 @@
|
|
#include <iostream>
|
|
#include <securec.h>
|
|
#include "oe_client.h"
|
|
+#include "config.h"
|
|
#include "data_register.h"
|
|
|
|
namespace oeaware {
|
|
@@ -39,7 +40,7 @@ void AnalysisReport::UpdateTlbMiss(const TlbMiss &tempTlbMiss)
|
|
tlbMissAnalysis.Add(tempTlbMiss);
|
|
}
|
|
|
|
-void AnalysisReport::Init(const std::vector<std::string> &topics)
|
|
+void AnalysisReport::Init(const std::vector<std::string> &topics, const Config &config)
|
|
{
|
|
for (auto &topic : topics) {
|
|
char *name = new char[topic.size() + 1];
|
|
@@ -48,6 +49,8 @@ void AnalysisReport::Init(const std::vector<std::string> &topics)
|
|
OeSubscribe(&cTopic, CallBack);
|
|
delete []name;
|
|
}
|
|
+ tlbMissAnalysis.threshold1 = config.GetL1MissThreshold();
|
|
+ tlbMissAnalysis.threshold2 = config.GetL2MissThreshold();
|
|
analysisTemplate.suggestions.Init(DEFAULT_ROW, "suggestion");
|
|
analysisTemplate.suggestions.SetColumnWidth(DEFAULT_SUGGESTION_WIDTH);
|
|
analysisTemplate.suggestions.AddRow({"suggestion", "operation", "result"});
|
|
diff --git a/src/client/analysis/analysis_report.h b/src/client/analysis/analysis_report.h
|
|
index d342131..984c4e6 100644
|
|
--- a/src/client/analysis/analysis_report.h
|
|
+++ b/src/client/analysis/analysis_report.h
|
|
@@ -13,6 +13,7 @@
|
|
#define CLIENT_ANALYSIS_REPORT_H
|
|
#include "table.h"
|
|
#include "oeaware/data/analysis_data.h"
|
|
+#include "config.h"
|
|
|
|
namespace oeaware {
|
|
const int DEFAULT_ROW = 3;
|
|
@@ -43,7 +44,7 @@ public:
|
|
}
|
|
AnalysisReport(const AnalysisReport &) = delete;
|
|
AnalysisReport &operator=(const AnalysisReport &) = delete;
|
|
- void Init(const std::vector<std::string> &topics);
|
|
+ void Init(const std::vector<std::string> &topics, const Config &config);
|
|
void Print();
|
|
void SetAnalysisTemplate(const AnalysisTemplate &data);
|
|
void UpdateMemoryData(const MemoryAnalysisData &memoryAnalysisData);
|
|
diff --git a/src/client/analysis/config.cpp b/src/client/analysis/config.cpp
|
|
index 32a3bf4..03298f2 100644
|
|
--- a/src/client/analysis/config.cpp
|
|
+++ b/src/client/analysis/config.cpp
|
|
@@ -22,6 +22,8 @@ void Config::PrintHelp()
|
|
usage += " -r|--realtime show real time report.\n";
|
|
usage += " -v|--verbose show verbose information.\n";
|
|
usage += " -h|--help show this help message.\n";
|
|
+ usage += " --l1-miss-threshold set l1 tlbmiss threshold.\n";
|
|
+ usage += " --l2-miss-threshold set l2 tlbmiss threshold.\n";
|
|
std::cout << usage;
|
|
}
|
|
|
|
@@ -58,13 +60,18 @@ bool Config::Init(int argc, char **argv)
|
|
case 'v':
|
|
showVerbose = true;
|
|
break;
|
|
+ case L1_MISS_THRESHOLD:
|
|
+ l1MissThreshold = atoi(optarg);
|
|
+ break;
|
|
+ case L2_MISS_THRESHOLD:
|
|
+ l2MissThreshold = atoi(optarg);
|
|
+ break;
|
|
case 'h':
|
|
default:
|
|
PrintHelp();
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
if (optind != argc) {
|
|
PrintHelp();
|
|
return false;
|
|
diff --git a/src/client/analysis/config.h b/src/client/analysis/config.h
|
|
index e1a0ff2..2a89f90 100644
|
|
--- a/src/client/analysis/config.h
|
|
+++ b/src/client/analysis/config.h
|
|
@@ -18,6 +18,8 @@
|
|
#include <getopt.h>
|
|
#include <iostream>
|
|
|
|
+const int L1_MISS_THRESHOLD = 200;
|
|
+const int L2_MISS_THRESHOLD = 201;
|
|
|
|
class Config {
|
|
public:
|
|
@@ -34,16 +36,28 @@ public:
|
|
{
|
|
return showVerbose;
|
|
}
|
|
+ int GetL1MissThreshold() const
|
|
+ {
|
|
+ return l1MissThreshold;
|
|
+ }
|
|
+ int GetL2MissThreshold() const
|
|
+ {
|
|
+ return l2MissThreshold;
|
|
+ }
|
|
private:
|
|
const int minAnalyzeTime = 1;
|
|
const int maxAnalyzeTime = 100;
|
|
int analysisTime = 30; // default 30s
|
|
+ int l1MissThreshold = 5;
|
|
+ int l2MissThreshold = 10;
|
|
const std::string shortOptions = "t:hrv";
|
|
const std::vector<option> longOptions = {
|
|
{"help", no_argument, nullptr, 'h'},
|
|
{"realtime", no_argument, nullptr, 'r'},
|
|
{"time", required_argument, nullptr, 't'},
|
|
{"verbose", no_argument, nullptr, 'v'},
|
|
+ {"l1-miss-threshold", required_argument, nullptr, L1_MISS_THRESHOLD},
|
|
+ {"l2-miss-threshold", required_argument, nullptr, L2_MISS_THRESHOLD},
|
|
{nullptr, 0, nullptr, 0}
|
|
};
|
|
bool isShowRealTimeReport = false;
|
|
--
|
|
2.33.0
|
|
|