Use templates for module population
Also add stddef.h workaround for old GCC.
RHEL-8 still uses GCC 8.5 and templates are not well supported.
Change-Id: Ia4dae23892ec63682ea848c46ba81de85cf6d209
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
[ROCm/rdc commit: f9e80cc37a]
This commit is contained in:
@@ -28,7 +28,6 @@ THE SOFTWARE.
|
||||
#include <vector>
|
||||
|
||||
#include "rdc_lib/RdcDiagnostic.h"
|
||||
#include "rdc_lib/RdcMetricFetcher.h"
|
||||
#include "rdc_lib/RdcTelemetryLibInterface.h"
|
||||
|
||||
namespace amd {
|
||||
@@ -52,7 +51,7 @@ class RdcDiagnosticModule : public RdcDiagnostic {
|
||||
rdc_status_t rdc_diag_init(uint64_t flags) override;
|
||||
rdc_status_t rdc_diag_destroy() override;
|
||||
|
||||
explicit RdcDiagnosticModule(RdcMetricFetcherPtr& fetcher);
|
||||
explicit RdcDiagnosticModule(std::list<RdcDiagnosticPtr> diagnostic_modules);
|
||||
|
||||
private:
|
||||
//< Helper function to dispatch fields to module
|
||||
|
||||
@@ -22,7 +22,7 @@ THE SOFTWARE.
|
||||
#ifndef INCLUDE_RDC_LIB_IMPL_RDCMODULEMGRIMPL_H_
|
||||
#define INCLUDE_RDC_LIB_IMPL_RDCMODULEMGRIMPL_H_
|
||||
|
||||
#include <memory>
|
||||
#include <list>
|
||||
|
||||
#include "rdc_lib/RdcMetricFetcher.h"
|
||||
#include "rdc_lib/RdcModuleMgr.h"
|
||||
@@ -38,6 +38,22 @@ class RdcModuleMgrImpl : public RdcModuleMgr {
|
||||
explicit RdcModuleMgrImpl(const RdcMetricFetcherPtr& fetcher);
|
||||
|
||||
private:
|
||||
// Modules
|
||||
std::list<RdcDiagnosticPtr> diagnostic_modules_;
|
||||
std::list<RdcTelemetryPtr> telemetry_modules_;
|
||||
|
||||
// base case
|
||||
template <typename T>
|
||||
rdc_status_t insert_modules();
|
||||
|
||||
// recursive case
|
||||
template <typename T, typename R, typename... TArgs>
|
||||
rdc_status_t insert_modules();
|
||||
|
||||
// pass shared_ptr instead of creating it
|
||||
template <typename T>
|
||||
rdc_status_t insert_modules(std::shared_ptr<T> ptr);
|
||||
|
||||
// Function module
|
||||
RdcTelemetryPtr rdc_telemetry_module_;
|
||||
RdcDiagnosticPtr rdc_diagnostic_module_;
|
||||
|
||||
@@ -23,7 +23,6 @@ THE SOFTWARE.
|
||||
#define INCLUDE_RDC_LIB_IMPL_RDCRVSLIB_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "rdc/rdc.h"
|
||||
#include "rdc_lib/RdcDiagnostic.h"
|
||||
@@ -51,7 +50,6 @@ class RdcRVSLib : public RdcDiagnostic {
|
||||
rdc_status_t rdc_diag_destroy() override;
|
||||
|
||||
RdcRVSLib();
|
||||
|
||||
~RdcRVSLib() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -49,7 +49,7 @@ class RdcRocpLib : public RdcTelemetry {
|
||||
rdc_status_t rdc_telemetry_fields_unwatch(rdc_gpu_field_t* fields,
|
||||
uint32_t fields_count) override;
|
||||
|
||||
explicit RdcRocpLib(const char* lib_name);
|
||||
RdcRocpLib();
|
||||
|
||||
~RdcRocpLib();
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ THE SOFTWARE.
|
||||
#define INCLUDE_RDC_LIB_IMPL_RDCSMILIB_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "rdc_lib/RdcDiagnostic.h"
|
||||
#include "rdc_lib/RdcMetricFetcher.h"
|
||||
|
||||
@@ -47,7 +47,7 @@ class RdcTelemetryModule : public RdcTelemetry {
|
||||
|
||||
rdc_status_t rdc_telemetry_fields_unwatch(rdc_gpu_field_t* fields, uint32_t fields_count);
|
||||
|
||||
explicit RdcTelemetryModule(RdcMetricFetcherPtr fetcher);
|
||||
explicit RdcTelemetryModule(std::list<RdcTelemetryPtr> telemetry_modules);
|
||||
|
||||
private:
|
||||
//< Helper function to dispatch fields to module
|
||||
|
||||
Reference in New Issue
Block a user