geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Functions
geopm_endpoint.h File Reference
#include <stddef.h>
#include "geopm_public.h"
Include dependency graph for geopm_endpoint.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int GEOPM_PUBLIC geopm_endpoint_create (const char *endpoint_name, struct geopm_endpoint_c **endpoint)
 Create an endpoint object for other API functions. More...
 
int GEOPM_PUBLIC geopm_endpoint_destroy (struct geopm_endpoint_c *endpoint)
 Release resources associated with endpoint. More...
 
int GEOPM_PUBLIC geopm_endpoint_open (struct geopm_endpoint_c *endpoint)
 Create shmem regions within the endpoint for policy/sample handling. More...
 
int GEOPM_PUBLIC geopm_endpoint_close (struct geopm_endpoint_c *endpoint)
 Destroy shmem regions within the endpoint. More...
 
int GEOPM_PUBLIC geopm_endpoint_agent (struct geopm_endpoint_c *endpoint, size_t agent_name_max, char *agent_name)
 Check if an agent has attached. More...
 
int GEOPM_PUBLIC geopm_endpoint_wait_for_agent_attach (struct geopm_endpoint_c *endpoint, double timeout)
 Blocks until an agent has attached or the timeout is reached. More...
 
int GEOPM_PUBLIC geopm_endpoint_stop_wait_loop (struct geopm_endpoint_c *endpoint)
 Stops any current wait loops the endpoint is running. More...
 
int GEOPM_PUBLIC geopm_endpoint_reset_wait_loop (struct geopm_endpoint_c *endpoint)
 Resets the endpoint to prepare for a subsequent call to geopm_endpoint_wait_for_agent_attach(). More...
 
int GEOPM_PUBLIC geopm_endpoint_profile_name (struct geopm_endpoint_c *endpoint, size_t profile_name_max, char *profile_name)
 Check profile name for an attached job. More...
 
int GEOPM_PUBLIC geopm_endpoint_num_node (struct geopm_endpoint_c *endpoint, int *num_node)
 Get the number of nodes managed by the agent. More...
 
int GEOPM_PUBLIC geopm_endpoint_node_name (struct geopm_endpoint_c *endpoint, int node_idx, size_t node_name_max, char *node_name)
 Get the hostname of the indexed compute node. More...
 
int GEOPM_PUBLIC geopm_endpoint_write_policy (struct geopm_endpoint_c *endpoint, size_t num_policy, const double *policy_array)
 Set the policy values for the agent to follow. More...
 
int GEOPM_PUBLIC geopm_endpoint_read_sample (struct geopm_endpoint_c *endpoint, size_t num_sample, double *sample_array, double *sample_age_sec)
 Get a sample from the agent and amount of time that has passed since the agent last provided an update. More...
 

Function Documentation

◆ geopm_endpoint_agent()

int GEOPM_PUBLIC geopm_endpoint_agent ( struct geopm_endpoint_c *  endpoint,
size_t  agent_name_max,
char *  agent_name 
)

Check if an agent has attached.

Parameters
[in]endpointObject created by call to geopm_endpoint_create().
[in]agent_name_maxNumber of bytes allocated for the agent_name string.
[out]agent_nameName of agent if one has attached to the endpoint. If no agent has attached string is unaltered.
Returns
Zero if endpoint has an agent attached and agent name can be stored in provided buffer, error code otherwise. If no agent has attached, error code GEOPM_ERROR_NO_AGENT is returned.

◆ geopm_endpoint_close()

int GEOPM_PUBLIC geopm_endpoint_close ( struct geopm_endpoint_c *  endpoint)

Destroy shmem regions within the endpoint.

Parameters
[in]endpointObject created by call to geopm_endpoint_create().
Returns
Zero on success, error code on failure.

◆ geopm_endpoint_create()

int GEOPM_PUBLIC geopm_endpoint_create ( const char *  endpoint_name,
struct geopm_endpoint_c **  endpoint 
)

Create an endpoint object for other API functions.

Parameters
[in]endpoint_nameShared memory key substring used to create an endpoint that an agent can attach to.
[out]endpointOpaque pointer to geopm_endpoint_c object, or NULL upon failure.
Returns
Zero on success, error code on failure.

◆ geopm_endpoint_destroy()

int GEOPM_PUBLIC geopm_endpoint_destroy ( struct geopm_endpoint_c *  endpoint)

Release resources associated with endpoint.

Additionally will send a signal to the agent that the manager is detaching from the policy and will no longer send updates.

Parameters
[in]endpointObject to be destroyed which was previously created by call to geopm_endpoint_create().
Returns
Zero on success, error code on failure.

◆ geopm_endpoint_node_name()

int GEOPM_PUBLIC geopm_endpoint_node_name ( struct geopm_endpoint_c *  endpoint,
int  node_idx,
size_t  node_name_max,
char *  node_name 
)

Get the hostname of the indexed compute node.

Parameters
[in]endpointObject created by call to geopm_endpoint_create() that has reported an attached agent.
[in]node_idxthe index from zero to the value returned by geopm_agent_num_node() - 1.
[in]node_name_maxNumber of bytes allocated for the node_name string.
[out]node_nameThe compute node hostname.
Returns
Zero on success, error code on failure

◆ geopm_endpoint_num_node()

int GEOPM_PUBLIC geopm_endpoint_num_node ( struct geopm_endpoint_c *  endpoint,
int *  num_node 
)

Get the number of nodes managed by the agent.

Parameters
[in]endpointObject created by call to geopm_endpoint_create() that has reported an attached agent.
[out]num_nodeNumber of compute nodes controlled by attached agent.
Returns
Zero on success, error code on failure.

◆ geopm_endpoint_open()

int GEOPM_PUBLIC geopm_endpoint_open ( struct geopm_endpoint_c *  endpoint)

Create shmem regions within the endpoint for policy/sample handling.

Parameters
[in]endpointObject created by call to geopm_endpoint_create().
Returns
Zero on success, error code on failure.

◆ geopm_endpoint_profile_name()

int GEOPM_PUBLIC geopm_endpoint_profile_name ( struct geopm_endpoint_c *  endpoint,
size_t  profile_name_max,
char *  profile_name 
)

Check profile name for an attached job.

Parameters
[in]endpointObject created by call to geopm_endpoint_create().
[in]profile_name_maxNumber of bytes allocated for the profile_name string.
[out]profile_nameProfile name of the job if one has attached to the endpoint. If no agent has attached string is unaltered.
Returns
Zero if endpoint has an agent attached and profile name can be stored in provided buffer, error code otherwise. If no agent has attached, error code GEOPM_ERROR_NO_AGENT is returned.

◆ geopm_endpoint_read_sample()

int GEOPM_PUBLIC geopm_endpoint_read_sample ( struct geopm_endpoint_c *  endpoint,
size_t  num_sample,
double *  sample_array,
double *  sample_age_sec 
)

Get a sample from the agent and amount of time that has passed since the agent last provided an update.

Parameters
[in]endpointObject created by call to geopm_endpoint_create() that has reported an attached agent that provides samples (i.e. value given by geopm_agent_num_sample() is greater than zero).
[out]sample_arrayArray of sampled values provide by the agent.
[out]timestampThe timestamp of the agent's last update to the sample.
Returns
Zero on success, error code on failure

◆ geopm_endpoint_reset_wait_loop()

int GEOPM_PUBLIC geopm_endpoint_reset_wait_loop ( struct geopm_endpoint_c *  endpoint)

Resets the endpoint to prepare for a subsequent call to geopm_endpoint_wait_for_agent_attach().

Parameters
[in]endpointObject created by call to geopm_endpoint_create().

◆ geopm_endpoint_stop_wait_loop()

int GEOPM_PUBLIC geopm_endpoint_stop_wait_loop ( struct geopm_endpoint_c *  endpoint)

Stops any current wait loops the endpoint is running.

Parameters
[in]endpointObject created by call to geopm_endpoint_create().

◆ geopm_endpoint_wait_for_agent_attach()

int GEOPM_PUBLIC geopm_endpoint_wait_for_agent_attach ( struct geopm_endpoint_c *  endpoint,
double  timeout 
)

Blocks until an agent has attached or the timeout is reached.

Parameters
[in]endpointObject created by call to geopm_endpoint_create().
[in]timeoutTimeout in seconds.

◆ geopm_endpoint_write_policy()

int GEOPM_PUBLIC geopm_endpoint_write_policy ( struct geopm_endpoint_c *  endpoint,
size_t  num_policy,
const double *  policy_array 
)

Set the policy values for the agent to follow.

Parameters
[in]endpointObject created by call to geopm_endpoint_create() that has reported an attached agent.
[in]policy_arrayArray of length returned by geopm_agent_num_policy() specifying the value of each policy parameter.
Returns
Zero on success, error code on failure