!18 [sync] PR-14: refactor interface
From: @openeuler-sync-bot Reviewed-by: @ksana123 Signed-off-by: @ksana123
This commit is contained in:
commit
cc5daa15d4
@ -1,91 +0,0 @@
|
||||
From b3e9285865d1f62f63dff6587e2de32d0741eec9 Mon Sep 17 00:00:00 2001
|
||||
From: fly_1997 <flylove7@outlook.com>
|
||||
Date: Wed, 15 May 2024 10:49:16 +0800
|
||||
Subject: [PATCH] fix warning message
|
||||
|
||||
---
|
||||
thread_aware/CMakeLists.txt | 1 +
|
||||
thread_aware/thread_aware.cpp | 13 +++++++------
|
||||
thread_aware/thread_aware.h | 2 +-
|
||||
3 files changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/thread_aware/CMakeLists.txt b/thread_aware/CMakeLists.txt
|
||||
index 6436942..2c4f756 100644
|
||||
--- a/thread_aware/CMakeLists.txt
|
||||
+++ b/thread_aware/CMakeLists.txt
|
||||
@@ -1,5 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
project(thread_aware)
|
||||
+add_compile_options(-O2 -fPIC -Wall -Wextra)
|
||||
include_directories(../include)
|
||||
add_library(thread_scenario SHARED
|
||||
thread_aware.cpp
|
||||
diff --git a/thread_aware/thread_aware.cpp b/thread_aware/thread_aware.cpp
|
||||
index 8e0264b..2bdb744 100644
|
||||
--- a/thread_aware/thread_aware.cpp
|
||||
+++ b/thread_aware/thread_aware.cpp
|
||||
@@ -13,12 +13,12 @@
|
||||
#include "scenario.h"
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
+#include <cstring>
|
||||
|
||||
-char *THREAD_SCENARIO = "thread_scenario";
|
||||
-char *THREAD_DEPS = "thread_collector";
|
||||
+char name[] = "thread_scenario";
|
||||
+char dep[] = "thread_collector";
|
||||
const std::string CONFIG_PATH = "/usr/lib64/oeAware-plugin/scenario/thread_scenario.ini";
|
||||
const int CYCLE_SIZE = 100;
|
||||
-
|
||||
static std::vector<ThreadInfo> thread_info(THREAD_NUM);
|
||||
static DataHeader data_header;
|
||||
static DataBuf data_buf;
|
||||
@@ -41,7 +41,7 @@ char* get_version() {
|
||||
}
|
||||
|
||||
char* get_name() {
|
||||
- return THREAD_SCENARIO;
|
||||
+ return name;
|
||||
}
|
||||
|
||||
char* get_description() {
|
||||
@@ -49,7 +49,7 @@ char* get_description() {
|
||||
}
|
||||
|
||||
char* get_dep() {
|
||||
- return THREAD_DEPS;
|
||||
+ return dep;
|
||||
}
|
||||
|
||||
int get_cycle() {
|
||||
@@ -67,6 +67,7 @@ void disable() {
|
||||
}
|
||||
|
||||
void aware(void *info[], int len) {
|
||||
+ if (len != 1) return;
|
||||
data_header.index++;
|
||||
data_header.count++;
|
||||
int index = data_header.count % data_header.buf_len;
|
||||
@@ -76,7 +77,7 @@ void aware(void *info[], int len) {
|
||||
ThreadInfo *data = (ThreadInfo*)buf.data;
|
||||
int cnt = 0;
|
||||
for (int i = 0; i < buf.len; ++i) {
|
||||
- for (int j = 0; j < key_list.size(); ++j) {
|
||||
+ for (size_t j = 0; j < key_list.size(); ++j) {
|
||||
if (data[i].name == key_list[j] && cnt < THREAD_NUM) {
|
||||
thread_info[cnt].name = data[i].name;
|
||||
thread_info[cnt].tid = data[i].tid;
|
||||
diff --git a/thread_aware/thread_aware.h b/thread_aware/thread_aware.h
|
||||
index 80e3f31..97e5d79 100644
|
||||
--- a/thread_aware/thread_aware.h
|
||||
+++ b/thread_aware/thread_aware.h
|
||||
@@ -37,4 +37,4 @@ struct DataHeader {
|
||||
int buf_len;
|
||||
};
|
||||
|
||||
-#endif // !THREAD_AWARE_H
|
||||
\ No newline at end of file
|
||||
+#endif // !THREAD_AWARE_H
|
||||
--
|
||||
2.33.0
|
||||
|
||||
Binary file not shown.
BIN
oeAware-scenario-v1.0.2.tar.gz
Normal file
BIN
oeAware-scenario-v1.0.2.tar.gz
Normal file
Binary file not shown.
@ -1,11 +1,10 @@
|
||||
Name: oeAware-scenario
|
||||
Version: v1.0.1
|
||||
Release: 2
|
||||
Version: v1.0.2
|
||||
Release: 1
|
||||
Summary: %{name} provides low-overhead scenario awareness
|
||||
License: MulanPSL2
|
||||
URL: https://gitee.com/openeuler/%{name}
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Patch1: 0001-fix-warning-message.patch
|
||||
|
||||
BuildRequires: cmake make gcc-c++
|
||||
|
||||
@ -23,15 +22,18 @@ cmake .. -DCMAKE_BUILD_TYPE=Debug
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{_libdir}/oeAware-plugin/scenario
|
||||
install -D -m 0740 ./thread_aware/build/*.so %{buildroot}%{_libdir}/oeAware-plugin/scenario
|
||||
install -D -m 0640 ./thread_aware/thread_scenario.ini %{buildroot}%{_libdir}/oeAware-plugin/scenario
|
||||
mkdir -p %{buildroot}%{_libdir}/oeAware-plugin/
|
||||
install -D -m 0740 ./thread_aware/build/*.so %{buildroot}%{_libdir}/oeAware-plugin/
|
||||
install -D -m 0640 ./thread_aware/thread_scenario.conf %{buildroot}%{_libdir}/oeAware-plugin/
|
||||
|
||||
%files
|
||||
%attr(0640, root, root) %{_libdir}/oeAware-plugin/scenario/*.ini
|
||||
%attr(0440, root, root) %{_libdir}/oeAware-plugin/scenario/*.so
|
||||
%attr(0640, root, root) %{_libdir}/oeAware-plugin/thread_scenario.conf
|
||||
%attr(0440, root, root) %{_libdir}/oeAware-plugin/libthread_scenario.so
|
||||
|
||||
%changelog
|
||||
* Fri May 31 2024 zhoukaiqi <zhoukaiqi@huawei.com> - v1.0.2-1
|
||||
- refactor interface
|
||||
|
||||
* Wed May 15 2024 fly_1997 <flylove7@outlook.com> -v1.0.1-2
|
||||
- fix warning message
|
||||
|
||||
@ -40,5 +42,3 @@ install -D -m 0640 ./thread_aware/thread_scenario.ini %{buildroot}%{_libdir}/oeA
|
||||
|
||||
* Thu Apr 18 2024 fly_1997 <flylove7@outlook.com> -v1.0.0-1
|
||||
- Package init
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user