diff --git a/0001-remove-old-code.patch b/0001-remove-old-code.patch new file mode 100644 index 0000000..09e933e --- /dev/null +++ b/0001-remove-old-code.patch @@ -0,0 +1,2098 @@ +From a7893161786a6195cbb97d82969a49e02e56adac Mon Sep 17 00:00:00 2001 +From: fly_1997 +Date: Wed, 20 Nov 2024 09:39:14 +0800 +Subject: [PATCH 1/5] remove old code + +--- + src/plugin/collect/pmu/plugin/plugin.c | 136 ------------ + src/plugin/collect/pmu/plugin/plugin_comm.c | 84 -------- + src/plugin/collect/pmu/plugin/plugin_comm.h | 39 ---- + .../collect/pmu/plugin/plugin_counting.c | 174 --------------- + .../collect/pmu/plugin/plugin_counting.h | 35 --- + .../plugin/plugin_napi_gro_receive_entry.c | 174 --------------- + .../plugin/plugin_napi_gro_receive_entry.h | 35 --- + .../collect/pmu/plugin/plugin_netif_rx.c | 173 --------------- + .../collect/pmu/plugin/plugin_netif_rx.h | 35 --- + .../collect/pmu/plugin/plugin_sampling.c | 176 ---------------- + .../collect/pmu/plugin/plugin_sampling.h | 35 --- + .../plugin/plugin_skb_copy_datagram_iovec.c | 174 --------------- + .../plugin/plugin_skb_copy_datagram_iovec.h | 35 --- + src/plugin/collect/pmu/plugin/plugin_spe.c | 174 --------------- + src/plugin/collect/pmu/plugin/plugin_spe.h | 35 --- + src/plugin/collect/pmu/plugin/plugin_uncore.c | 199 ------------------ + src/plugin/collect/pmu/plugin/plugin_uncore.h | 35 --- + src/plugin/collect/pmu/plugin/pmu_uncore.c | 142 ------------- + src/plugin/collect/pmu/plugin/pmu_uncore.h | 45 ---- + 19 files changed, 1935 deletions(-) + delete mode 100644 src/plugin/collect/pmu/plugin/plugin.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_comm.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_comm.h + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_counting.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_counting.h + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_napi_gro_receive_entry.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_napi_gro_receive_entry.h + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_netif_rx.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_netif_rx.h + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_sampling.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_sampling.h + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_skb_copy_datagram_iovec.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_skb_copy_datagram_iovec.h + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_spe.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_spe.h + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_uncore.c + delete mode 100644 src/plugin/collect/pmu/plugin/plugin_uncore.h + delete mode 100644 src/plugin/collect/pmu/plugin/pmu_uncore.c + delete mode 100644 src/plugin/collect/pmu/plugin/pmu_uncore.h + +diff --git a/src/plugin/collect/pmu/plugin/plugin.c b/src/plugin/collect/pmu/plugin/plugin.c +deleted file mode 100644 +index 0fc7dda..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin.c ++++ /dev/null +@@ -1,136 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include "interface.h" +-#include "plugin_sampling.h" +-#include "plugin_counting.h" +-#include "plugin_uncore.h" +-#include "plugin_spe.h" +-#include "plugin_netif_rx.h" +-#include "plugin_napi_gro_receive_entry.h" +-#include "plugin_skb_copy_datagram_iovec.h" +- +-#define INS_COLLECTOR_MAX 10 +- +-static struct Interface ins_collector[INS_COLLECTOR_MAX] = {0}; +- +-struct Interface sampling_collector = { +- .get_version = sampling_get_version, +- .get_description = sampling_get_description, +- .get_priority = sampling_get_priority, +- .get_type = sampling_get_type, +- .get_dep = sampling_get_dep, +- .get_name = sampling_get_name, +- .get_period = sampling_get_period, +- .enable = sampling_enable, +- .disable = sampling_disable, +- .get_ring_buf = sampling_get_ring_buf, +- .run = sampling_run, +-}; +- +-struct Interface counting_collector = { +- .get_version = counting_get_version, +- .get_description = counting_get_description, +- .get_priority = counting_get_priority, +- .get_type = counting_get_type, +- .get_dep = counting_get_dep, +- .get_name = counting_get_name, +- .get_period = counting_get_period, +- .enable = counting_enable, +- .disable = counting_disable, +- .get_ring_buf = counting_get_ring_buf, +- .run = counting_run, +-}; +- +-struct Interface uncore_collector = { +- .get_version = uncore_get_version, +- .get_description = uncore_get_description, +- .get_priority = uncore_get_priority, +- .get_type = uncore_get_type, +- .get_dep = uncore_get_dep, +- .get_name = uncore_get_name, +- .get_period = uncore_get_period, +- .enable = uncore_enable, +- .disable = uncore_disable, +- .get_ring_buf = uncore_get_ring_buf, +- .run = uncore_run, +-}; +- +-struct Interface spe_collector = { +- .get_version = spe_get_version, +- .get_description = spe_get_description, +- .get_priority = spe_get_priority, +- .get_type = spe_get_type, +- .get_dep = spe_get_dep, +- .get_name = spe_get_name, +- .get_period = spe_get_period, +- .enable = spe_enable, +- .disable = spe_disable, +- .get_ring_buf = spe_get_ring_buf, +- .run = spe_run, +-}; +- +-struct Interface netif_rx_collector = { +- .get_version = netif_rx_get_version, +- .get_description = netif_rx_get_description, +- .get_priority = netif_rx_get_priority, +- .get_type = netif_rx_get_type, +- .get_dep = netif_rx_get_dep, +- .get_name = netif_rx_get_name, +- .get_period = netif_rx_get_period, +- .enable = netif_rx_enable, +- .disable = netif_rx_disable, +- .get_ring_buf = netif_rx_get_ring_buf, +- .run = netif_rx_run, +-}; +- +-struct Interface g_napiGroRecEntryCollector = { +- .get_version = NapiGroRecEntryGetVer, +- .get_description = NapiGroRecEntryGetDes, +- .get_priority = NapiGroRecEntryGetPriority, +- .get_type = NapiGroRecEntryGetType, +- .get_dep = NapiGroRecEntryGetDep, +- .get_name = NapiGroRecEntryGetName, +- .get_period = NapiGroRecEntryGetPeriod, +- .enable = NapiGroRecEntryEnable, +- .disable = NapiGroRecEntryDisable, +- .get_ring_buf = NapiGroRecEntryGetBuf, +- .run = NapiGroRecEntryRun, +-}; +- +-struct Interface g_skbCopyDatagramIovecCollector = { +- .get_version = SkbCopyDatagramIovecGetVer, +- .get_description = SkbCopyDatagramIovecGetDes, +- .get_priority = SkbCopyDatagramIovecGetPriority, +- .get_type = SkbCopyDatagramIovecGetType, +- .get_dep = SkbCopyDatagramIovecGetDep, +- .get_name = SkbCopyDatagramIovecGetName, +- .get_period = SkbCopyDatagramIovecGetPeriod, +- .enable = SkbCopyDatagramIovecEnable, +- .disable = SkbCopyDatagramIovecDisable, +- .get_ring_buf = SkbCopyDatagramIovecGetBuf, +- .run = SkbCopyDatagramIovecRun, +-}; +-int get_instance(struct Interface **interface) +-{ +- int ins_count = 0; +- +- ins_collector[ins_count++] = sampling_collector; +- ins_collector[ins_count++] = counting_collector; +- ins_collector[ins_count++] = uncore_collector; +- ins_collector[ins_count++] = spe_collector; +- ins_collector[ins_count++] = netif_rx_collector; +- ins_collector[ins_count++] = g_napiGroRecEntryCollector; +- ins_collector[ins_count++] = g_skbCopyDatagramIovecCollector; +- *interface = &ins_collector[0]; +- +- return ins_count; +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_comm.c b/src/plugin/collect/pmu/plugin/plugin_comm.c +deleted file mode 100644 +index 401ef1f..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_comm.c ++++ /dev/null +@@ -1,84 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include "pmu.h" +-#include "interface.h" +- +-struct DataRingBuf *init_buf(int buf_len, const char *instance_name) +-{ +- struct DataRingBuf *data_ringbuf; +- +- data_ringbuf = (struct DataRingBuf *)malloc(sizeof(struct DataRingBuf)); +- if (!data_ringbuf) { +- printf("malloc data_ringbuf failed\n"); +- return NULL; +- } +- +- (void)memset_s(data_ringbuf, sizeof(struct DataRingBuf), 0, sizeof(struct DataRingBuf)); +- +- data_ringbuf->instance_name = instance_name; +- data_ringbuf->index = -1; +- +- data_ringbuf->buf = (struct DataBuf *)malloc(sizeof(struct DataBuf) * buf_len); +- if (!data_ringbuf->buf) { +- printf("malloc data_ringbuf buf failed\n"); +- free(data_ringbuf); +- data_ringbuf = NULL; +- return NULL; +- } +- +- (void)memset_s(data_ringbuf->buf, sizeof(struct DataBuf) * buf_len, 0, sizeof(struct DataBuf) * buf_len); +- data_ringbuf->buf_len = buf_len; +- +- return data_ringbuf; +-} +- +-void free_buf(struct DataRingBuf *data_ringbuf) +-{ +- if (!data_ringbuf) { +- return; +- } +- +- if (!data_ringbuf->buf) { +- goto out; +- } +- +- free(data_ringbuf->buf); +- data_ringbuf->buf = NULL; +- +-out: +- free(data_ringbuf); +- data_ringbuf = NULL; +-} +- +-void fill_buf(struct DataRingBuf *data_ringbuf, struct PmuData *pmu_data, int len) +-{ +- struct DataBuf *buf; +- int index; +- +- index = (data_ringbuf->index + 1) % data_ringbuf->buf_len; +- data_ringbuf->index = index; +- data_ringbuf->count++; +- buf = &data_ringbuf->buf[index]; +- +- if (buf->data != NULL) { +- PmuDataFree(buf->data); +- buf->data = NULL; +- buf->len = 0; +- } +- +- buf->len = len; +- buf->data = (void *)pmu_data; +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_comm.h b/src/plugin/collect/pmu/plugin/plugin_comm.h +deleted file mode 100644 +index 1bdc239..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_comm.h ++++ /dev/null +@@ -1,39 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PLUGIN_COMM_H__ +-#define __PLUGIN_COMM_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-#define CYCLES_COUNTING_BUF_SIZE 10 +-#define CYCLES_SAMPLING_BUF_SIZE 10 +-#define UNCORE_BUF_SIZE 10 +-#define SPE_BUF_SIZE 10 +-#define NETIF_RX_BUF_SIZE 10 +-#define NAPI_GRO_REC_ENTRY_BUF_SIZE 10 +-#define SKB_COPY_DATAGRAM_IOVEC_BUF_SIZE 10 +-#define NET_RECEIVE_TRACE_SAMPLE_PERIOD 10 +- +-struct DataRingBuf; +-struct PmuData; +- +-struct DataRingBuf *init_buf(int buf_len, const char *instance_name); +-void free_buf(struct DataRingBuf *data_ringbuf); +-void fill_buf(struct DataRingBuf *data_ringbuf, struct PmuData *pmu_data, int len); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/src/plugin/collect/pmu/plugin/plugin_counting.c b/src/plugin/collect/pmu/plugin/plugin_counting.c +deleted file mode 100644 +index 39573fa..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_counting.c ++++ /dev/null +@@ -1,174 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include "pmu.h" +-#include "pcerrc.h" +-#include "interface.h" +-#include "pmu_plugin.h" +-#include "plugin_comm.h" +-#include "plugin_counting.h" +- +-static bool counting_is_open = false; +-static int counting_pd = -1; +-static struct DataRingBuf *counting_buf = NULL; +-struct PmuData *counting_data = NULL; +- +-static int counting_init() +-{ +- counting_buf = init_buf(CYCLES_COUNTING_BUF_SIZE, PMU_CYCLES_COUNTING); +- if (!counting_buf) { +- return -1; +- } +- +- return 0; +-} +- +-static void counting_fini() +-{ +- if (!counting_buf) { +- return; +- } +- +- free_buf(counting_buf); +- counting_buf = NULL; +-} +- +-static int counting_open() +-{ +- struct PmuAttr attr; +- char *evtList[1]; +- int pd; +- +- (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr)); +- +- evtList[0] = "cycles"; +- +- attr.evtList = evtList; +- attr.numEvt = 1; +- attr.pidList = NULL; +- attr.numPid = 0; +- attr.cpuList = NULL; +- attr.numCpu = 0; +- +- pd = PmuOpen(COUNTING, &attr); +- if (pd == -1) { +- printf("%s\n", Perror()); +- return pd; +- } +- +- counting_is_open = true; +- return pd; +-} +- +-static void counting_close() +-{ +- PmuClose(counting_pd); +- counting_pd = -1; +- counting_is_open = false; +-} +- +-bool counting_enable() +-{ +- if (!counting_buf) { +- int ret = counting_init(); +- if (ret != 0) { +- goto err; +- } +- } +- +- if (!counting_is_open) { +- counting_pd = counting_open(); +- if (counting_pd == -1) { +- counting_fini(); +- goto err; +- } +- } +- +- return PmuEnable(counting_pd) == 0; +- +-err: +- return false; +-} +- +-void counting_disable() +-{ +- PmuDisable(counting_pd); +- counting_close(); +- counting_fini(); +-} +- +-const struct DataRingBuf *counting_get_ring_buf() +-{ +- return (const struct DataRingBuf *)counting_buf; +-} +- +-static void counting_reflash_ring_buf() +-{ +- struct DataRingBuf *data_ringbuf; +- int len; +- +- data_ringbuf = (struct DataRingBuf *)counting_buf; +- if (!data_ringbuf) { +- printf("counting_buf has no malloc\n"); +- return; +- } +- +- PmuDisable(counting_pd); +- len = PmuRead(counting_pd, &counting_data); +- PmuEnable(counting_pd); +- +- fill_buf(data_ringbuf, counting_data, len); +-} +- +-void counting_run(const struct Param *param) +-{ +- (void)param; +- counting_reflash_ring_buf(); +-} +- +-const char *counting_get_version() +-{ +- return NULL; +-} +- +-const char *counting_get_name() +-{ +- return PMU_CYCLES_COUNTING; +-} +- +-const char *counting_get_description() +-{ +- return NULL; +-} +- +-const char *counting_get_dep() +-{ +- return NULL; +-} +- +-int counting_get_priority() +-{ +- return 0; +-} +- +-int counting_get_type() +-{ +- return -1; +-} +- +-int counting_get_period() +-{ +- return 100; +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_counting.h b/src/plugin/collect/pmu/plugin/plugin_counting.h +deleted file mode 100644 +index c414458..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_counting.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PLUGIN_COUNTING_H__ +-#define __PLUGIN_COUNTING_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-const char *counting_get_version(); +-const char *counting_get_name(); +-const char *counting_get_description(); +-const char *counting_get_dep(); +-int counting_get_priority(); +-int counting_get_type(); +-int counting_get_period(); +-bool counting_enable(); +-void counting_disable(); +-const struct DataRingBuf *counting_get_ring_buf(); +-void counting_run(const struct Param *param); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/src/plugin/collect/pmu/plugin/plugin_napi_gro_receive_entry.c b/src/plugin/collect/pmu/plugin/plugin_napi_gro_receive_entry.c +deleted file mode 100644 +index 6c7b9a3..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_napi_gro_receive_entry.c ++++ /dev/null +@@ -1,174 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include "pmu.h" +-#include "pcerrc.h" +-#include "interface.h" +-#include "pmu_plugin.h" +-#include "plugin_comm.h" +-#include "plugin_sampling.h" +- +-static bool g_samplingIsOpen = false; +-static int g_samplingPd = -1; +-static struct DataRingBuf *g_samplingBuf = NULL; +-struct PmuData *g_pmuData = NULL; +- +-static int Init() +-{ +- g_samplingBuf = init_buf(NAPI_GRO_REC_ENTRY_BUF_SIZE, PMU_NAPI_GRO_REC_ENTRY); +- if (!g_samplingBuf) { +- return -1; +- } +- +- return 0; +-} +- +-static void Finish() +-{ +- if (!g_samplingBuf) { +- return; +- } +- +- free_buf(g_samplingBuf); +- g_samplingBuf = NULL; +-} +- +-static int Open() +-{ +- struct PmuAttr attr; +- char *evtList[1]; +- int pd; +- +- (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr)); +- +- evtList[0] = "net:napi_gro_receive_entry"; +- +- attr.evtList = evtList; +- attr.numEvt = 1; +- attr.pidList = NULL; +- attr.numPid = 0; +- attr.cpuList = NULL; +- attr.numCpu = 0; +- attr.period = NET_RECEIVE_TRACE_SAMPLE_PERIOD; +- +- pd = PmuOpen(SAMPLING, &attr); +- if (pd == -1) { +- printf("%s\n", Perror()); +- return pd; +- } +- +- g_samplingIsOpen = true; +- return pd; +-} +- +-static void Close() +-{ +- PmuClose(g_samplingPd); +- g_samplingPd = -1; +- g_samplingIsOpen = false; +-} +- +-bool NapiGroRecEntryEnable() +-{ +- if (!g_samplingBuf) { +- int ret = Init(); +- if (ret != 0) { +- goto err; +- } +- } +- +- if (!g_samplingIsOpen) { +- g_samplingPd = Open(); +- if (g_samplingPd == -1) { +- Finish(); +- goto err; +- } +- } +- +- return PmuEnable(g_samplingPd) == 0; +- +-err: +- return false; +-} +- +-void NapiGroRecEntryDisable() +-{ +- PmuDisable(g_samplingPd); +- Close(); +- Finish(); +-} +- +-const struct DataRingBuf *NapiGroRecEntryGetBuf() +-{ +- return (const struct DataRingBuf *)g_samplingBuf; +-} +- +-static void NapiGroRecEntryReflashBuf() +-{ +- struct DataRingBuf *dataRingBuf; +- int len; +- +- dataRingBuf = (struct DataRingBuf *)g_samplingBuf; +- if (!dataRingBuf) { +- printf("g_samplingBuf has not malloc\n"); +- return; +- } +- +- PmuDisable(g_samplingPd); +- len = PmuRead(g_samplingPd, &g_pmuData); +- PmuEnable(g_samplingPd); +- fill_buf(dataRingBuf, g_pmuData, len); +-} +- +-void NapiGroRecEntryRun(const struct Param *param) +-{ +- (void)param; +- NapiGroRecEntryReflashBuf(); +-} +- +-const char *NapiGroRecEntryGetVer() +-{ +- return NULL; +-} +- +-const char *NapiGroRecEntryGetName() +-{ +- return PMU_NAPI_GRO_REC_ENTRY; +-} +- +-const char *NapiGroRecEntryGetDes() +-{ +- return "event used to collect net queue info"; +-} +- +-const char *NapiGroRecEntryGetDep() +-{ +- return NULL; +-} +- +-int NapiGroRecEntryGetPriority() +-{ +- return 0; +-} +- +-int NapiGroRecEntryGetType() +-{ +- return -1; +-} +- +-int NapiGroRecEntryGetPeriod() +-{ +- return 100; // 100ms +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_napi_gro_receive_entry.h b/src/plugin/collect/pmu/plugin/plugin_napi_gro_receive_entry.h +deleted file mode 100644 +index 14469d9..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_napi_gro_receive_entry.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PMU_NAPI_GRO_RECEIVE_ENTRY_H__ +-#define __PMU_NAPI_GRO_RECEIVE_ENTRY_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-const char *NapiGroRecEntryGetVer(); +-const char *NapiGroRecEntryGetName(); +-const char *NapiGroRecEntryGetDes(); +-const char *NapiGroRecEntryGetDep(); +-int NapiGroRecEntryGetPriority(); +-int NapiGroRecEntryGetType(); +-int NapiGroRecEntryGetPeriod(); +-bool NapiGroRecEntryEnable(); +-void NapiGroRecEntryDisable(); +-const struct DataRingBuf *NapiGroRecEntryGetBuf(); +-void NapiGroRecEntryRun(const struct Param *param); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/src/plugin/collect/pmu/plugin/plugin_netif_rx.c b/src/plugin/collect/pmu/plugin/plugin_netif_rx.c +deleted file mode 100644 +index 78f52d2..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_netif_rx.c ++++ /dev/null +@@ -1,173 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include "pmu.h" +-#include "pcerrc.h" +-#include "interface.h" +-#include "pmu_plugin.h" +-#include "plugin_comm.h" +- +-static bool event_is_open = false; +-static int pmu_id = -1; +-static struct DataRingBuf *ring_buf = NULL; +-struct PmuData *pmu_data = NULL; +- +-static int init() +-{ +- ring_buf = init_buf(NETIF_RX_BUF_SIZE, PMU_NETIF_RX); +- if (!ring_buf) { +- return -1; +- } +- +- return 0; +-} +- +-static void finish() +-{ +- if (!ring_buf) { +- return; +- } +- +- free_buf(ring_buf); +- ring_buf = NULL; +-} +- +-static int open() +-{ +- struct PmuAttr attr; +- char *evtList[1]; +- int pd; +- +- (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr)); +- +- evtList[0] = "net:netif_rx"; +- +- attr.evtList = evtList; +- attr.numEvt = 1; +- attr.pidList = NULL; +- attr.numPid = 0; +- attr.cpuList = NULL; +- attr.numCpu = 0; +- +- pd = PmuOpen(COUNTING, &attr); +- if (pd == -1) { +- printf("%s\n", Perror()); +- return pd; +- } +- +- event_is_open = true; +- return pd; +-} +- +-static void netif_rx_close() +-{ +- PmuClose(pmu_id); +- pmu_id = -1; +- event_is_open = false; +-} +- +-bool netif_rx_enable() +-{ +- if (!ring_buf) { +- int ret = init(); +- if (ret != 0) { +- goto err; +- } +- } +- +- if (!event_is_open) { +- pmu_id = open(); +- if (pmu_id == -1) { +- finish(); +- goto err; +- } +- } +- +- return PmuEnable(pmu_id) == 0; +- +-err: +- return false; +-} +- +-void netif_rx_disable() +-{ +- PmuDisable(pmu_id); +- netif_rx_close(); +- finish(); +-} +- +-const struct DataRingBuf *netif_rx_get_ring_buf() +-{ +- return (const struct DataRingBuf *)ring_buf; +-} +- +-static void reflash_ring_buf() +-{ +- struct DataRingBuf *data_ringbuf; +- int len; +- +- data_ringbuf = (struct DataRingBuf *)ring_buf; +- if (!data_ringbuf) { +- printf("ring_buf has not malloc\n"); +- return; +- } +- +- PmuDisable(pmu_id); +- len = PmuRead(pmu_id, &pmu_data); +- PmuEnable(pmu_id); +- +- fill_buf(data_ringbuf, pmu_data, len); +-} +- +-void netif_rx_run(const struct Param *param) +-{ +- (void)param; +- reflash_ring_buf(); +-} +- +-const char *netif_rx_get_version() +-{ +- return NULL; +-} +- +-const char *netif_rx_get_name() +-{ +- return PMU_NETIF_RX; +-} +- +-const char *netif_rx_get_description() +-{ +- return NULL; +-} +- +-const char *netif_rx_get_dep() +-{ +- return NULL; +-} +- +-int netif_rx_get_priority() +-{ +- return 0; +-} +- +-int netif_rx_get_type() +-{ +- return -1; +-} +- +-int netif_rx_get_period() +-{ +- return 100; +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_netif_rx.h b/src/plugin/collect/pmu/plugin/plugin_netif_rx.h +deleted file mode 100644 +index 0c82936..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_netif_rx.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PLUGIN_NETIF_RX_H__ +-#define __PLUGIN_NETIF_RX_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-const char *netif_rx_get_version(); +-const char *netif_rx_get_name(); +-const char *netif_rx_get_description(); +-const char *netif_rx_get_dep(); +-int netif_rx_get_priority(); +-int netif_rx_get_type(); +-int netif_rx_get_period(); +-bool netif_rx_enable(); +-void netif_rx_disable(); +-const struct DataRingBuf *netif_rx_get_ring_buf(); +-void netif_rx_run(const struct Param *param); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/src/plugin/collect/pmu/plugin/plugin_sampling.c b/src/plugin/collect/pmu/plugin/plugin_sampling.c +deleted file mode 100644 +index 35e5dfb..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_sampling.c ++++ /dev/null +@@ -1,176 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include "pmu.h" +-#include "pcerrc.h" +-#include "interface.h" +-#include "pmu_plugin.h" +-#include "plugin_comm.h" +-#include "plugin_sampling.h" +- +-static bool sampling_is_open = false; +-static int sampling_pd = -1; +-static struct DataRingBuf *sampling_buf = NULL; +-struct PmuData *sampling_data = NULL; +- +-static int sampling_init() +-{ +- sampling_buf = init_buf(CYCLES_SAMPLING_BUF_SIZE, PMU_CYCLES_SAMPLING); +- if (!sampling_buf) { +- return -1; +- } +- +- return 0; +-} +- +-static void sampling_fini() +-{ +- if (!sampling_buf) { +- return; +- } +- +- free_buf(sampling_buf); +- sampling_buf = NULL; +-} +- +-static int sampling_open() +-{ +- struct PmuAttr attr; +- char *evtList[1]; +- int pd; +- +- (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr)); +- +- evtList[0] = "cycles"; +- +- attr.evtList = evtList; +- attr.numEvt = 1; +- attr.pidList = NULL; +- attr.numPid = 0; +- attr.cpuList = NULL; +- attr.numCpu = 0; +- attr.freq = 100; +- attr.useFreq = 1; +- +- pd = PmuOpen(SAMPLING, &attr); +- if (pd == -1) { +- printf("%s\n", Perror()); +- return pd; +- } +- +- sampling_is_open = true; +- return pd; +-} +- +-static void sampling_close() +-{ +- PmuClose(sampling_pd); +- sampling_pd = -1; +- sampling_is_open = false; +-} +- +-bool sampling_enable() +-{ +- if (!sampling_buf) { +- int ret = sampling_init(); +- if (ret != 0) { +- goto err; +- } +- } +- +- if (!sampling_is_open) { +- sampling_pd = sampling_open(); +- if (sampling_pd == -1) { +- sampling_fini(); +- goto err; +- } +- } +- +- return PmuEnable(sampling_pd) == 0; +- +-err: +- return false; +-} +- +-void sampling_disable() +-{ +- PmuDisable(sampling_pd); +- sampling_close(); +- sampling_fini(); +-} +- +-const struct DataRingBuf *sampling_get_ring_buf() +-{ +- return (const struct DataRingBuf *)sampling_buf; +-} +- +-static void sampling_reflash_ring_buf() +-{ +- struct DataRingBuf *data_ringbuf; +- int len; +- +- data_ringbuf = (struct DataRingBuf *)sampling_buf; +- if (!data_ringbuf) { +- printf("sampling_buf has not malloc\n"); +- return; +- } +- +- PmuDisable(sampling_pd); +- len = PmuRead(sampling_pd, &sampling_data); +- PmuEnable(sampling_pd); +- +- fill_buf(data_ringbuf, sampling_data, len); +-} +- +-void sampling_run(const struct Param *param) +-{ +- (void)param; +- sampling_reflash_ring_buf(); +-} +- +-const char *sampling_get_version() +-{ +- return NULL; +-} +- +-const char *sampling_get_name() +-{ +- return PMU_CYCLES_SAMPLING; +-} +- +-const char *sampling_get_description() +-{ +- return NULL; +-} +- +-const char *sampling_get_dep() +-{ +- return NULL; +-} +- +-int sampling_get_priority() +-{ +- return 0; +-} +- +-int sampling_get_type() +-{ +- return -1; +-} +- +-int sampling_get_period() +-{ +- return 100; +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_sampling.h b/src/plugin/collect/pmu/plugin/plugin_sampling.h +deleted file mode 100644 +index 066d74f..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_sampling.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PLUGIN_SAMPLING_H__ +-#define __PLUGIN_SAMPLING_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-const char *sampling_get_version(); +-const char *sampling_get_name(); +-const char *sampling_get_description(); +-const char *sampling_get_dep(); +-int sampling_get_priority(); +-int sampling_get_type(); +-int sampling_get_period(); +-bool sampling_enable(); +-void sampling_disable(); +-const struct DataRingBuf *sampling_get_ring_buf(); +-void sampling_run(const struct Param *param); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/src/plugin/collect/pmu/plugin/plugin_skb_copy_datagram_iovec.c b/src/plugin/collect/pmu/plugin/plugin_skb_copy_datagram_iovec.c +deleted file mode 100644 +index ae4abef..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_skb_copy_datagram_iovec.c ++++ /dev/null +@@ -1,174 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include "pmu.h" +-#include "pcerrc.h" +-#include "interface.h" +-#include "pmu_plugin.h" +-#include "plugin_comm.h" +-#include "plugin_sampling.h" +- +-static bool g_samplingIsOpen = false; +-static int g_samplingPd = -1; +-static struct DataRingBuf *g_samplingBuf = NULL; +-static struct PmuData *g_pmuData = NULL; +- +-static int Init() +-{ +- g_samplingBuf = init_buf(SKB_COPY_DATAGRAM_IOVEC_BUF_SIZE, PMU_SKB_COPY_DATEGRAM_IOVEC); +- if (!g_samplingBuf) { +- return -1; +- } +- +- return 0; +-} +- +-static void Finish() +-{ +- if (!g_samplingBuf) { +- return; +- } +- +- free_buf(g_samplingBuf); +- g_samplingBuf = NULL; +-} +- +-static int Open() +-{ +- struct PmuAttr attr; +- char *evtList[1]; +- int pd; +- +- (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr)); +- +- evtList[0] = "skb:skb_copy_datagram_iovec"; +- +- attr.evtList = evtList; +- attr.numEvt = 1; +- attr.pidList = NULL; +- attr.numPid = 0; +- attr.cpuList = NULL; +- attr.numCpu = 0; +- attr.period = NET_RECEIVE_TRACE_SAMPLE_PERIOD; +- +- pd = PmuOpen(SAMPLING, &attr); +- if (pd == -1) { +- printf("%s\n", Perror()); +- return pd; +- } +- +- g_samplingIsOpen = true; +- return pd; +-} +- +-static void Close() +-{ +- PmuClose(g_samplingPd); +- g_samplingPd = -1; +- g_samplingIsOpen = false; +-} +- +-bool SkbCopyDatagramIovecEnable() +-{ +- if (!g_samplingBuf) { +- int ret = Init(); +- if (ret != 0) { +- goto err; +- } +- } +- +- if (!g_samplingIsOpen) { +- g_samplingPd = Open(); +- if (g_samplingPd == -1) { +- Finish(); +- goto err; +- } +- } +- +- return PmuEnable(g_samplingPd) == 0; +- +-err: +- return false; +-} +- +-void SkbCopyDatagramIovecDisable() +-{ +- PmuDisable(g_samplingPd); +- Close(); +- Finish(); +-} +- +-const struct DataRingBuf *SkbCopyDatagramIovecGetBuf() +-{ +- return (const struct DataRingBuf *)g_samplingBuf; +-} +- +-static void SkbCopyDatagramIovecReflashBuf() +-{ +- struct DataRingBuf *dataRingBuf; +- int len; +- +- dataRingBuf = (struct DataRingBuf *)g_samplingBuf; +- if (!dataRingBuf) { +- printf("g_samplingBuf has not malloc\n"); +- return; +- } +- +- PmuDisable(g_samplingPd); +- len = PmuRead(g_samplingPd, &g_pmuData); +- PmuEnable(g_samplingPd); +- fill_buf(dataRingBuf, g_pmuData, len); +-} +- +-void SkbCopyDatagramIovecRun(const struct Param *param) +-{ +- (void)param; +- SkbCopyDatagramIovecReflashBuf(); +-} +- +-const char *SkbCopyDatagramIovecGetVer() +-{ +- return NULL; +-} +- +-const char *SkbCopyDatagramIovecGetName() +-{ +- return PMU_SKB_COPY_DATEGRAM_IOVEC; +-} +- +-const char *SkbCopyDatagramIovecGetDes() +-{ +- return "event used to collect recv skb addr info"; +-} +- +-const char *SkbCopyDatagramIovecGetDep() +-{ +- return NULL; +-} +- +-int SkbCopyDatagramIovecGetPriority() +-{ +- return 0; +-} +- +-int SkbCopyDatagramIovecGetType() +-{ +- return -1; +-} +- +-int SkbCopyDatagramIovecGetPeriod() +-{ +- return 100; // 100ms +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_skb_copy_datagram_iovec.h b/src/plugin/collect/pmu/plugin/plugin_skb_copy_datagram_iovec.h +deleted file mode 100644 +index 49c5202..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_skb_copy_datagram_iovec.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PLUGIN_SKB_COPY_DATAGRAM_IOVEC_H__ +-#define __PLUGIN_SKB_COPY_DATAGRAM_IOVEC_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-const char *SkbCopyDatagramIovecGetVer(); +-const char *SkbCopyDatagramIovecGetName(); +-const char *SkbCopyDatagramIovecGetDes(); +-const char *SkbCopyDatagramIovecGetDep(); +-int SkbCopyDatagramIovecGetPriority(); +-int SkbCopyDatagramIovecGetType(); +-int SkbCopyDatagramIovecGetPeriod(); +-bool SkbCopyDatagramIovecEnable(); +-void SkbCopyDatagramIovecDisable(); +-const struct DataRingBuf *SkbCopyDatagramIovecGetBuf(); +-void SkbCopyDatagramIovecRun(const struct Param *param); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/src/plugin/collect/pmu/plugin/plugin_spe.c b/src/plugin/collect/pmu/plugin/plugin_spe.c +deleted file mode 100644 +index 52c31c3..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_spe.c ++++ /dev/null +@@ -1,174 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include "pmu.h" +-#include "pcerrc.h" +-#include "interface.h" +-#include "pmu_plugin.h" +-#include "plugin_comm.h" +-#include "plugin_spe.h" +- +-static bool spe_is_open = false; +-static int spe_pd = -1; +-static struct DataRingBuf *spe_buf = NULL; +-struct PmuData *spe_data = NULL; +- +-static int spe_init() +-{ +- spe_buf = init_buf(SPE_BUF_SIZE, PMU_SPE); +- if (!spe_buf) { +- return -1; +- } +- +- return 0; +-} +- +-static void spe_fini() +-{ +- if (!spe_buf) { +- return; +- } +- +- free_buf(spe_buf); +- spe_buf = NULL; +-} +- +-static int spe_open() +-{ +- struct PmuAttr attr; +- int pd; +- +- (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr)); +- +- attr.evtList = NULL; +- attr.numEvt = 0; +- attr.pidList = NULL; +- attr.numPid = 0; +- attr.cpuList = NULL; +- attr.numCpu = 0; +- attr.period = 2048; +- attr.dataFilter = SPE_DATA_ALL; +- attr.evFilter = SPE_EVENT_RETIRED; +- attr.minLatency = 0x60; +- +- pd = PmuOpen(SPE_SAMPLING, &attr); +- if (pd == -1) { +- printf("%s\n", Perror()); +- return pd; +- } +- +- spe_is_open = true; +- return pd; +-} +- +-static void spe_close() +-{ +- PmuClose(spe_pd); +- spe_pd = -1; +- spe_is_open = false; +-} +- +-bool spe_enable() +-{ +- if (!spe_buf) { +- int ret = spe_init(); +- if (ret != 0) { +- goto err; +- } +- } +- +- if (!spe_is_open) { +- spe_pd = spe_open(); +- if (spe_pd == -1) { +- spe_fini(); +- goto err; +- } +- } +- +- return PmuEnable(spe_pd) == 0; +- +-err: +- return false; +-} +- +-void spe_disable() +-{ +- PmuDisable(spe_pd); +- spe_close(); +- spe_fini(); +-} +- +-const struct DataRingBuf *spe_get_ring_buf() +-{ +- return (const struct DataRingBuf *)spe_buf; +-} +- +-static void spe_reflash_ring_buf() +-{ +- struct DataRingBuf *data_ringbuf; +- int len; +- +- data_ringbuf = (struct DataRingBuf *)spe_buf; +- if (!data_ringbuf) { +- printf("spe_buf has not malloc\n"); +- return; +- } +- +- // while using PMU_SPE, PmuRead internally calls PmuEnable and PmuDisable +- len = PmuRead(spe_pd, &spe_data); +- +- fill_buf(data_ringbuf, spe_data, len); +-} +- +-void spe_run(const struct Param *param) +-{ +- (void)param; +- spe_reflash_ring_buf(); +-} +- +-const char *spe_get_version() +-{ +- return NULL; +-} +- +-const char *spe_get_name() +-{ +- return PMU_SPE; +-} +- +-const char *spe_get_description() +-{ +- return NULL; +-} +- +-const char *spe_get_dep() +-{ +- return NULL; +-} +- +-int spe_get_priority() +-{ +- return 0; +-} +- +-int spe_get_type() +-{ +- return -1; +-} +- +-int spe_get_period() +-{ +- return 100; +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_spe.h b/src/plugin/collect/pmu/plugin/plugin_spe.h +deleted file mode 100644 +index 11bb71f..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_spe.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PLUGIN_SPE_H__ +-#define __PLUGIN_SPE_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-const char *spe_get_version(); +-const char *spe_get_name(); +-const char *spe_get_description(); +-const char *spe_get_dep(); +-int spe_get_priority(); +-int spe_get_type(); +-int spe_get_period(); +-bool spe_enable(); +-void spe_disable(); +-const struct DataRingBuf *spe_get_ring_buf(); +-void spe_run(const struct Param *param); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/src/plugin/collect/pmu/plugin/plugin_uncore.c b/src/plugin/collect/pmu/plugin/plugin_uncore.c +deleted file mode 100644 +index 9b845db..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_uncore.c ++++ /dev/null +@@ -1,199 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include "pmu.h" +-#include "pcerrc.h" +-#include "interface.h" +-#include "pmu_plugin.h" +-#include "plugin_comm.h" +-#include "plugin_uncore.h" +-#include "pmu_uncore.h" +- +-static bool uncore_is_open = false; +-static int uncore_pd = -1; +-static struct DataRingBuf *uncore_buf = NULL; +-struct PmuData *uncore_data = NULL; +- +-static int uncore_init() +-{ +- uncore_buf = init_buf(UNCORE_BUF_SIZE, PMU_UNCORE); +- if (!uncore_buf) { +- return -1; +- } +- +- return 0; +-} +- +-static void uncore_fini() +-{ +- if (!uncore_buf) { +- return; +- } +- +- free_buf(uncore_buf); +- uncore_buf = NULL; +-} +- +-static int uncore_open() +-{ +- struct PmuAttr attr; +- struct uncore_config *rx_outer; +- struct uncore_config *rx_sccl; +- struct uncore_config *rx_ops_num; +- int hha_num; +- 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("This system not support pmu_uncore\n"); +- return pd; +- } +- +- hha_num = get_uncore_hha_num(); +- rx_outer = get_rx_outer(); +- rx_sccl = get_rx_sccl(); +- rx_ops_num = get_rx_ops_num(); +- +- char *evtList[hha_num * UNCORE_MAX]; +- for (int i = 0; i < hha_num; i++) { +- evtList[i + hha_num * RX_OUTER] = rx_outer[i].uncore_name; +- evtList[i + hha_num * RX_SCCL] = rx_sccl[i].uncore_name; +- evtList[i + hha_num * RX_OPS_NUM] = rx_ops_num[i].uncore_name; +- } +- +- (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr)); +- +- attr.evtList = evtList; +- attr.numEvt = hha_num * UNCORE_MAX; +- attr.pidList = NULL; +- attr.numPid = 0; +- attr.cpuList = NULL; +- attr.numCpu = 0; +- +- pd = PmuOpen(COUNTING, &attr); +- if (pd == -1) { +- printf("%s\n", Perror()); +- return pd; +- } +- +- return pd; +-} +- +-static void uncore_close() +-{ +- PmuClose(uncore_pd); +- uncore_pd = -1; +- uncore_is_open = false; +-} +- +-bool uncore_enable() +-{ +- if (!uncore_buf) { +- int ret = uncore_init(); +- if (ret != 0) { +- goto err; +- } +- } +- +- if (!uncore_is_open) { +- uncore_pd = uncore_open(); +- if (uncore_pd == -1) { +- uncore_fini(); +- goto err; +- } +- } +- +- return PmuEnable(uncore_pd) == 0; +- +-err: +- return false; +-} +- +-void uncore_disable() +-{ +- PmuDisable(uncore_pd); +- uncore_close(); +- uncore_fini(); +-} +- +-const struct DataRingBuf *uncore_get_ring_buf() +-{ +- return (const struct DataRingBuf *)uncore_buf; +-} +- +-static void uncore_reflash_ring_buf() +-{ +- struct DataRingBuf *data_ringbuf; +- int len; +- +- data_ringbuf = (struct DataRingBuf *)uncore_buf; +- if (!data_ringbuf) { +- printf("uncore_buf has not malloc\n"); +- return; +- } +- +- PmuDisable(uncore_pd); +- len = PmuRead(uncore_pd, &uncore_data); +- PmuEnable(uncore_pd); +- +- fill_buf(data_ringbuf, uncore_data, len); +-} +- +-void uncore_run(const struct Param *param) +-{ +- (void)param; +- uncore_reflash_ring_buf(); +-} +- +-const char *uncore_get_version() +-{ +- return NULL; +-} +- +-const char *uncore_get_name() +-{ +- return PMU_UNCORE; +-} +- +-const char *uncore_get_description() +-{ +- return NULL; +-} +- +-const char *uncore_get_dep() +-{ +- return NULL; +-} +- +-int uncore_get_priority() +-{ +- return 0; +-} +- +-int uncore_get_type() +-{ +- return -1; +-} +- +-int uncore_get_period() +-{ +- return 100; +-} +diff --git a/src/plugin/collect/pmu/plugin/plugin_uncore.h b/src/plugin/collect/pmu/plugin/plugin_uncore.h +deleted file mode 100644 +index a15d950..0000000 +--- a/src/plugin/collect/pmu/plugin/plugin_uncore.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PLUGIN_UNCORE_H__ +-#define __PLUGIN_UNCORE_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-const char *uncore_get_version(); +-const char *uncore_get_name(); +-const char *uncore_get_description(); +-const char *uncore_get_dep(); +-int uncore_get_priority(); +-int uncore_get_type(); +-int uncore_get_period(); +-bool uncore_enable(); +-void uncore_disable(); +-const struct DataRingBuf *uncore_get_ring_buf(); +-void uncore_run(const struct Param *param); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/src/plugin/collect/pmu/plugin/pmu_uncore.c b/src/plugin/collect/pmu/plugin/pmu_uncore.c +deleted file mode 100644 +index 71dcda1..0000000 +--- a/src/plugin/collect/pmu/plugin/pmu_uncore.c ++++ /dev/null +@@ -1,142 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#include +-#include +-#include +-#include +-#include +-#include "pmu_uncore.h" +- +-static int hha_num = 0; +-static struct uncore_config *uncore_rx_outer = NULL; +-static struct uncore_config *uncore_rx_sccl = NULL; +-static struct uncore_config *uncore_rx_ops_num = NULL; +- +-int get_uncore_hha_num() +-{ +- return hha_num; +-} +- +-struct uncore_config *get_rx_outer() +-{ +- return uncore_rx_outer; +-} +- +-struct uncore_config *get_rx_sccl() +-{ +- return uncore_rx_sccl; +-} +- +-struct uncore_config *get_rx_ops_num() +-{ +- return uncore_rx_ops_num; +-} +- +-static int read_single_uncore_event(const char *hha_name, struct uncore_config *uncore_event, const char *event_name) +-{ +- char hha_path[MAX_PATH_LEN] = {0}; +- +- // Read cfg +- snprintf_truncated_s(hha_path, MAX_PATH_LEN, "%s/%s/", hha_name, event_name); +- +- strcpy(uncore_event->uncore_name, hha_path); +- +- return 0; +-} +- +-static void free_namelist(int n, struct dirent **namelist) +-{ +- while (n--) { +- free(namelist[n]); +- } +- free(namelist); +-} +- +-static int hha_read_uncore_config(int n, struct dirent **namelist) +-{ +- int index = 0; +- +- while (index < n) { +- if (read_single_uncore_event(namelist[index]->d_name, &uncore_rx_outer[index], "rx_outer") != 0) { +- return -1; +- } +- if (read_single_uncore_event(namelist[index]->d_name, &uncore_rx_sccl[index], "rx_sccl") != 0) { +- return -1; +- } +- if (read_single_uncore_event(namelist[index]->d_name, &uncore_rx_ops_num[index], "rx_ops_num") != 0) { +- return -1; +- } +- +- index++; +- } +- +- return 0; +-} +- +-static int hha_scandir_select(const struct dirent *ptr) +-{ +- int ret = 0; +- if (strstr(ptr->d_name, "hha") != NULL) { +- ret = 1; +- } +- +- return ret; +-} +- +-int hha_uncore_config_init(void) +-{ +- int ret; +- struct dirent **namelist; +- +- hha_num = scandir(DEVICE_PATH, &namelist, hha_scandir_select, alphasort); +- if (hha_num <= 0) { +- printf("scandir failed\n"); +- return -1; +- } +- +- uncore_rx_outer = (struct uncore_config *)calloc(hha_num, sizeof(struct uncore_config)); +- if (uncore_rx_outer == NULL) { +- free_namelist(hha_num, namelist); +- return -1; +- } +- uncore_rx_sccl = (struct uncore_config *)calloc(hha_num, sizeof(struct uncore_config)); +- if (uncore_rx_sccl == NULL) { // free uncore_rx_sccl in function uncore_config_fini +- free_namelist(hha_num, namelist); +- return -1; +- } +- uncore_rx_ops_num = (struct uncore_config *)calloc(hha_num, sizeof(struct uncore_config)); +- if (uncore_rx_ops_num == NULL) { // free uncore_rx_ops_num in function uncore_config_fini +- free_namelist(hha_num, namelist); +- return -1; +- } +- +- ret = hha_read_uncore_config(hha_num, namelist); +- free_namelist(hha_num, namelist); +- +- return ret; +-} +- +-void uncore_config_fini(void) +-{ +-#define UNCORE_CONFIG_FREE(uncore_event) do { \ +- if (uncore_event != NULL) { \ +- free(uncore_event); \ +- uncore_event = NULL; \ +- } \ +-} while (0) +- +- UNCORE_CONFIG_FREE(uncore_rx_outer); +- UNCORE_CONFIG_FREE(uncore_rx_sccl); +- UNCORE_CONFIG_FREE(uncore_rx_ops_num); +- +- hha_num = 0; +-} +diff --git a/src/plugin/collect/pmu/plugin/pmu_uncore.h b/src/plugin/collect/pmu/plugin/pmu_uncore.h +deleted file mode 100644 +index d49208c..0000000 +--- a/src/plugin/collect/pmu/plugin/pmu_uncore.h ++++ /dev/null +@@ -1,45 +0,0 @@ +-/****************************************************************************** +- * Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved. +- * oeAware is licensed under 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. +- ******************************************************************************/ +-#ifndef __PMU_UNCORE_H__ +-#define __PMU_UNCORE_H__ +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-#define UNCORE_NAME_SIZE 256 +-#define MAX_PATH_LEN 256 +-#define DEVICE_PATH "/sys/devices/" +- +-struct uncore_config { +- char uncore_name[UNCORE_NAME_SIZE]; +-}; +- +-enum uncore_type { +- RX_OUTER, +- RX_SCCL, +- RX_OPS_NUM, +- UNCORE_MAX, +-}; +- +-int get_uncore_hha_num(void); +-struct uncore_config *get_rx_outer(void); +-struct uncore_config *get_rx_sccl(void); +-struct uncore_config *get_rx_ops_num(void); +-int hha_uncore_config_init(void); +-void uncore_config_fini(void); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +-- +2.33.0 + diff --git a/0002-add-data-free-and-fix-unsubscribe-error.patch b/0002-add-data-free-and-fix-unsubscribe-error.patch new file mode 100644 index 0000000..c3c62e8 --- /dev/null +++ b/0002-add-data-free-and-fix-unsubscribe-error.patch @@ -0,0 +1,524 @@ +From 9fb0aa74fece1deea72ef7c8eef5e45da2113b21 Mon Sep 17 00:00:00 2001 +From: fly_1997 +Date: Tue, 26 Nov 2024 15:59:15 +0800 +Subject: [PATCH 2/5] add data free and fix unsubscribe error + +--- + src/common/CMakeLists.txt | 7 + + src/common/data_register.cpp | 247 +++++++++++++++---- + src/common/data_register.h | 20 +- + src/plugin/collect/include/command_data.h | 2 +- + src/plugin_mgr/event/unsubscribe_handler.cpp | 7 +- + src/plugin_mgr/instance_run_handler.cpp | 2 +- + src/sdk/oe_client.cpp | 1 + + 7 files changed, 227 insertions(+), 59 deletions(-) + +diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt +index 2d49b3e..46084e5 100644 +--- a/src/common/CMakeLists.txt ++++ b/src/common/CMakeLists.txt +@@ -22,6 +22,13 @@ target_link_libraries(${PROJECT_NAME} log4cplus) + target_link_libraries(${PROJECT_NAME} yaml-cpp) + target_link_libraries(${PROJECT_NAME} curl boundscheck) + ++if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") ++target_link_directories(${PROJECT_NAME} PUBLIC ++ ${LIB_KPERF_LIBPATH} ++) ++target_link_libraries(${PROJECT_NAME} kperf) ++endif() ++ + file(COPY + "${CMAKE_CURRENT_SOURCE_DIR}/data_list.h" + DESTINATION "${CMAKE_BINARY_DIR}/output/include") +diff --git a/src/common/data_register.cpp b/src/common/data_register.cpp +index 89e660e..cdf6d97 100644 +--- a/src/common/data_register.cpp ++++ b/src/common/data_register.cpp +@@ -16,68 +16,107 @@ + + namespace oeaware { + +-int TopicSerialize(const void *topic, OutStream &out) ++void TopicFree(CTopic *topic) + { +- auto tmpTopic = static_cast(topic); +- std::string instanceName(tmpTopic->instanceName); +- std::string topicName(tmpTopic->topicName); +- std::string params(tmpTopic->params); ++ if (topic == nullptr) { ++ return; ++ } ++ if (topic->instanceName != nullptr) { ++ delete[] topic->instanceName; ++ topic->instanceName = nullptr; ++ } ++ if (topic->topicName != nullptr) { ++ delete[] topic->topicName; ++ topic->topicName = nullptr; ++ } ++ if (topic->params != nullptr) { ++ delete[] topic->params; ++ topic->params = nullptr; ++ } ++} ++ ++int TopicSerialize(const CTopic *topic, OutStream &out) ++{ ++ std::string instanceName(topic->instanceName); ++ std::string topicName(topic->topicName); ++ std::string params(topic->params); + out << instanceName << topicName << params; + return 0; + } + +-int TopicDeserialize(void *topic, InStream &in) ++int TopicDeserialize(CTopic *topic, InStream &in) + { + std::string instanceName; + std::string topicName; + std::string params; + in >> instanceName >> topicName >> params; +- ((CTopic*)topic)->instanceName = new char[instanceName.size() + 1]; +- ((CTopic*)topic)->topicName = new char[topicName.size() + 1]; +- ((CTopic*)topic)->params = new char[params.size() + 1]; ++ topic->instanceName = new char[instanceName.size() + 1]; ++ topic->topicName = new char[topicName.size() + 1]; ++ topic->params = new char[params.size() + 1]; + +- auto ret = strcpy_s(((CTopic*)topic)->instanceName, instanceName.size() + 1, instanceName.data()); ++ auto ret = strcpy_s(topic->instanceName, instanceName.size() + 1, instanceName.data()); + if (ret != EOK) return ret; +- ret = strcpy_s(((CTopic*)topic)->topicName, topicName.size() + 1, topicName.data()); ++ ret = strcpy_s(topic->topicName, topicName.size() + 1, topicName.data()); + if (ret != EOK) return ret; +- ret = strcpy_s(((CTopic*)topic)->params, params.size() + 1, params.data()); ++ ret = strcpy_s(topic->params, params.size() + 1, params.data()); + if (ret != EOK) return ret; + return 0; + } + +-int DataListSerialize(const void *dataList, OutStream &out) ++void DataListFree(DataList *dataList) ++{ ++ if (dataList == nullptr) { ++ return; ++ } ++ auto ® = Register::GetInstance(); ++ DataFreeFunc free = reg.GetDataFreeFunc(Concat({dataList->topic.instanceName, dataList->topic.topicName}, "::")); ++ if (free == nullptr) { ++ free = reg.GetDataFreeFunc(dataList->topic.instanceName); ++ } ++ if (free != nullptr) { ++ for (uint64_t i = 0; i < dataList->len; ++i) { ++ free(dataList->data[i]); ++ } ++ } ++ TopicFree(&dataList->topic); ++ if (dataList->data != nullptr) { ++ delete[] dataList->data; ++ dataList->data = nullptr; ++ } ++} ++ ++int DataListSerialize(const DataList *dataList, OutStream &out) + { +- auto tmpList = static_cast(dataList); +- TopicSerialize(&tmpList->topic, out); +- out << tmpList->len; ++ TopicSerialize(&dataList->topic, out); ++ out << dataList->len; + auto ® = Register::GetInstance(); +- auto func = reg.GetDataSerialize(Concat({tmpList->topic.instanceName, tmpList->topic.topicName}, "::")); ++ auto func = reg.GetDataSerialize(Concat({dataList->topic.instanceName, dataList->topic.topicName}, "::")); + if (func == nullptr) { +- func = reg.GetDataSerialize(tmpList->topic.instanceName); ++ func = reg.GetDataSerialize(dataList->topic.instanceName); + } +- for (uint64_t i = 0; i < tmpList->len; ++i) { +- func(tmpList->data[i], out); ++ for (uint64_t i = 0; i < dataList->len; ++i) { ++ func(dataList->data[i], out); + } + return 0; + } + +-int DataListDeserialize(void *dataList, InStream &in) ++int DataListDeserialize(DataList *dataList, InStream &in) + { + CTopic topic; + TopicDeserialize(&topic, in); + uint64_t size; + in >> size; +- ((DataList*)dataList)->topic = topic; +- ((DataList*)dataList)->len = size; +- ((DataList*)dataList)->data = new void* [size]; ++ dataList->topic = topic; ++ dataList->len = size; ++ dataList->data = new void* [size]; + auto ® = Register::GetInstance(); + auto func = reg.GetDataDeserialize(Concat({topic.instanceName, topic.topicName}, "::")); + if (func == nullptr) { + func = reg.GetDataDeserialize(topic.instanceName); + } + for (uint64_t i = 0; i < size; ++i) { +- ((DataList*)dataList)->data[i] = nullptr; +- auto ret = func(&(((DataList*)dataList)->data[i]), in); ++ dataList->data[i] = nullptr; ++ auto ret = func(&(dataList->data[i]), in); + if (ret) { + return ret; + } +@@ -85,6 +124,16 @@ int DataListDeserialize(void *dataList, InStream &in) + return 0; + } + ++void ResultFree(Result *result) ++{ ++ if (result == nullptr) { ++ return; ++ } ++ if (result->payload != nullptr) { ++ delete[] result->payload; ++ result->payload = nullptr; ++ } ++} + + int ResultDeserialize(void *data, InStream &in) + { +@@ -96,6 +145,17 @@ int ResultDeserialize(void *data, InStream &in) + return ret; + } + #if defined(__arm__) || defined(__aarch64__) ++void PmuBaseDataFree(void *data) ++{ ++ auto tmpData = static_cast(data); ++ if (tmpData == nullptr) { ++ return; ++ } ++ PmuDataFree(tmpData->pmuData); ++ tmpData->pmuData = nullptr; ++ tmpData->len = 0; ++} ++ + int PmuCountingDataSerialize(const void *data, OutStream &out) + { + auto tmpData = static_cast(data); +@@ -456,6 +516,19 @@ int PmuUncoreDataDeserialize(void **data, InStream &in) + } + #endif + ++void ThreadInfoFree(void *data) ++{ ++ auto threadInfo = static_cast(data); ++ if (threadInfo == nullptr) { ++ return; ++ } ++ if (threadInfo->name != nullptr) { ++ delete[] threadInfo->name; ++ threadInfo->name = nullptr; ++ } ++ delete threadInfo; ++} ++ + int ThreadInfoSerialize(const void *data, OutStream &out) + { + auto threadInfo = static_cast(data); +@@ -476,6 +549,32 @@ int ThreadInfoDeserialize(void **data, InStream &in) + return 0; + } + ++void KernelDataFree(void *data) ++{ ++ auto tmpData = static_cast(data); ++ if (tmpData == nullptr) { ++ return; ++ } ++ KernelDataNode *node = tmpData->kernelData; ++ for (int i = 0; i < tmpData->len; ++i) { ++ auto tmp = node->next; ++ if (node == nullptr) { ++ break; ++ } ++ if (node->key != nullptr) { ++ delete[] node->key; ++ node->key = nullptr; ++ } ++ if (node->value != nullptr) { ++ delete[] node->value; ++ node->value = nullptr; ++ } ++ delete node; ++ node = tmp; ++ } ++ delete tmpData; ++} ++ + int KernelDataSerialize(const void *data, OutStream &out) + { + auto tmpData = static_cast(data); +@@ -523,17 +622,47 @@ int KernelDataDeserialize(void **data, InStream &in) + return 0; + } + ++void CommandDataFree(void *data) ++{ ++ CommandData *commandData = (CommandData*)data; ++ if (commandData == nullptr) { ++ return; ++ } ++ for (int i = 0; i < commandData->attrLen; ++i) { ++ if (commandData->itemAttr[i] != nullptr) { ++ delete[] commandData->itemAttr[i]; ++ commandData->itemAttr[i] = nullptr; ++ } ++ } ++ if (commandData->items == nullptr) { ++ delete commandData; ++ return; ++ } ++ for (int i = 0; i < commandData->itemLen; ++i) { ++ for (int j = 0; j < commandData->attrLen; ++j) { ++ if (commandData->items[i].value[j] != nullptr) { ++ delete[] commandData->items[i].value[j]; ++ commandData->items[i].value[j] = nullptr; ++ } ++ } ++ } ++ delete[] commandData->items; ++ commandData->items = nullptr; ++ ++ delete commandData; ++} ++ + int CommandDataSerialize(const void *data, OutStream &out) + { +- auto sarData = (SarData*)data; +- out << sarData->attrLen << sarData->itemLen; +- for (int i = 0; i < sarData->attrLen; ++i) { +- std::string attr(sarData->itemAttr[i]); ++ auto commandData = (CommandData*)data; ++ out << commandData->attrLen << commandData->itemLen; ++ for (int i = 0; i < commandData->attrLen; ++i) { ++ std::string attr(commandData->itemAttr[i]); + out << attr; + } +- for (int i = 0; i < sarData->itemLen; ++i) { +- for (int j = 0; j < sarData->attrLen; ++j) { +- std::string item(sarData->items[i].value[j]); ++ for (int i = 0; i < commandData->itemLen; ++i) { ++ for (int j = 0; j < commandData->attrLen; ++j) { ++ std::string item(commandData->items[i].value[j]); + out << item; + } + } +@@ -542,8 +671,8 @@ int CommandDataSerialize(const void *data, OutStream &out) + + int CommandDataDeserialize(void **data, InStream &in) + { +- *data = new SarData(); +- auto sarData = static_cast(*data); ++ *data = new CommandData(); ++ auto sarData = static_cast(*data); + in >> sarData->attrLen >> sarData->itemLen; + int ret; + for (int i = 0; i < sarData->attrLen; ++i) { +@@ -570,6 +699,15 @@ int CommandDataDeserialize(void **data, InStream &in) + return 0; + } + ++void AnalysisDataFree(void *data) ++{ ++ auto analysisData = static_cast(data); ++ if (analysisData == nullptr) { ++ return; ++ } ++ delete analysisData; ++} ++ + int AnalysisDataSerialize(const void *data, OutStream &out) + { + auto analysisData = static_cast(data); +@@ -600,44 +738,55 @@ int AnalysisDataDeserialize(void **data, InStream &in) + + void Register::RegisterData(const std::string &name, const RegisterEntry &entry) + { +- deserializeFuncs[name] = entry; ++ registerEntry[name] = entry; + } + + void Register::InitRegisterData() + { + #if defined(__arm__) || defined(__aarch64__) +- RegisterData("pmu_counting_collector", RegisterEntry(PmuCountingDataSerialize, PmuCountingDataDeserialize)); ++ RegisterData("pmu_counting_collector", RegisterEntry(PmuCountingDataSerialize, PmuCountingDataDeserialize, ++ PmuBaseDataFree)); + +- RegisterData("pmu_sampling_collector", RegisterEntry(PmuSamplingDataSerialize, PmuSamplingDataDeserialize)); ++ RegisterData("pmu_sampling_collector", RegisterEntry(PmuSamplingDataSerialize, PmuSamplingDataDeserialize, ++ PmuBaseDataFree)); + +- RegisterData("pmu_spe_collector", RegisterEntry(PmuSpeDataSerialize, PmuSpeDataDeserialize)); ++ RegisterData("pmu_spe_collector", RegisterEntry(PmuSpeDataSerialize, PmuSpeDataDeserialize, PmuBaseDataFree)); + +- RegisterData("pmu_uncore_collector", RegisterEntry(PmuUncoreDataSerialize, PmuUncoreDataDeserialize)); ++ RegisterData("pmu_uncore_collector", RegisterEntry(PmuUncoreDataSerialize, PmuUncoreDataDeserialize, ++ PmuBaseDataFree)); + #endif +- RegisterData("thread_collector", RegisterEntry(ThreadInfoSerialize, ThreadInfoDeserialize)); ++ RegisterData("thread_collector", RegisterEntry(ThreadInfoSerialize, ThreadInfoDeserialize, ThreadInfoFree)); ++ ++ RegisterData("kernel_config", RegisterEntry(KernelDataSerialize, KernelDataDeserialize, KernelDataFree)); + +- RegisterData("kernel_config", RegisterEntry(KernelDataSerialize, KernelDataDeserialize)); ++ RegisterData("thread_scenario", RegisterEntry(ThreadInfoSerialize, ThreadInfoDeserialize, ThreadInfoFree)); + +- RegisterData("thread_scenario", RegisterEntry(ThreadInfoSerialize, ThreadInfoDeserialize)); ++ RegisterData("command_collector", RegisterEntry(CommandDataSerialize, CommandDataDeserialize, CommandDataFree)); + +- RegisterData("command_collector", RegisterEntry(CommandDataSerialize, CommandDataDeserialize)); +- RegisterData("command_collector", RegisterEntry(CommandDataSerialize, CommandDataDeserialize)); + RegisterData("analysis_aware", RegisterEntry(AnalysisDataSerialize, AnalysisDataDeserialize)); + } + + SerializeFunc Register::GetDataSerialize(const std::string &name) + { +- if (!deserializeFuncs.count(name)) { ++ if (!registerEntry.count(name)) { + return nullptr; + } +- return deserializeFuncs[name].se; ++ return registerEntry[name].se; + } + + DeserializeFunc Register::GetDataDeserialize(const std::string &name) + { +- if (!deserializeFuncs.count(name)) { ++ if (!registerEntry.count(name)) { ++ return nullptr; ++ } ++ return registerEntry[name].de; ++} ++ ++DataFreeFunc Register::GetDataFreeFunc(const std::string &name) ++{ ++ if (!registerEntry.count(name)) { + return nullptr; + } +- return deserializeFuncs[name].de; ++ return registerEntry[name].free; + } + } +diff --git a/src/common/data_register.h b/src/common/data_register.h +index 5e1ae4a..b72cd97 100644 +--- a/src/common/data_register.h ++++ b/src/common/data_register.h +@@ -13,18 +13,21 @@ + #define COMMON_DATA_REGISTER_H + #include + #include "serialize.h" ++#include "data_list.h" + + namespace oeaware { + using DeserializeFunc = int(*)(void**, InStream &in); + using SerializeFunc = int(*)(const void*, OutStream &out); +-using FreeData = void(*)(void *); ++using DataFreeFunc = void(*)(void *); + + struct RegisterEntry { + RegisterEntry() { } + RegisterEntry(const SerializeFunc &se, const DeserializeFunc &de) : se(se), de(de) { } ++ RegisterEntry(const SerializeFunc &se, const DeserializeFunc &de, const DataFreeFunc &free) : se(se), ++ de(de), free(free) { } + SerializeFunc se; + DeserializeFunc de; +- FreeData free; ++ DataFreeFunc free; + }; + + class Register { +@@ -40,17 +43,20 @@ public: + void InitRegisterData(); + DeserializeFunc GetDataDeserialize(const std::string &name); + SerializeFunc GetDataSerialize(const std::string &name); ++ DataFreeFunc GetDataFreeFunc(const std::string &name); + void RegisterData(const std::string &name, const RegisterEntry &func); + private: + Register() { }; + +- std::unordered_map deserializeFuncs; ++ std::unordered_map registerEntry; + }; +- +-int DataListSerialize(const void *data, OutStream &out); +-int DataListDeserialize(void *data, InStream &in); ++void DataListFree(DataList *dataList); ++int DataListSerialize(const DataList *dataList, OutStream &out); ++int DataListDeserialize(DataList *dataList, InStream &in); + int ResultDeserialize(void *data, InStream &in); +-int TopicSerialize(const void *topic, OutStream &out); ++int TopicSerialize(const CTopic *topic, OutStream &out); ++int TopicDeserialize(CTopic *topic, InStream &in); ++void TopicFree(CTopic *topic); + } + + #endif +diff --git a/src/plugin/collect/include/command_data.h b/src/plugin/collect/include/command_data.h +index f466bd3..e7a8540 100644 +--- a/src/plugin/collect/include/command_data.h ++++ b/src/plugin/collect/include/command_data.h +@@ -26,7 +26,7 @@ typedef struct { + int attrLen; + char *itemAttr[ATTR_MAX_LENGTH]; + CommandIter *items; +-} SarData, CommandData; ++} CommandData; + #ifdef __cplusplus + } + #endif +diff --git a/src/plugin_mgr/event/unsubscribe_handler.cpp b/src/plugin_mgr/event/unsubscribe_handler.cpp +index 72b53bf..749a683 100644 +--- a/src/plugin_mgr/event/unsubscribe_handler.cpp ++++ b/src/plugin_mgr/event/unsubscribe_handler.cpp +@@ -23,7 +23,12 @@ EventResult UnsubscribeHandler::Handle(const Event &event) + INFO(logger, "sdk " << event.payload[0] << " disconnected and has been unsubscribed related topics."); + return eventResult; + } +- auto msg = std::make_shared(RunType::UNSUBSCRIBE, event.payload); ++ CTopic cTopic; ++ InStream in(event.payload[0]); ++ TopicDeserialize(&cTopic, in); ++ Topic topic{cTopic.instanceName, cTopic.topicName, cTopic.params}; ++ auto msg = std::make_shared(RunType::UNSUBSCRIBE, ++ std::vector{topic.GetType(), event.payload[1]}); + instanceRunHandler->RecvQueuePush(msg); + msg->Wait(); + result = msg->result; +diff --git a/src/plugin_mgr/instance_run_handler.cpp b/src/plugin_mgr/instance_run_handler.cpp +index 2e11d0d..30dc886 100644 +--- a/src/plugin_mgr/instance_run_handler.cpp ++++ b/src/plugin_mgr/instance_run_handler.cpp +@@ -181,7 +181,7 @@ void InstanceRunHandler::PublishData(std::shared_ptr &msg) + auto instance = memoryStore->GetInstance(subscriber); + instance->interface->UpdateData(msg->dataList); + } +- // free dataList ++ DataListFree(&msg->dataList); + } + + bool InstanceRunHandler::HandleMessage() +diff --git a/src/sdk/oe_client.cpp b/src/sdk/oe_client.cpp +index 4eb04ae..9452a37 100644 +--- a/src/sdk/oe_client.cpp ++++ b/src/sdk/oe_client.cpp +@@ -70,6 +70,7 @@ void Impl::HandleRecv() + for (auto handle : topicHandle[key]) { + handle(&dataList); + } ++ DataListFree(&dataList); + break; + } + default: +-- +2.33.0 + diff --git a/0003-fix-failed-to-connect-to-the-sdk-and-command-executi.patch b/0003-fix-failed-to-connect-to-the-sdk-and-command-executi.patch new file mode 100644 index 0000000..3d9ace0 --- /dev/null +++ b/0003-fix-failed-to-connect-to-the-sdk-and-command-executi.patch @@ -0,0 +1,412 @@ +From 51355e66be3eeec6ebe79faa88324c788e5a3829 Mon Sep 17 00:00:00 2001 +From: fly_1997 +Date: Wed, 27 Nov 2024 05:13:26 +0800 +Subject: [PATCH 3/5] fix failed to connect to the sdk and command execution is + stuck + +--- + src/common/utils.cpp | 16 ++++ + src/common/utils.h | 1 + + .../collect/system/command/command_base.cpp | 48 +++++++++++- + .../collect/system/command/command_base.h | 9 +++ + .../system/command/command_collector.cpp | 9 ++- + src/plugin/collect/system/kernel_config.cpp | 1 + + src/plugin_mgr/config.cpp | 17 ----- + src/plugin_mgr/config.h | 1 - + src/plugin_mgr/message_manager.cpp | 76 +++++++++++++++++-- + src/plugin_mgr/message_manager.h | 3 +- + src/sdk/oe_client.cpp | 12 ++- + 11 files changed, 160 insertions(+), 33 deletions(-) + +diff --git a/src/common/utils.cpp b/src/common/utils.cpp +index 4e12a57..a300a6a 100644 +--- a/src/common/utils.cpp ++++ b/src/common/utils.cpp +@@ -156,4 +156,20 @@ std::vector SplitString(const std::string &str, const std::string & + } + return tokens; + } ++bool CreateDir(const std::string &path) ++{ ++ size_t pos = 0; ++ do { ++ pos = path.find_first_of("/", pos + 1); ++ std::string subPath = path.substr(0, pos); ++ struct stat buffer; ++ if (stat(subPath.c_str(), &buffer) == 0) { ++ continue; ++ } ++ if (mkdir(subPath.c_str(), S_IRWXU | S_IRWXG) != 0) { ++ return false; ++ } ++ } while (pos != std::string::npos); ++ return true; ++} + } +diff --git a/src/common/utils.h b/src/common/utils.h +index ba787fe..48b72bd 100644 +--- a/src/common/utils.h ++++ b/src/common/utils.h +@@ -28,6 +28,7 @@ bool EndWith(const std::string &s, const std::string &ending); + std::string Concat(const std::vector& strings, const std::string &split); + // Separate "str" with the separator "split" + std::vector SplitString(const std::string &str, const std::string &split); ++bool CreateDir(const std::string &path); + } + + #endif // !COMMON_UTILS_H +\ No newline at end of file +diff --git a/src/plugin/collect/system/command/command_base.cpp b/src/plugin/collect/system/command/command_base.cpp +index d5a30dd..bf658b8 100644 +--- a/src/plugin/collect/system/command/command_base.cpp ++++ b/src/plugin/collect/system/command/command_base.cpp +@@ -10,6 +10,45 @@ + * See the Mulan PSL v2 for more details. + ******************************************************************************/ + #include "command_base.h" ++#include ++#include ++ ++int PopenProcess::Pclose() ++{ ++ if (fclose(stream) == EOF) { ++ return -1; ++ } ++ stream = nullptr; ++ if (kill(pid, SIGTERM) == -1) { ++ return -1; ++ } ++ return 0; ++} ++ ++void PopenProcess::Popen(const std::string &cmd) ++{ ++ int pipeFd[2]; ++ if (pipe(pipeFd) == -1) { ++ return; ++ } ++ pid = fork(); ++ if (pid == -1) { ++ close(pipeFd[0]); ++ close(pipeFd[1]); ++ } else if (pid == 0) { ++ close(pipeFd[0]); ++ dup2(pipeFd[1], STDOUT_FILENO); ++ close(pipeFd[1]); ++ execl("/bin/bash", "bash", "-c", cmd.data(), nullptr); ++ _exit(1); ++ } ++ close(pipeFd[1]); ++ stream = fdopen(pipeFd[0], "r"); ++ if (!stream) { ++ close(pipeFd[0]); ++ return; ++ } ++} + + CommandBase::CommandBase() + { +@@ -23,18 +62,19 @@ CommandBase::CommandBase() + bool CommandBase::ValidateArgs(const oeaware::Topic& topic) + { + auto cmd = GetCommand(topic); +- FILE *pipe = popen(cmd.c_str(), "r"); +- if (!pipe) { ++ PopenProcess p; ++ p.Popen(cmd); ++ if (!p.stream) { + return false; + } + char buffer[128]; + bool isValid = false; +- if (fgets(buffer, sizeof(buffer), pipe) != nullptr) { ++ if (fgets(buffer, sizeof(buffer), p.stream) != nullptr) { + if (strstr(buffer, "Linux") != nullptr || strstr(buffer, "procs") != nullptr) { + isValid = true; + } + } +- pclose(pipe); ++ p.Pclose(); + return isValid; + } + +diff --git a/src/plugin/collect/system/command/command_base.h b/src/plugin/collect/system/command/command_base.h +index eb75c49..a6d7627 100644 +--- a/src/plugin/collect/system/command/command_base.h ++++ b/src/plugin/collect/system/command/command_base.h +@@ -44,4 +44,13 @@ public: + void Close(); + }; + ++class PopenProcess { ++public: ++ int Pclose(); ++ void Popen(const std::string &cmd); ++ ++ FILE *stream; ++ pid_t pid; ++}; ++ + #endif +diff --git a/src/plugin/collect/system/command/command_collector.cpp b/src/plugin/collect/system/command/command_collector.cpp +index 6c54555..640a406 100644 +--- a/src/plugin/collect/system/command/command_collector.cpp ++++ b/src/plugin/collect/system/command/command_collector.cpp +@@ -32,15 +32,16 @@ CommandCollector::CommandCollector(): oeaware::Interface() + void CommandCollector::CollectThread(const oeaware::Topic &topic, CommandBase* collector) + { + std::string cmd = collector->GetCommand(topic); +- FILE* pipe = popen(cmd.c_str(), "r"); +- if (!pipe) { ++ PopenProcess p; ++ p.Popen(cmd); ++ if (!p.stream) { + return; + } + char buffer[256]; +- while (collector->isRunning && fgets(buffer, sizeof(buffer), pipe) != nullptr) { ++ while (collector->isRunning && fgets(buffer, sizeof(buffer), p.stream) != nullptr) { + collector->ParseLine(std::string(buffer)); + } +- pclose(pipe); ++ p.Pclose(); + + collector->Close(); + } +diff --git a/src/plugin/collect/system/kernel_config.cpp b/src/plugin/collect/system/kernel_config.cpp +index 63aafea..6bdfc8a 100644 +--- a/src/plugin/collect/system/kernel_config.cpp ++++ b/src/plugin/collect/system/kernel_config.cpp +@@ -113,6 +113,7 @@ static bool IsSymlink(const std::string &path) + } + return S_ISLNK(st.st_mode); + } ++ + void KernelConfig::GetAllEth() + { + const std::string path = "/sys/class/net"; +diff --git a/src/plugin_mgr/config.cpp b/src/plugin_mgr/config.cpp +index 341880b..8cd1432 100644 +--- a/src/plugin_mgr/config.cpp ++++ b/src/plugin_mgr/config.cpp +@@ -15,23 +15,6 @@ + #include "default_path.h" + + namespace oeaware { +-bool CreateDir(const std::string &path) +-{ +- size_t pos = 0; +- do { +- pos = path.find_first_of("/", pos + 1); +- std::string subPath = path.substr(0, pos); +- struct stat buffer; +- if (stat(subPath.c_str(), &buffer) == 0) { +- continue; +- } +- if (mkdir(subPath.c_str(), S_IRWXU | S_IRWXG) != 0) { +- return false; +- } +- } while (pos != std::string::npos); +- return true; +-} +- + bool CheckPluginList(YAML::Node pluginListItem) + { + if (pluginListItem["name"].IsNull()) { +diff --git a/src/plugin_mgr/config.h b/src/plugin_mgr/config.h +index 640ab00..19e6d33 100644 +--- a/src/plugin_mgr/config.h ++++ b/src/plugin_mgr/config.h +@@ -130,7 +130,6 @@ private: + }; + + std::string GetPath(); +-bool CreateDir(const std::string &path); + } + + #endif +diff --git a/src/plugin_mgr/message_manager.cpp b/src/plugin_mgr/message_manager.cpp +index 1ffa4cc..bfa5b0c 100644 +--- a/src/plugin_mgr/message_manager.cpp ++++ b/src/plugin_mgr/message_manager.cpp +@@ -11,6 +11,7 @@ + ******************************************************************************/ + #include "message_manager.h" + #include ++#include + #include + #include "default_path.h" + #include "utils.h" +@@ -41,15 +42,56 @@ int Epoll::EventWait(struct epoll_event *events, int maxEvents, int timeout) + return epoll_wait(epfd, events, maxEvents, timeout); + } + ++static std::vector GetUserFromGroup(const std::string &groupName) ++{ ++ std::vector users; ++ std::ifstream file("/etc/group"); ++ if (!file.is_open()) { ++ return users; ++ } ++ std::string line; ++ size_t userPartIndex = 3; ++ while (std::getline(file, line)) { ++ std::vector parts = SplitString(line, ":"); ++ if (parts.size() > userPartIndex && parts[0] == groupName) { ++ std::vector userParts = SplitString(parts[userPartIndex], ","); ++ users.insert(users.end(), userParts.begin(), userParts.end()); ++ break; ++ } ++ } ++ file.close(); ++ return users; ++} ++ ++static int GetUid(const std::string &name) ++{ ++ struct passwd pwd; ++ struct passwd *result; ++ char buf[1024]; ++ int res = getpwnam_r(name.c_str(), &pwd, buf, sizeof(buf), &result); ++ if (res != 0 || result == nullptr) { ++ return -1; ++ } ++ return pwd.pw_uid; ++} ++ + void TcpSocket::InitGroups() + { + std::vector groupNames{"oeaware", "root"}; ++ groups[0].emplace_back(0); + for (auto &groupName : groupNames) { + auto gid = GetGidByGroupName(groupName); + if (gid < 0) { + continue; + } +- groups.emplace_back(gid); ++ auto users = GetUserFromGroup(groupName); ++ for (auto &user : users) { ++ auto uid = GetUid(user); ++ if (uid < 0) { ++ continue; ++ } ++ groups[gid].emplace_back(uid); ++ } + } + } + +@@ -68,6 +110,11 @@ bool TcpSocket::StartListen() + ERROR(logger, path << " chmod error!"); + return false; + } ++ std::string cmd = "setfacl -m g:oeaware:rw " + path; ++ auto ret = system(cmd.c_str()); ++ if (ret) { ++ WARN(logger, "failed to set the communication permission of the oeaware user group."); ++ } + if (domainSocket->Listen() < 0) { + ERROR(logger, "listen error!"); + return false; +@@ -136,7 +183,6 @@ static void GetEventResult(Message &msg, EventResultQueue sendMessage) + } + + const int DISCONNECTED = -1; +-const int DISCONNECTED_AND_UNSUBCRIBE = -2; + + void TcpMessageHandler::Init(EventQueue newRecvMessage, EventResultQueue newSendMessage, EventQueue newRecvData) + { +@@ -240,6 +286,23 @@ void TcpMessageHandler::Start() + } + } + ++bool TcpSocket::CheckFileGroups(const std::string &path) ++{ ++ struct stat st; ++ if (lstat(path.c_str(), &st) < 0) { ++ return false; ++ } ++ for (auto &p : groups) { ++ bool ok = std::any_of(p.second.begin(), p.second.end(), [&](uid_t uid) { ++ return uid == st.st_uid; ++ }); ++ if (ok) { ++ return true; ++ } ++ } ++ return false; ++} ++ + void TcpSocket::SaveConnection() + { + struct sockaddr_un un; +@@ -255,12 +318,12 @@ void TcpSocket::SaveConnection() + memcpy_s(name, maxNameLength, un.sun_path, len); + name[len] = 0; + bool isSdk = false; +- if (strcmp(name, DEFAULT_SDK_CONN_PATH.c_str()) == 0) { ++ if (len > 0) { + isSdk = true; + } + // check permission +- if (isSdk && !CheckFileGroups(DEFAULT_SDK_CONN_PATH, groups)) { +- WARN(logger, "sdk permission error"); ++ if (isSdk && !CheckFileGroups(name)) { ++ WARN(logger, "sdk permission error, " << name); + return; + } + if (!epoll->EventCtl(EPOLL_CTL_ADD, conn)) { +@@ -274,6 +337,9 @@ void TcpSocket::SaveConnection() + type |= CMD_CONN; + } + tcpMessageHandler.AddConn(conn, type); ++ if (isSdk) { ++ INFO(logger, "a sdk connection is established, " << name); ++ } + DEBUG(logger, "client connected!"); + } + +diff --git a/src/plugin_mgr/message_manager.h b/src/plugin_mgr/message_manager.h +index 38f544d..3c67096 100644 +--- a/src/plugin_mgr/message_manager.h ++++ b/src/plugin_mgr/message_manager.h +@@ -73,12 +73,13 @@ private: + bool StartListen(); + void SaveConnection(); + void HandleEvents(struct epoll_event *events, int num); ++ bool CheckFileGroups(const std::string &path); + private: + log4cplus::Logger logger; + std::unique_ptr domainSocket; + std::unique_ptr epoll; + TcpMessageHandler tcpMessageHandler; +- std::vector groups; ++ std::unordered_map> groups; + const int maxRequestNum = 20; + const int maxNameLength = 108; + }; +diff --git a/src/sdk/oe_client.cpp b/src/sdk/oe_client.cpp +index 9452a37..040433a 100644 +--- a/src/sdk/oe_client.cpp ++++ b/src/sdk/oe_client.cpp +@@ -80,7 +80,17 @@ void Impl::HandleRecv() + } + int Impl::Init() + { +- domainSocket = std::make_shared(DEFAULT_SDK_CONN_PATH); ++ auto home = getenv("HOME"); ++ std::string homeDir; ++ if (home == nullptr) { ++ homeDir = "/var/run/oeAware"; ++ } else { ++ homeDir = home; ++ homeDir += "/.oeaware"; ++ } ++ ++ CreateDir(homeDir); ++ domainSocket = std::make_shared(homeDir + "/oeaware-sdk.sock"); + domainSocket->SetRemotePath(DEFAULT_SERVER_LISTEN_PATH); + resultQueue = std::make_shared>(); + int sock = domainSocket->Socket(); +-- +2.33.0 + diff --git a/0004-add-command-verification.patch b/0004-add-command-verification.patch new file mode 100644 index 0000000..09c7b79 --- /dev/null +++ b/0004-add-command-verification.patch @@ -0,0 +1,204 @@ +From eff9e77d5a695f2ef800c54206dbe0ac11dc0272 Mon Sep 17 00:00:00 2001 +From: fly_1997 +Date: Wed, 27 Nov 2024 10:18:57 +0800 +Subject: [PATCH 4/5] add command verification + +--- + src/plugin/collect/system/CMakeLists.txt | 2 +- + .../collect/system/command/command_base.cpp | 29 ++++++++++--------- + .../collect/system/command/command_base.h | 3 ++ + .../system/command/command_collector.h | 3 +- + src/plugin/collect/system/kernel_config.cpp | 9 ++++++ + src/plugin/collect/system/kernel_config.h | 1 + + src/plugin_mgr/event/subscribe_handler.cpp | 10 ++----- + src/plugin_mgr/instance_run_handler.cpp | 3 +- + 8 files changed, 36 insertions(+), 24 deletions(-) + +diff --git a/src/plugin/collect/system/CMakeLists.txt b/src/plugin/collect/system/CMakeLists.txt +index ee6044f..af4a239 100644 +--- a/src/plugin/collect/system/CMakeLists.txt ++++ b/src/plugin/collect/system/CMakeLists.txt +@@ -1,6 +1,6 @@ + cmake_minimum_required(VERSION 3.11) + project(system_collector) +-include_directories(../include) ++include_directories(command) + add_compile_options(-O2 -fPIC -Wall -Wextra) + add_library(system_collector SHARED + thread_collector.cpp +diff --git a/src/plugin/collect/system/command/command_base.cpp b/src/plugin/collect/system/command/command_base.cpp +index bf658b8..e6c0a83 100644 +--- a/src/plugin/collect/system/command/command_base.cpp ++++ b/src/plugin/collect/system/command/command_base.cpp +@@ -10,6 +10,7 @@ + * See the Mulan PSL v2 for more details. + ******************************************************************************/ + #include "command_base.h" ++#include + #include + #include + +@@ -59,23 +60,25 @@ CommandBase::CommandBase() + attrsFirst["vmstat"] = {"swpd"}; + } + ++std::vector CommandBase::command{"mpstat", "iostat", "vmstat", "sar", "pidstat"}; ++std::vector CommandBase::illegal{"|", ";", "&", "$", ">", "<", "`", "\n"}; ++ ++bool CommandBase::ValidateCmd(const std::string &cmd) ++{ ++ for (auto word : illegal) { ++ if (strstr(cmd.c_str(), word.c_str())) { ++ return false; ++ } ++ } ++ return true; ++} ++ + bool CommandBase::ValidateArgs(const oeaware::Topic& topic) + { +- auto cmd = GetCommand(topic); +- PopenProcess p; +- p.Popen(cmd); +- if (!p.stream) { ++ if (std::find(command.begin(), command.end(), topic.topicName) == command.end()) { + return false; + } +- char buffer[128]; +- bool isValid = false; +- if (fgets(buffer, sizeof(buffer), p.stream) != nullptr) { +- if (strstr(buffer, "Linux") != nullptr || strstr(buffer, "procs") != nullptr) { +- isValid = true; +- } +- } +- p.Pclose(); +- return isValid; ++ return ValidateCmd(topic.params); + } + + void CommandBase::ParseLine(const std::string& line) +diff --git a/src/plugin/collect/system/command/command_base.h b/src/plugin/collect/system/command/command_base.h +index a6d7627..ef9bd7c 100644 +--- a/src/plugin/collect/system/command/command_base.h ++++ b/src/plugin/collect/system/command/command_base.h +@@ -35,9 +35,12 @@ public: + oeaware::Topic topic; + std::unordered_map> attrsFirst; + std::vector skipLine{"---swap--"}; ++ static std::vector command; ++ static std::vector illegal; + CommandBase(); + virtual ~CommandBase() = default; + static bool ValidateArgs(const oeaware::Topic& topic); ++ static bool ValidateCmd(const std::string &cmd); + void ParseLine(const std::string& line); + static std::string GetCommand(const oeaware::Topic& topic); + bool FillDataStruct(void* dataStruct); +diff --git a/src/plugin/collect/system/command/command_collector.h b/src/plugin/collect/system/command/command_collector.h +index 26fc7e7..72553e3 100644 +--- a/src/plugin/collect/system/command/command_collector.h ++++ b/src/plugin/collect/system/command/command_collector.h +@@ -27,8 +27,7 @@ public: + void Disable() override; + void Run() override; + private: +- std::vector topicStr = {"mpstat", "iostat", "vmstat", "sar", "pidstat", "lscpu", "zone_reclaim_mode", +- "meminfo", "ethtool", "ifconfig", "os-release", "version"}; ++ std::vector topicStr = {"mpstat", "iostat", "vmstat", "sar", "pidstat"}; + std::unordered_map> collectors; + std::unordered_map collectThreads; + std::unordered_map publishThreads; +diff --git a/src/plugin/collect/system/kernel_config.cpp b/src/plugin/collect/system/kernel_config.cpp +index 6bdfc8a..3d25251 100644 +--- a/src/plugin/collect/system/kernel_config.cpp ++++ b/src/plugin/collect/system/kernel_config.cpp +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include "command_base.h" + + KernelConfig::KernelConfig(): oeaware::Interface() + { +@@ -258,12 +259,20 @@ void KernelConfig::WriteSysParam(const std::string &path, const std::string &val + INFO(logger, "successfully wrote value{" << value <<"} to " << path << "."); + } + ++std::vector KernelConfig::cmdGroup{"sysctl", "ifconfig", "/sbin/blockdev"}; ++ + void KernelConfig::SetKernelConfig() + { + for (auto &p : setSystemParams) { + WriteSysParam(p.first, p.second); + } + for (auto &cmd : cmdRun) { ++ auto cmdParts = oeaware::SplitString(cmd, " "); ++ if (cmdParts.empty() || std::find(cmdGroup.begin(), cmdGroup.end(), cmdParts[0]) == cmdGroup.end() || ++ !CommandBase::ValidateCmd(cmd)) { ++ WARN(logger, "cmd{" << cmd << "} invalid."); ++ continue; ++ } + FILE *pipe = popen(cmd.data(), "r"); + if (!pipe) { + WARN(logger, "{" << cmd << "} run failed."); +diff --git a/src/plugin/collect/system/kernel_config.h b/src/plugin/collect/system/kernel_config.h +index aa96886..32049d4 100644 +--- a/src/plugin/collect/system/kernel_config.h ++++ b/src/plugin/collect/system/kernel_config.h +@@ -62,6 +62,7 @@ private: + std::unordered_map kernelParams; + + std::vector cmdRun; ++ static std::vector cmdGroup; + std::vector allEths; + }; + +diff --git a/src/plugin_mgr/event/subscribe_handler.cpp b/src/plugin_mgr/event/subscribe_handler.cpp +index 8697958..f29b455 100644 +--- a/src/plugin_mgr/event/subscribe_handler.cpp ++++ b/src/plugin_mgr/event/subscribe_handler.cpp +@@ -14,24 +14,20 @@ + namespace oeaware { + Result SubscribeHandler::Subscribe(const std::string &name, const Topic &topic) + { +- Result result; + if (!memoryStore->IsInstanceExist(topic.instanceName)) { + WARN(logger, "The subscribed instance " << topic.instanceName << " does not exist."); +- result.code = -1; +- return result; ++ return Result(FAILED, "instance does not exist."); + } + auto instance = memoryStore->GetInstance(topic.instanceName); + if (!instance->supportTopics.count(topic.topicName)) { + WARN(logger, "The subscribed topic " << topic.topicName << " does not exist."); +- result.code = -1; +- return result; ++ return Result(FAILED, "topic does not exist."); + } + auto msg = std::make_shared(RunType::SUBSCRIBE, + std::vector{topic.GetType(), name}); + instanceRunHandler->RecvQueuePush(msg); + msg->Wait(); +- result = msg->result; +- return result; ++ return msg->result; + } + + EventResult SubscribeHandler::Handle(const Event &event) +diff --git a/src/plugin_mgr/instance_run_handler.cpp b/src/plugin_mgr/instance_run_handler.cpp +index 30dc886..abee581 100644 +--- a/src/plugin_mgr/instance_run_handler.cpp ++++ b/src/plugin_mgr/instance_run_handler.cpp +@@ -61,7 +61,8 @@ Result InstanceRunHandler::Subscribe(const std::vector &payload) + if (!topicState[topic.instanceName][topic.topicName][topic.params]) { + result = instance->interface->OpenTopic(topic); + if (result.code < 0) { +- WARN(logger, "topic open failed, " << result.payload); ++ WARN(logger, "topic{" << LogText(topic.instanceName) << ", " << LogText(topic.topicName) << ", " << ++ LogText(topic.params) << "} open failed, " << result.payload); + DisableInstance(instance->name); + return result; + } +-- +2.33.0 + diff --git a/0005-modify-C-interface-name-add-enable-count-and-fix-bug.patch b/0005-modify-C-interface-name-add-enable-count-and-fix-bug.patch new file mode 100644 index 0000000..270322f --- /dev/null +++ b/0005-modify-C-interface-name-add-enable-count-and-fix-bug.patch @@ -0,0 +1,233 @@ +From 1a84134fbe63c1a7bea679b5696bafd99a1b6666 Mon Sep 17 00:00:00 2001 +From: fly_1997 +Date: Sat, 30 Nov 2024 15:25:03 +0800 +Subject: [PATCH 5/5] modify C interface name, add enable count and fix bugs + +--- + src/client/cmd_handler.cpp | 7 ++++--- + src/client/main.cpp | 4 ++-- + src/plugin_mgr/config.cpp | 5 +++++ + src/plugin_mgr/config.h | 1 + + src/plugin_mgr/event/enable_handler.cpp | 3 +++ + src/plugin_mgr/instance_run_handler.cpp | 3 ++- + src/plugin_mgr/plugin.cpp | 2 +- + src/plugin_mgr/plugin.h | 1 + + src/sdk/oe_client.cpp | 14 +++++++++----- + src/sdk/oe_client.h | 10 +++++----- + 10 files changed, 33 insertions(+), 17 deletions(-) + +diff --git a/src/client/cmd_handler.cpp b/src/client/cmd_handler.cpp +index b1e2ba0..289461b 100644 +--- a/src/client/cmd_handler.cpp ++++ b/src/client/cmd_handler.cpp +@@ -33,7 +33,7 @@ void LoadHandler::Handler(Message &msg) + void LoadHandler::ResHandler(Message &msg) + { + if (msg.opt == Opt::RESPONSE_OK) { +- std::cout << "Plugin loaded successfully."; ++ std::cout << "Plugin loaded successfully.\n"; + } else { + std::cout << "Plugin loaded failed, because "<< msg.payload[0] << ".\n"; + } +@@ -54,9 +54,10 @@ void QueryHandler::PrintFormat() + { + std::cout << "format:\n" + "[plugin]\n" +- "\t[instance]([dependency status], [running status])\n" ++ "\t[instance]([dependency status], [running status], [enable cnt])\n" + "dependency status: available means satisfying dependency, otherwise unavailable.\n" +- "running status: running means that instance is running, otherwise close.\n"; ++ "running status: running means that instance is running, otherwise close.\n" ++ "enable cnt: number of instances enabled.\n"; + } + + void QueryHandler::ResHandler(Message &msg) +diff --git a/src/client/main.cpp b/src/client/main.cpp +index 188d5e2..1c50f1a 100644 +--- a/src/client/main.cpp ++++ b/src/client/main.cpp +@@ -41,8 +41,8 @@ int main(int argc, char *argv[]) + std::string analysis = argv[1]; + if (analysis == "analysis") { + CTopic topic = {"analysis_aware", "analysis_aware", ""}; +- Init(); +- Subscribe(&topic, AnalysisCallback); ++ OeInit(); ++ OeSubscribe(&topic, AnalysisCallback); + std::unique_lock lock(g_mutex); + g_cv.wait(lock, []{ return g_finish; }); + return 0; +diff --git a/src/plugin_mgr/config.cpp b/src/plugin_mgr/config.cpp +index 8cd1432..aee3243 100644 +--- a/src/plugin_mgr/config.cpp ++++ b/src/plugin_mgr/config.cpp +@@ -61,6 +61,10 @@ void Config::SetEnableList(const YAML::Node &node) + std::string pluginName = enableList[i]["name"].as(); + YAML::Node instances = enableList[i]["instances"]; + EnableItem enableItem(pluginName); ++ if (!instances.IsSequence()) { ++ WARN(logger, "the format of the enable list is incorrect."); ++ continue; ++ } + if (!instances.IsDefined() || instances.IsNull()) { + enableItem.SetEnabled(true); + } else { +@@ -75,6 +79,7 @@ void Config::SetEnableList(const YAML::Node &node) + + bool Config::Load(const std::string &path) + { ++ logger = Logger::GetInstance().Get("Main"); + YAML::Node node; + struct stat buffer; + if (stat(path.c_str(), &buffer) != 0) { +diff --git a/src/plugin_mgr/config.h b/src/plugin_mgr/config.h +index 19e6d33..dc02b37 100644 +--- a/src/plugin_mgr/config.h ++++ b/src/plugin_mgr/config.h +@@ -127,6 +127,7 @@ private: + std::string logType; + std::unordered_map pluginList; + std::vector enableList; ++ log4cplus::Logger logger; + }; + + std::string GetPath(); +diff --git a/src/plugin_mgr/event/enable_handler.cpp b/src/plugin_mgr/event/enable_handler.cpp +index 66eba6c..a5d8e1a 100644 +--- a/src/plugin_mgr/event/enable_handler.cpp ++++ b/src/plugin_mgr/event/enable_handler.cpp +@@ -29,6 +29,9 @@ ErrorCode EnableHandler::InstanceEnabled(const std::string &name) + instanceRunHandler->RecvQueuePush(msg); + /* Wait for InstanceRunHandler to finsh this task. */ + msg->Wait(); ++ if (msg->result.code < 0) { ++ return ErrorCode::ENABLE_INSTANCE_ENV; ++ } + return ErrorCode::OK; + } + +diff --git a/src/plugin_mgr/instance_run_handler.cpp b/src/plugin_mgr/instance_run_handler.cpp +index abee581..aa428ff 100644 +--- a/src/plugin_mgr/instance_run_handler.cpp ++++ b/src/plugin_mgr/instance_run_handler.cpp +@@ -26,6 +26,7 @@ Result InstanceRunHandler::EnableInstance(const std::string &name) + return result; + } + instance->enabled = true; ++ instance->enableCnt++; + if (instance->interface->GetType() & SCENARIO) { + scheduleQueue.push(ScheduleInstance{instance, time + instance->interface->GetPeriod()}); + } else if (instance->interface->GetType() & TUNE) { +@@ -196,7 +197,7 @@ bool InstanceRunHandler::HandleMessage() + DEBUG(logger, "handle message " << (int)msg->GetType()); + switch (msg->GetType()) { + case RunType::ENABLED: { +- EnableInstance(msg->payload[0]); ++ msg->result = EnableInstance(msg->payload[0]); + break; + } + case RunType::DISABLED: { +diff --git a/src/plugin_mgr/plugin.cpp b/src/plugin_mgr/plugin.cpp +index 5789737..8b894b6 100644 +--- a/src/plugin_mgr/plugin.cpp ++++ b/src/plugin_mgr/plugin.cpp +@@ -72,6 +72,6 @@ std::string Instance::GetInfo() const + { + std::string stateText = this->state ? pluginStateOn : pluginStateOff; + std::string runText = this->enabled ? pluginEnabled : pluginDisabled; +- return name + "(" + stateText + ", " + runText + ")"; ++ return name + "(" + stateText + ", " + runText + ", count: " + std::to_string(enableCnt) + ")"; + } + } +diff --git a/src/plugin_mgr/plugin.h b/src/plugin_mgr/plugin.h +index ef5fc1d..bf63852 100644 +--- a/src/plugin_mgr/plugin.h ++++ b/src/plugin_mgr/plugin.h +@@ -23,6 +23,7 @@ struct Instance { + std::string pluginName; + bool state = true; + bool enabled; ++ uint64_t enableCnt = 0; + std::shared_ptr interface; + std::unordered_map supportTopics; + const static std::string pluginEnabled; +diff --git a/src/sdk/oe_client.cpp b/src/sdk/oe_client.cpp +index 040433a..a9f82ef 100644 +--- a/src/sdk/oe_client.cpp ++++ b/src/sdk/oe_client.cpp +@@ -22,6 +22,7 @@ + namespace oeaware { + class Impl { + public: ++ Impl() noexcept : domainSocket(nullptr), socketStream(nullptr) { } + int Init(); + int Subscribe(const CTopic &topic, Callback callback); + int Unsubscribe(const CTopic &topic); +@@ -114,6 +115,9 @@ int Impl::Init() + int Impl::HandleRequest(const Opt &opt, const std::vector &payload) + { + MessageProtocol protocol(MessageHeader(MessageType::REQUEST), Message(opt, payload)); ++ if (socketStream == nullptr) { ++ return -1; ++ } + SendMessage(*socketStream, protocol); + Result result; + if (!resultQueue->WaitTimeAndPop(result)) { +@@ -166,28 +170,28 @@ void Impl::Close() + + static oeaware::Impl impl; + +-int Init() ++int OeInit() + { + oeaware::Register::GetInstance().InitRegisterData(); + return impl.Init(); + } + +-int Subscribe(const CTopic *topic, Callback callback) ++int OeSubscribe(const CTopic *topic, Callback callback) + { + return impl.Subscribe(*topic, callback); + } + +-int Unsubscribe(const CTopic *topic) ++int OeUnsubscribe(const CTopic *topic) + { + return impl.Unsubscribe(*topic); + } + +-int Publish(const DataList *dataList) ++int OePublish(const DataList *dataList) + { + return impl.Publish(*dataList); + } + +-void Close() ++void OeClose() + { + impl.Close(); + } +diff --git a/src/sdk/oe_client.h b/src/sdk/oe_client.h +index 17d8e68..267462c 100644 +--- a/src/sdk/oe_client.h ++++ b/src/sdk/oe_client.h +@@ -16,11 +16,11 @@ + extern "C" { + #endif + typedef int(*Callback)(const DataList *); +-int Init(); +-int Subscribe(const CTopic *topic, Callback callback); +-int Unsubscribe(const CTopic *topic); +-int Publish(const DataList *dataList); +-void Close(); ++int OeInit(); ++int OeSubscribe(const CTopic *topic, Callback callback); ++int OeUnsubscribe(const CTopic *topic); ++int OePublish(const DataList *dataList); ++void OeClose(); + #ifdef __cplusplus + } + #endif +-- +2.33.0 + diff --git a/oeAware-manager.spec b/oeAware-manager.spec index 7407522..dbc48fe 100644 --- a/oeAware-manager.spec +++ b/oeAware-manager.spec @@ -1,10 +1,15 @@ Name: oeAware-manager Version: v2.0.0 -Release: 1 +Release: 2 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-remove-old-code.patch +Patch2: 0002-add-data-free-and-fix-unsubscribe-error.patch +Patch3: 0003-fix-failed-to-connect-to-the-sdk-and-command-executi.patch +Patch4: 0004-add-command-verification.patch +Patch5: 0005-modify-C-interface-name-add-enable-count-and-fix-bug.patch BuildRequires: cmake make gcc-c++ BuildRequires: boost-devel @@ -76,6 +81,10 @@ if [ "${VERSION}" == "22.03 (LTS-SP4)" ]; then systemctl enable oeaware.service fi +if ! grep -q "oeaware:" /etc/group; then + groupadd oeaware +fi + %files %attr(0750, root, root) %{_bindir}/oeaware %attr(0750, root, root) %{_bindir}/oeawarectl @@ -92,6 +101,10 @@ fi %attr(0440, root, root) %{_includedir}/oeaware/interface/*.h %changelog +* Mon Dec 2 2024 fly_1997 -v2.0.0-2 +- fix data free, plugin display, command plugin bugs +- add oeaware group + * Wed Nov 20 2024 LHesperus -v2.0.0-1 - merge the plugin repository into this repository - add oeaware sdk library