geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Namespaces | Functions
PolicyStore.cpp File Reference
#include "PolicyStore.hpp"
#include <cmath>
#include <memory>
#include "geopm/Exception.hpp"
#include "PolicyStoreImp.hpp"
#include "geopm/Helper.hpp"
#include "geopm_error.h"
#include "geopm_policystore.h"
Include dependency graph for PolicyStore.cpp:

Namespaces

 geopm
 

Functions

int geopm_policystore_connect (const char *data_path)
 Create a geopm policy store interface. More...
 
int geopm_policystore_disconnect ()
 Destroy a geopm policy store interface and release its resources. More...
 
int geopm_policystore_get_best (const char *agent_name, const char *profile_name, size_t max_policy_vals, double *policy_vals)
 Get the best known policy for a given agent and profile. More...
 
int geopm_policystore_set_best (const char *agent_name, const char *profile_name, size_t num_policy_vals, const double *policy_vals)
 Set the best known policy for a given agent and profile. More...
 
int geopm_policystore_set_default (const char *agent_name, size_t num_policy_vals, const double *policy_vals)
 Set the default policy for a given agent. More...
 

Function Documentation

◆ geopm_policystore_connect()

int geopm_policystore_connect ( const char *  data_path)

Create a geopm policy store interface.

Connects to a data store, creating a one if does not exist already.

Parameters
[in]data_pathPath to the data store.
Returns
Zero on success, error code on failure.

◆ geopm_policystore_disconnect()

int geopm_policystore_disconnect ( )

Destroy a geopm policy store interface and release its resources.

Returns
Zero on success, error code on failure.

◆ geopm_policystore_get_best()

int geopm_policystore_get_best ( const char *  agent_name,
const char *  profile_name,
size_t  max_policy_vals,
double *  policy_vals 
)

Get the best known policy for a given agent and profile.

Gets the agent's default policy if no best policy has been reported.

Parameters
[in]agent_nameName of the agent to find.
[in]profile_nameName of the profile to find.
[in]max_policy_valsMaximum number of values that can fit in policy_vals.
[out]policy_valsBest known or default policy.
Returns
Zero on success, error code on failure.

◆ geopm_policystore_set_best()

int geopm_policystore_set_best ( const char *  agent_name,
const char *  profile_name,
size_t  num_policy_vals,
const double *  policy_vals 
)

Set the best known policy for a given agent and profile.

Parameters
[in]profile_nameName of the profile.
[in]agent_nameName of the agent.
[in]num_policy_valsNumber of values in policy_vals.
[in]policy_valsNew policy to apply.
Returns
Zero on success, error code on failure.

◆ geopm_policystore_set_default()

int geopm_policystore_set_default ( const char *  agent_name,
size_t  num_policy_vals,
const double *  policy_vals 
)

Set the default policy for a given agent.

Parameters
[in]agent_nameName of the agent.
[in]num_policy_valsNumber of values in policy_vals.
[in]policy_valsDefault policy to apply.
Returns
Zero on success, error code on failure.