geopm
Functions
geopm_agent.h File Reference
#include <stddef.h>
Include dependency graph for geopm_agent.h:

Go to the source code of this file.

Functions

int geopm_agent_supported (const char *agent_name)
 Query if system supports an agent type. More...
 
int geopm_agent_num_policy (const char *agent_name, int *num_policy)
 Get number of policy parameters supported by agent. More...
 
int geopm_agent_policy_name (const char *agent_name, int policy_idx, size_t policy_name_max, char *policy_name)
 Get the name of a policy parameter. More...
 
int geopm_agent_policy_json (const char *agent_name, const double *policy_array, size_t json_string_max, char *json_string)
 Create a json file to control agent policy statically. More...
 
int geopm_agent_policy_json_partial (const char *agent_name, size_t policy_array_size, const double *policy_array, size_t json_string_max, char *json_string)
 Create a json file to control agent policy statically. More...
 
int geopm_agent_num_sample (const char *agent_name, int *num_sample)
 The number of sampled parameters provided by agent. More...
 
int geopm_agent_sample_name (const char *agent_name, int sample_idx, size_t sample_name_max, char *sample_name)
 The name of the indexed sample value. More...
 
int geopm_agent_num_avail (int *num_agent)
 The number of available agents. More...
 
int geopm_agent_name (int agent_idx, size_t agent_name_max, char *agent_name)
 The name of a specific agent. More...
 
int geopm_agent_enforce_policy (void)
 Enforce a static implementation of the agent's policy. The agent and the policy are chosen based on the GEOPM environment variables and configuration files. More...
 

Function Documentation

◆ geopm_agent_enforce_policy()

int geopm_agent_enforce_policy ( void  )

Enforce a static implementation of the agent's policy. The agent and the policy are chosen based on the GEOPM environment variables and configuration files.

Returns
Zero on success, error code on failure.

◆ geopm_agent_name()

int geopm_agent_name ( int  agent_idx,
size_t  agent_name_max,
char *  agent_name 
)

The name of a specific agent.

Parameters
[in]agent_idxThe index of the agent in question.
[in]agent_name_maxNumber of bytes allocated for the agent_name string.
[out]agent_nameThe name of the agent parameter provided by the indexed entry when the geopm_endpoint_num_agent() function is called. String is unmodified if an error condition occurs.
Returns
Zero if agent_name is large enough to hold the name, error code otherwise.

◆ geopm_agent_num_avail()

int geopm_agent_num_avail ( int *  num_agent)

The number of available agents.

Parameters
[out]num_agentThe number of agents currently available.
Returns
Zero if no error occured. Otherwise the error code will be returned.

◆ geopm_agent_num_policy()

int geopm_agent_num_policy ( const char *  agent_name,
int *  num_policy 
)

Get number of policy parameters supported by agent.

Parameters
[in]agent_namename of agent type.
[out]num_policyNumber of policy parameters required by agent.
Returns
Zero if agent is supported, error code otherwise.

◆ geopm_agent_num_sample()

int geopm_agent_num_sample ( const char *  agent_name,
int *  num_sample 
)

The number of sampled parameters provided by agent.

Parameters
[in]agent_nameName of agent type.
[out]num_sampleThe number of values provided by the agent when the geopm_agent_sample_name() function is called.
Returns
Zero on success, error code on failure.

◆ geopm_agent_policy_json()

int geopm_agent_policy_json ( const char *  agent_name,
const double *  policy_array,
size_t  json_string_max,
char *  json_string 
)

Create a json file to control agent policy statically.

Parameters
[in]agent_nameName of agent type.
[in]policy_arrayValues for each of the policy parameters supported by the agent, array length is determined by the geopm_agent_num_policy() function.
[in]json_string_maxNumber of bytes allocated for json_string output.
[out]json_stringBuffer that will be populated with JSON that can be used to create a policy file.
Returns
Zero on success, error code on failure.

◆ geopm_agent_policy_json_partial()

int geopm_agent_policy_json_partial ( const char *  agent_name,
size_t  policy_array_size,
const double *  policy_array,
size_t  json_string_max,
char *  json_string 
)

Create a json file to control agent policy statically.

Parameters
[in]agent_nameName of agent type.
[in]policy_array_sizeNumber of policy parameters in the array. The number of policies passed must be less than or equal to the number returned by the geopm_agent_num_policy() function.
[in]policy_arrayValues for each of the policy parameters.
[in]json_string_maxNumber of bytes allocated for json_string output.
[out]json_stringBuffer that will be populated with JSON that can be used to create a policy file.
Returns
Zero on success, error code on failure.

◆ geopm_agent_policy_name()

int geopm_agent_policy_name ( const char *  agent_name,
int  policy_idx,
size_t  policy_name_max,
char *  policy_name 
)

Get the name of a policy parameter.

Parameters
[in]agent_nameName of agent type.
[in]policy_idxIndex into policy vector.
[in]policy_name_maxNumber of bytes allocated for the policy_name string.
[out]policy_nameThe name of the policy controlled by the indexed entry. String is unmodified if an error condition occurs.
Returns
Zero if agent is supported, policy_idx in range, and policy name can be stored in output string, error code otherwise.

◆ geopm_agent_sample_name()

int geopm_agent_sample_name ( const char *  agent_name,
int  sample_idx,
size_t  sample_name_max,
char *  sample_name 
)

The name of the indexed sample value.

Parameters
[in]agent_nameName of agent type.
[in]sample_idxIndex into sampled parameters.
[in]sample_name_maxNumber of bytes allocated for the sample_name string.
[out]sample_nameThe name of the sample parameter provided by the indexed entry when the geopm_agent_sample_name() function is called. String is unmodified if an error condition occurs.
Returns
Zero if agent is supported, error code otherwise.

◆ geopm_agent_supported()

int geopm_agent_supported ( const char *  agent_name)

Query if system supports an agent type.

Parameters
[in]agent_nameName of agent type.
Returns
Zero if agent is supported, error code otherwise.