* Copyright (c) 2025 Huawei Technologies Co., Ltd.
* This file is part of the MindStudio project.
*
* MindStudio 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 ANALYSIS_DOMAIN_SYS_IO_PROCESSOR_H
#define ANALYSIS_DOMAIN_SYS_IO_PROCESSOR_H
#include "analysis/csrc/domain/data_process/data_processor.h"
#include "analysis/csrc/domain/entities/viewer_data/system/include/sys_io_data.h"
#include "analysis/csrc/infrastructure/utils/time_utils.h"
namespace Analysis {
namespace Domain {
using namespace Analysis::Utils;
using OriSysIOData = std::vector<std::tuple<double, uint32_t, double, double, uint32_t,
uint32_t, uint32_t, uint32_t, double, double, uint32_t, uint32_t, uint32_t, uint32_t, uint16_t>>;
using OriSysIOReportData = std::vector<std::tuple<double, uint64_t, double, double, double,
double, double, double, double, double, uint16_t>>;
using OriSysIOReceiveSendData = std::vector<std::tuple<double, double, double, double, double,
double, double, double, double, uint16_t>>;
class SysIOProcessor : public DataProcessor {
public:
SysIOProcessor() = default;
explicit SysIOProcessor(const std::string &profPath, const std::string &processorName);
private:
bool Process(DataInventory& dataInventory) override;
bool ProcessSingleDevice(const std::string &devicePath,
std::vector<SysIOOriginalData> &timelineData, std::vector<SysIOReportData> &summaryData);
bool ProcessTimelineData(const DBInfo &sysIODB, LocaltimeContext &localtimeContext,
std::vector<SysIOOriginalData> &timelineData);
bool ProcessSummaryData(const DBInfo &sysIODB, const LocaltimeContext &localtimeContext,
std::vector<SysIOReportData> &summaryData);
bool SaveData(std::vector<SysIOOriginalData> &timelineData, std::vector<SysIOReportData> &summaryData,
DataInventory& dataInventory);
private:
std::string processorName_;
};
class NicProcessor : public SysIOProcessor {
public:
NicProcessor() = default;
NicProcessor(const std::string &profPath);
};
class RoCEProcessor : public SysIOProcessor {
public:
RoCEProcessor() = default;
RoCEProcessor(const std::string &profPath);
};
class SysIOTimelineProcessor : public DataProcessor {
public:
SysIOTimelineProcessor() = default;
explicit SysIOTimelineProcessor(const std::string &profPath, const std::string &processorName);
private:
bool Process(DataInventory& dataInventory) override;
bool ProcessSingleDevice(const std::string &devicePath, std::vector<SysIOReceiveSendData> &allProcessedData);
OriSysIOReceiveSendData LoadData(const DBInfo &sysIOReceiveSendDB);
std::vector<SysIOReceiveSendData> FormatData(const OriSysIOReceiveSendData &oriData,
const LocaltimeContext &localtimeContext);
private:
std::string processorName_;
};
class NicTimelineProcessor : public SysIOTimelineProcessor {
public:
NicTimelineProcessor() = default;
NicTimelineProcessor(const std::string &profPath);
};
class RoCETimelineProcessor : public SysIOTimelineProcessor {
public:
RoCETimelineProcessor() = default;
RoCETimelineProcessor(const std::string &profPath);
};
}
}
#endif