geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
geopm_endpoint.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef GEOPM_ENDPOINT_H_INCLUDE
7 #define GEOPM_ENDPOINT_H_INCLUDE
8 
9 #include <stddef.h>
10 
11 #include "geopm_public.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 static const size_t GEOPM_ENDPOINT_AGENT_NAME_MAX = 256;
18 static const size_t GEOPM_ENDPOINT_PROFILE_NAME_MAX = 256;
19 static const size_t GEOPM_ENDPOINT_HOSTLIST_PATH_MAX = 512;
20 
21 struct geopm_endpoint_c;
22 
34 int GEOPM_PUBLIC
35  geopm_endpoint_create(const char *endpoint_name, struct geopm_endpoint_c **endpoint);
36 
48 int GEOPM_PUBLIC
49  geopm_endpoint_destroy(struct geopm_endpoint_c *endpoint);
50 
60 int GEOPM_PUBLIC
61  geopm_endpoint_open(struct geopm_endpoint_c *endpoint);
62 
71 int GEOPM_PUBLIC
72  geopm_endpoint_close(struct geopm_endpoint_c *endpoint);
73 
92 int GEOPM_PUBLIC
93  geopm_endpoint_agent(struct geopm_endpoint_c *endpoint, size_t agent_name_max,
94  char *agent_name);
95 
105 int GEOPM_PUBLIC
106  geopm_endpoint_wait_for_agent_attach(struct geopm_endpoint_c *endpoint, double timeout);
107 
114 int GEOPM_PUBLIC
115  geopm_endpoint_stop_wait_loop(struct geopm_endpoint_c *endpoint);
116 
124 int GEOPM_PUBLIC
125  geopm_endpoint_reset_wait_loop(struct geopm_endpoint_c *endpoint);
126 
146 int GEOPM_PUBLIC
147  geopm_endpoint_profile_name(struct geopm_endpoint_c *endpoint, size_t profile_name_max,
148  char *profile_name);
149 
162 int GEOPM_PUBLIC
163  geopm_endpoint_num_node(struct geopm_endpoint_c *endpoint, int *num_node);
164 
182 int GEOPM_PUBLIC
183  geopm_endpoint_node_name(struct geopm_endpoint_c *endpoint, int node_idx,
184  size_t node_name_max, char *node_name);
185 
199 int GEOPM_PUBLIC
200  geopm_endpoint_write_policy(struct geopm_endpoint_c *endpoint,
201  size_t num_policy, const double *policy_array);
202 
220 int GEOPM_PUBLIC
221  geopm_endpoint_read_sample(struct geopm_endpoint_c *endpoint, size_t num_sample,
222  double *sample_array, double *sample_age_sec);
223 
224 #ifdef __cplusplus
225 }
226 #endif
227 #endif
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.
Definition: Endpoint.cpp:354
int GEOPM_PUBLIC geopm_endpoint_create(const char *endpoint_name, struct geopm_endpoint_c **endpoint)
Create an endpoint object for other API functions.
Definition: Endpoint.cpp:246
int GEOPM_PUBLIC geopm_endpoint_stop_wait_loop(struct geopm_endpoint_c *endpoint)
Stops any current wait loops the endpoint is running.
Definition: Endpoint.cpp:327
int GEOPM_PUBLIC geopm_endpoint_num_node(struct geopm_endpoint_c *endpoint, int *num_node)
Get the number of nodes managed by the agent.
Definition: Endpoint.cpp:370
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().
Definition: Endpoint.cpp:340
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.
Definition: Endpoint.cpp:411
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.
Definition: Endpoint.cpp:313
int GEOPM_PUBLIC geopm_endpoint_destroy(struct geopm_endpoint_c *endpoint)
Release resources associated with endpoint.
Definition: Endpoint.cpp:259
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.
Definition: Endpoint.cpp:385
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 updat...
Definition: Endpoint.cpp:427
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.
Definition: Endpoint.cpp:297
int GEOPM_PUBLIC geopm_endpoint_close(struct geopm_endpoint_c *endpoint)
Destroy shmem regions within the endpoint.
Definition: Endpoint.cpp:284
int GEOPM_PUBLIC geopm_endpoint_open(struct geopm_endpoint_c *endpoint)
Create shmem regions within the endpoint for policy/sample handling.
Definition: Endpoint.cpp:271