update version to v1.0.1

(cherry picked from commit ef05973334b04ea825a316f6b1a277f544dbc4fa)
This commit is contained in:
fly_1997 2024-05-11 10:23:01 +08:00 committed by openeuler-sync-bot
parent 72432d1196
commit 23804a0961
6 changed files with 5 additions and 438 deletions

View File

@ -1,54 +0,0 @@
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

View File

@ -1,317 +0,0 @@
From 7d951169995a182610b00cb2a3ef2318605e097b Mon Sep 17 00:00:00 2001
From: zhoukaiqi <zhoukaiqi@huawei.com>
Date: Tue, 30 Apr 2024 15:53:59 +0800
Subject: [PATCH] remove pmu.h and pcerrc.h
---
pmu/CMakeLists.txt | 1 -
pmu/include/pcerrc.h | 88 --------------------
pmu/include/pmu.h | 189 -------------------------------------------
3 files changed, 278 deletions(-)
delete mode 100644 pmu/include/pcerrc.h
delete mode 100644 pmu/include/pmu.h
diff --git a/pmu/CMakeLists.txt b/pmu/CMakeLists.txt
index c16bb51..b84a77e 100644
--- a/pmu/CMakeLists.txt
+++ b/pmu/CMakeLists.txt
@@ -30,7 +30,6 @@ add_library(pmu SHARED ${pmu_src})
include_directories(pmu PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../include
- ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/plugin
${LIB_KPERF_INCPATH}
)
diff --git a/pmu/include/pcerrc.h b/pmu/include/pcerrc.h
deleted file mode 100644
index bcdf187..0000000
--- a/pmu/include/pcerrc.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/******************************************************************************
- * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
- * gala-gopher licensed under the Mulan PSL v2.
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
- * You may obtain a copy of Mulan PSL v2 at:
- * http://license.coscl.org.cn/MulanPSL2
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
- * PURPOSE.
- * See the Mulan PSL v2 for more details.
- * Author: Mr.Gan
- * Create: 2024-04-03
- * Description: global error codes of perf.so
- ******************************************************************************/
-#ifndef PCERRC_H
-#define PCERRC_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-// default code
-#define SUCCESS 0
-#define COMMON_ERR_NOMEM 1 // not enough memory
-
-// libsym 100-1000
-#define LIBSYM_ERR_BASE 100
-#define LIBSYM_ERR_KALLSYMS_INVALID LIBSYM_ERR_BASE
-#define LIBSYM_ERR_DWARF_FORMAT_FAILED 101
-#define LIBSYM_ERR_ELFIN_FOMAT_FAILED 102
-#define LIBSYM_ERR_OPEN_FILE_FAILED 103
-#define LIBSYM_ERR_NOT_FIND_PID 104
-#define LIBSYM_ERR_MAP_ADDR_MODULE_FAILED 105
-#define LIBSYM_ERR_MAP_KERNAL_ADDR_FAILED 106
-#define LIBSYM_ERR_PARAM_PID_INVALID 107
-#define LIBSYM_ERR_STRCPY_OPERATE_FAILED 108
-#define LIBSYM_ERR_SNPRINF_OPERATE_FAILED 109
-#define LIBSYM_ERR_MAP_CODE_KERNEL_NOT_SUPPORT 110
-#define LIBSYM_ERR_MAP_CODE_FIND_ELF_FAILED 111
-#define LIBSYM_ERR_CMD_OPERATE_FAILED 112
-#define LIBSYM_ERR_FILE_NOT_RGE 113
-#define LIBSYM_ERR_START_SMALLER_END 114
-#define LIBSYM_ERR_STOUL_OPERATE_FAILED 115
-#define LIBSYM_ERR_FILE_INVALID 116
-// libperf 1000-3000
-#define LIBPERF_ERR_NO_AVAIL_PD 1000
-#define LIBPERF_ERR_CHIP_TYPE_INVALID 1001
-#define LIBPERF_ERR_FAIL_LISTEN_PROC 1002
-#define LIBPERF_ERR_INVALID_CPULIST 1003
-#define LIBPERF_ERR_INVALID_PIDLIST 1004
-#define LIBPERF_ERR_INVALID_EVTLIST 1005
-#define LIBPERF_ERR_INVALID_PD 1006
-#define LIBPERF_ERR_INVALID_EVENT 1007
-#define LIBPERF_ERR_SPE_UNAVAIL 1008
-#define LIBPERF_ERR_FAIL_GET_CPU 1009
-#define LIBPERF_ERR_FAIL_GET_PROC 1010
-#define LIBPERF_ERR_NO_PERMISSION 1011
-#define LIBPERF_ERR_DEVICE_BUSY 1012
-#define LIBPERF_ERR_DEVICE_INVAL 1013
-#define LIBPERF_ERR_FAIL_MMAP 1014
-#define LIBPERF_ERR_FAIL_RESOLVE_MODULE 1015
-#define LIBPERF_ERR_KERNEL_NOT_SUPPORT 1016
-#define LIBPERF_ERR_INVALID_METRIC_TYPE 1017
-#define LIBPERF_ERR_INVALID_PID 1018
-#define LIBPERF_ERR_INVALID_TASK_TYPE 1019
-#define LIBPERF_ERR_INVALID_TIME 1020
-#define LIBPERF_ERR_NO_PROC 1021
-#define LIBPERF_ERR_TOO_MANY_FD 1022
-#define LIBPERF_ERR_RAISE_FD 1023
-#define LIBPERF_ERR_INVALID_PMU_DATA 1024
-#define LIBPERF_ERR_FAILED_PMU_ENABLE 1025
-#define LIBPERF_ERR_FAILED_PMU_DISABLE 1026
-#define LIBPERF_ERR_FAILED_PMU_RESET 1027
-#define LIBPERF_ERR_NOT_OPENED 1028
-
-#define UNKNOWN_ERROR 9999
-
-/**
-* @brief Obtaining error codes
-*/
-int Perrorno();
-
-/**
-* @brief Obtaining Error Information
-*/
-const char* Perror();
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/pmu/include/pmu.h b/pmu/include/pmu.h
deleted file mode 100644
index f8a79ba..0000000
--- a/pmu/include/pmu.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/******************************************************************************
- * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
- * gala-gopher licensed under the Mulan PSL v2.
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
- * You may obtain a copy of Mulan PSL v2 at:
- * http://license.coscl.org.cn/MulanPSL2
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
- * PURPOSE.
- * See the Mulan PSL v2 for more details.
- * Author: Mr.Gan
- * Create: 2024-04-03
- * Description: declarations and definitions of interfaces and data structures exposed by perf.so
- ******************************************************************************/
-#ifndef PMU_DATA_STRUCT_H
-#define PMU_DATA_STRUCT_H
-#include <unistd.h>
-#include <stdint.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-#pragma GCC visibility push(default)
-
-enum PmuTaskType {
- COUNTING = 0, // pmu counting task
- SAMPLING = 1, // pmu sampling task
- SPE_SAMPLING = 2, // spe sampling task
- MAX_TASK_TYPE
-};
-
-enum AggregateType {
- PER_SYSTEM,
- PER_CORE,
- PER_NUMA,
- PER_SOCKET,
- PER_THREAD,
-};
-
-enum SpeFilter {
- SPE_FILTER_NONE = 0,
- TS_ENABLE = 1UL << 0, // enable timestamping with value of generic timer
- PA_ENABLE = 1UL << 1, // collect physical address (as well as VA) of loads/stores
- PCT_ENABLE = 1UL << 2, // collect physical timestamp instead of virtual timestamp
- JITTER = 1UL << 16, // use jitter to avoid resonance when sampling
- BRANCH_FILTER = 1UL << 32, // collect branches only
- LOAD_FILTER = 1UL << 33, // collect loads only
- STORE_FILTER = 1UL << 34, // collect stores only
- SPE_DATA_ALL = TS_ENABLE | PA_ENABLE | PCT_ENABLE | JITTER | BRANCH_FILTER | LOAD_FILTER | STORE_FILTER
-};
-
-enum SpeEventFilter {
- SPE_EVENT_NONE = 0,
- SPE_EVENT_RETIRED = 0x2, // instruction retired
- SPE_EVENT_L1DMISS = 0x8, // L1D refill
- SPE_EVENT_TLB_WALK = 0x20, // TLB refill
- SPE_EVENT_MISPREDICTED = 0x80, // mispredict
-};
-
-struct PmuAttr {
- char** evtList; // event list
- unsigned numEvt; // length of event list
- int* pidList; // pid list
- unsigned numPid; // length of pid list
- int* cpuList; // cpu id list
- unsigned numCpu; // length of cpu id list
-
- union {
- unsigned period; // sample period
- unsigned freq; // sample frequency
- };
- unsigned useFreq : 1;
- unsigned excludeUser : 1; // don't count user
- unsigned excludeKernel : 1; // don't count kernel
-
- // SPE related fields.
- enum SpeFilter dataFilter; // spe data filter
- enum SpeEventFilter evFilter; // spe event filter
- unsigned long minLatency; // collect only samples with latency or higher
-};
-
-struct PmuDataExt {
- unsigned long pa; // physical address
- unsigned long va; // virtual address
- unsigned long event; // event id
-};
-
-struct PmuData {
- struct Stack* stack; // call stack
- const char *evt; // event name
- int64_t ts; // time stamp
- pid_t pid; // process id
- int tid; // thread id
- unsigned cpu; // cpu id
- struct CpuTopology *cpuTopo; // cpu topology
- const char *comm; // process command
- int period; // number of Samples
- union {
- uint64_t count; // event count. Only available for Counting.
- struct PmuDataExt *ext; // extension. Only available for Spe.
- };
-};
-
-/**
- * @brief
- * Initialize the collection target.
- * @param collectType collection typr.
- * @param evtList array of event IDs
- * @param numEvt length of evtList.
- * @param pidList list of PIDs to be collected. Information about subprocess and subthreads of PIDs is collected. If
- * the value is NULL, all process/threads are collected
- * @param numPid length of pidList.
- * @param cpuList CPU ID list. If the value is NULL, all CPUs are collected.
- * @param numCpu cpuList length.
- * @return int
- */
-int PmuOpen(enum PmuTaskType collectType, struct PmuAttr *attr);
-
-/**
- * @brief
- * Enable counting or sampling of task <pd>.
- * On error, -1 is returned.
- */
-int PmuEnable(int pd);
-
-/**
- * @brief
- * Disable counting or sampling of task <pd>.
- * On error, -1 is returned.
- */
-int PmuDisable(int pd);
-
-/**
- * @brief
- * Collect <milliseconds> milliseconds. If <milliseconds> is equal to - 1 and the PID list is not empty, the collection
- * is performed until all processes are complete.
- * @param milliseconds
- * @return int
- */
-int PmuCollect(int pd, int milliseconds);
-
-/**
- * @brief
- * Similar to <PmuCollect>, and <PmuCollectV> accepts multiple pds.
- * @param milliseconds
- * @return int
- */
-int PmuCollectV(int *pd, unsigned len, int milliseconds);
-
-/**
- * @brief stop a sampling task in asynchronous mode
- * @param pd pmu descriptor.
- */
-void PmuStop(int pd);
-
-/**
- * @brief
- * Collect data. If the value is NULL and the error code is 0, no data is available in the current collection time. If
- * the value is NULL and the error code is not 0, an error occurs in the collection process and data cannot be read.
- * @param struct PmuData*
- */
-int PmuRead(int pd, struct PmuData** pmuData);
-
-/**
- * @brief
- * Append data list <fromData> to another data list <*toData>.
- * The pointer of data list <*toData> will be refreshed after this function is called.
- * On success, length of <*toData> is returned.
- * On error, -1 is returned.
- * @param fromData data list which will be copied to <*toData>
- * @param toData pointer to target data list. If data list <*toData> is NULL, a new list will be created.
- */
-int PmuAppendData(struct PmuData *fromData, struct PmuData **toData);
-
-/**
- * @brief Close all the file descriptor opened during collecting process
- */
-void PmuClose(int pd);
-
-/**
- * @brief Free PmuData pointer.
- * @param pmuData
- */
-void PmuDataFree(struct PmuData* pmuData);
-
-#pragma GCC visibility pop
-#ifdef __cplusplus
-}
-#endif
-#endif
--
2.27.0

View File

@ -1,62 +0,0 @@
From f1df31f0dfcd96791430ffc4d4f85499db35f8b2 Mon Sep 17 00:00:00 2001
From: zhoukaiqi <zhoukaiqi@huawei.com>
Date: Wed, 8 May 2024 16:02:55 +0800
Subject: [PATCH] replace enable and disable API in reflash_ring_buf
---
pmu/plugin/plugin_counting.c | 4 ++--
pmu/plugin/plugin_sampling.c | 4 ++--
pmu/plugin/plugin_uncore.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/pmu/plugin/plugin_counting.c b/pmu/plugin/plugin_counting.c
index 363b892..b18b8be 100644
--- a/pmu/plugin/plugin_counting.c
+++ b/pmu/plugin/plugin_counting.c
@@ -99,9 +99,9 @@ void counting_reflash_ring_buf()
return;
}
- counting_disable();
+ PmuDisable(counting_pd);
len = PmuRead(counting_pd, &counting_data);
- counting_enable();
+ PmuEnable(counting_pd);
fill_buf(data_header, counting_data, len);
}
diff --git a/pmu/plugin/plugin_sampling.c b/pmu/plugin/plugin_sampling.c
index 7adc21c..132de07 100644
--- a/pmu/plugin/plugin_sampling.c
+++ b/pmu/plugin/plugin_sampling.c
@@ -101,9 +101,9 @@ void sampling_reflash_ring_buf()
return;
}
- sampling_disable();
+ PmuDisable(sampling_pd);
len = PmuRead(sampling_pd, &sampling_data);
- sampling_enable();
+ PmuEnable(sampling_pd);
fill_buf(data_header, sampling_data, len);
}
diff --git a/pmu/plugin/plugin_uncore.c b/pmu/plugin/plugin_uncore.c
index 2042d16..070f1a7 100644
--- a/pmu/plugin/plugin_uncore.c
+++ b/pmu/plugin/plugin_uncore.c
@@ -124,9 +124,9 @@ void uncore_reflash_ring_buf()
return;
}
- uncore_disable();
+ PmuDisable(uncore_pd);
len = PmuRead(uncore_pd, &uncore_data);
- uncore_enable();
+ PmuEnable(uncore_pd);
fill_buf(data_header, uncore_data, len);
}
--
2.27.0

Binary file not shown.

Binary file not shown.

View File

@ -1,13 +1,10 @@
Name: oeAware-collector
Version: v1.0.0
Release: 5
Version: v1.0.1
Release: 1
Summary: %{name} provides low-overhead metrics collection capabilities, including microarchitecture, system, and kernel information.
License: MulanPSL2
URL: https://gitee.com/openeuler/%{name}
Source0: %{name}-%{version}.tar.gz
Patch1: 0001-fix-log-while-not-supporting-pmu-uncore.patch
Patch2: 0002-remove-pmu.h-and-pcerrc.h.patch
Patch3: 0003-replace-enable-and-disable-API-in-reflash_ring_buf.patch
%global libkperf_name libkperf
%global libkperf_tagver v1.0.2
@ -82,6 +79,9 @@ install -b -m740 ./thread_collector/build/libthread_collector.so ${RPM_BUIL
%attr(0440, root, root) %{_libdir}/oeAware-plugin/collector/*.so
%changelog
* Sat May 11 2024 fly_1997 <flylove7@outlook.com> -v1.0.1-1
- update version to v1.0.1
* Wed May 8 2024 zhoukaiqi <zhoukaiqi@huawei.com> - v1.0.0-5
- replace enable and disable API in reflash_ring_buf