Enable RDC policy feature
1. Add policy APIs 2. Add policy example for policy API usage Change-Id: I14deb7c809d0b865b7bb083842092fc37868025e Signed-off-by: Chao Fei <Chao.Fei@amd.com>
This commit is contained in:
@@ -24,6 +24,8 @@ THE SOFTWARE.
|
||||
#include <grpcpp/grpcpp.h>
|
||||
|
||||
#include <memory>
|
||||
#include <future>
|
||||
#include <thread>
|
||||
|
||||
#include "rdc.grpc.pb.h" // NOLINT
|
||||
#include "rdc_lib/RdcHandler.h"
|
||||
@@ -89,6 +91,18 @@ class RdcStandaloneHandler : public RdcHandler {
|
||||
// It is just a client interface under the GRPC framework and is not used as an RDC API.
|
||||
// Pure virtual functions need to be overridden
|
||||
rdc_status_t get_mixed_component_version(mixed_component_t component, mixed_component_version_t* p_mixed_compv) override;
|
||||
// Policy API
|
||||
rdc_status_t rdc_policy_set(rdc_gpu_group_t group_id, rdc_policy_t policy) override;
|
||||
|
||||
rdc_status_t rdc_policy_get(rdc_gpu_group_t group_id, uint32_t* count, rdc_policy_t policies[RDC_MAX_POLICY_SETTINGS]) override;
|
||||
|
||||
rdc_status_t rdc_policy_delete(rdc_gpu_group_t group_id,
|
||||
rdc_policy_condition_type_t condition_type) override;
|
||||
|
||||
rdc_status_t rdc_policy_register(rdc_gpu_group_t group_id,
|
||||
rdc_policy_register_callback callback) override;
|
||||
|
||||
rdc_status_t rdc_policy_unregister(rdc_gpu_group_t group_id) override;
|
||||
|
||||
explicit RdcStandaloneHandler(const char* ip_and_port, const char* root_ca,
|
||||
const char* client_cert, const char* client_key);
|
||||
@@ -100,6 +114,15 @@ class RdcStandaloneHandler : public RdcHandler {
|
||||
bool copy_gpu_usage_info(const ::rdc::GpuUsageInfo& src, rdc_gpu_usage_info_t* target);
|
||||
|
||||
std::unique_ptr<::rdc::RdcAPI::Stub> stub_;
|
||||
// thread for policy callback
|
||||
|
||||
struct policy_thread_context {
|
||||
bool start;
|
||||
std::thread *t;
|
||||
};
|
||||
|
||||
std::map<uint32_t, struct policy_thread_context> policy_threads_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace rdc
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user