geopm
3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
|
#include "geopm_endpoint.h"
#include "EndpointImp.hpp"
#include <cmath>
#include <cstring>
#include <unistd.h>
#include <algorithm>
#include <string>
#include <fstream>
#include <thread>
#include <chrono>
#include <stdexcept>
#include "geopm/Environment.hpp"
#include "geopm/SharedMemory.hpp"
#include "geopm/Exception.hpp"
#include "geopm/Helper.hpp"
#include "geopm/Agent.hpp"
Namespaces | |
geopm | |
Functions | |
int | geopm_endpoint_create (const char *endpoint_name, geopm_endpoint_c **endpoint) |
Create an endpoint object for other API functions. More... | |
int | geopm_endpoint_destroy (struct geopm_endpoint_c *endpoint) |
Release resources associated with endpoint. More... | |
int | geopm_endpoint_open (struct geopm_endpoint_c *endpoint) |
Create shmem regions within the endpoint for policy/sample handling. More... | |
int | geopm_endpoint_close (struct geopm_endpoint_c *endpoint) |
Destroy shmem regions within the endpoint. More... | |
int | 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_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_endpoint_stop_wait_loop (struct geopm_endpoint_c *endpoint) |
Stops any current wait loops the endpoint is running. More... | |
int | 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_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_endpoint_num_node (struct geopm_endpoint_c *endpoint, int *num_node) |
Get the number of nodes managed by the agent. More... | |
int | 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_endpoint_write_policy (struct geopm_endpoint_c *endpoint, size_t agent_num_policy, const double *policy_array) |
Set the policy values for the agent to follow. More... | |
int | geopm_endpoint_read_sample (struct geopm_endpoint_c *endpoint, size_t agent_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... | |
int geopm_endpoint_agent | ( | struct geopm_endpoint_c * | endpoint, |
size_t | agent_name_max, | ||
char * | agent_name | ||
) |
Check if an agent has attached.
[in] | endpoint | Object created by call to geopm_endpoint_create(). |
[in] | agent_name_max | Number of bytes allocated for the agent_name string. |
[out] | agent_name | Name of agent if one has attached to the endpoint. If no agent has attached string is unaltered. |
int geopm_endpoint_close | ( | struct geopm_endpoint_c * | endpoint | ) |
Destroy shmem regions within the endpoint.
[in] | endpoint | Object created by call to geopm_endpoint_create(). |
int geopm_endpoint_create | ( | const char * | endpoint_name, |
struct geopm_endpoint_c ** | endpoint | ||
) |
Create an endpoint object for other API functions.
[in] | endpoint_name | Shared memory key substring used to create an endpoint that an agent can attach to. |
[out] | endpoint | Opaque pointer to geopm_endpoint_c object, or NULL upon failure. |
int 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.
[in] | endpoint | Object to be destroyed which was previously created by call to geopm_endpoint_create(). |
int 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.
[in] | endpoint | Object created by call to geopm_endpoint_create() that has reported an attached agent. |
[in] | node_idx | the index from zero to the value returned by geopm_agent_num_node() - 1. |
[in] | node_name_max | Number of bytes allocated for the node_name string. |
[out] | node_name | The compute node hostname. |
int geopm_endpoint_num_node | ( | struct geopm_endpoint_c * | endpoint, |
int * | num_node | ||
) |
Get the number of nodes managed by the agent.
[in] | endpoint | Object created by call to geopm_endpoint_create() that has reported an attached agent. |
[out] | num_node | Number of compute nodes controlled by attached agent. |
int geopm_endpoint_open | ( | struct geopm_endpoint_c * | endpoint | ) |
Create shmem regions within the endpoint for policy/sample handling.
[in] | endpoint | Object created by call to geopm_endpoint_create(). |
int geopm_endpoint_profile_name | ( | struct geopm_endpoint_c * | endpoint, |
size_t | profile_name_max, | ||
char * | profile_name | ||
) |
Check profile name for an attached job.
[in] | endpoint | Object created by call to geopm_endpoint_create(). |
[in] | profile_name_max | Number of bytes allocated for the profile_name string. |
[out] | profile_name | Profile name of the job if one has attached to the endpoint. If no agent has attached string is unaltered. |
int 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.
[in] | endpoint | Object 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_array | Array of sampled values provide by the agent. |
[out] | timestamp | The timestamp of the agent's last update to the sample. |
int 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().
[in] | endpoint | Object created by call to geopm_endpoint_create(). |
int geopm_endpoint_stop_wait_loop | ( | struct geopm_endpoint_c * | endpoint | ) |
Stops any current wait loops the endpoint is running.
[in] | endpoint | Object created by call to geopm_endpoint_create(). |
int geopm_endpoint_wait_for_agent_attach | ( | struct geopm_endpoint_c * | endpoint, |
double | timeout | ||
) |
Blocks until an agent has attached or the timeout is reached.
[in] | endpoint | Object created by call to geopm_endpoint_create(). |
[in] | timeout | Timeout in seconds. |
int 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.
[in] | endpoint | Object created by call to geopm_endpoint_create() that has reported an attached agent. |
[in] | policy_array | Array of length returned by geopm_agent_num_policy() specifying the value of each policy parameter. |