oeAware-manager/0001-remove-old-code.patch
fly_1997 8c2082720c fix data free, plugin display, command plugin bugs
(cherry picked from commit 2ca264904491e249e48381aa6f19969427484d0a)
2024-12-06 15:53:22 +08:00

2099 lines
56 KiB
Diff

From a7893161786a6195cbb97d82969a49e02e56adac Mon Sep 17 00:00:00 2001
From: fly_1997 <flylove7@outlook.com>
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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <securec.h>
-#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 <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <securec.h>
-#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 <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <securec.h>
-#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 <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <securec.h>
-#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 <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <securec.h>
-#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 <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <securec.h>
-#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 <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <securec.h>
-#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 <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <securec.h>
-#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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <securec.h>
-#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