geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Classes | Enumerations | Functions
geopm Namespace Reference

Classes

class  BatchClient
 Interface that will attach to a batch server. The batch server that it connects to is typically created through a call to the GEOPM DBus interface io.github.geopm.PlatformStartBatch. More...
 
class  BatchClientImp
 
class  BatchServer
 
class  BatchServerImp
 
class  BatchStatus
 
class  BatchStatusImp
 
class  BatchStatusServer
 
class  BatchStatusClient
 
class  CNLIOGroup
 IOGroup that wraps interfaces to Compute Node Linux. More...
 
class  CombinedControl
 Used by PlatformIO to define a control as a function of other controls. More...
 
class  CombinedSignal
 Used by PlatformIO to define a signal as a function of other signals. More...
 
class  ConstConfigIOGroup
 
class  Control
 
class  CpufreqSysfsDriver
 Class used to implement the CpufreqSysfsDriverGroup. More...
 
class  CpuidNull
 
class  CpuinfoIOGroup
 IOGroup that provides constants for CPU frequency limits as signals for PlatformIO. More...
 
class  DCGMDevicePool
 
class  DCGMDevicePoolImp
 
class  DCGMIOGroup
 IOGroup that provides signals and controls for DCGM GPUs. More...
 
class  DerivativeSignal
 
class  DifferenceSignal
 
class  DomainControl
 
class  DrmGpuTopo
 
class  DrmSysfsDriver
 Class used to implement the DrmSysfsDriverGroup. More...
 
class  ErrorMessage
 
class  DLRegistry
 
class  GPUTopo
 
class  GPUTopoNull
 
class  IOUring
 
class  IOUringFallback
 Fallback implementation of the IOUring batch interface. This implementation uses queues of individual read/write operations instead of a single batched operation. More...
 
class  IOUringImp
 Implementation of the IOUring batch interface. This implementation batches operations inside io_uring submission queues. More...
 
class  LevelZero
 
class  LevelZeroDevicePool
 
class  LevelZeroDevicePoolImp
 
class  LevelZeroGPUTopo
 
class  LevelZeroImp
 
class  LevelZeroIOGroup
 IOGroup that provides signals and controls for GPUs. More...
 
class  LevelZeroSignal
 
class  MSR
 This class encodes how to access fields within an MSR, but does not hold the state of any registers. More...
 
class  MSRFieldControl
 
class  MSRFieldSignal
 
class  MSRIO
 
struct  json_checker
 Used to validate types and values of JSON objects. More...
 
class  MSRIOGroup
 IOGroup that provides signals and controls based on MSRs. More...
 
class  MSRIOImp
 
class  MSRPath
 
class  MultiplicationSignal
 A composite signal used by an IOGroup to produce a signal as the Multiplication of one signal and a double. More...
 
class  NVMLDevicePool
 
class  NVMLDevicePoolImp
 
class  NVMLGPUTopo
 
class  NVMLIOGroup
 IOGroup that provides signals and controls for NVML GPUs. More...
 
class  PlatformIOImp
 
class  PlatformTopoImp
 
class  POSIXSignal
 
class  POSIXSignalImp
 
class  RatioSignal
 A composite signal used by an IOGroup to produce a signal as the Ratio of two signals. More...
 
class  RawMSRSignal
 
class  RuntimeStats
 Class that aggregates statistics without buffered data. More...
 
class  SDBus
 Abstraction around sd_bus interface for calling methods. More...
 
class  SDBusImp
 
class  SDBusMessage
 Abstraction around sd_bus interfaces that read from or append to sd_bus_message types. More...
 
class  SDBusMessageImp
 
class  SecurePath
 Helper object to optionally verify that a file was created with a. More...
 
class  ServiceIOGroup
 IOGroup that uses DBus interface to access geopmd provided signals and controls. This IOGroup is not loaded by a server side PlatformIO object. More...
 
class  SharedMemoryImp
 
class  Signal
 
class  SSTControl
 
class  SSTIO
 
struct  sst_version_s
 SST Version information. More...
 
struct  sst_cpu_map_interface_s
 A single mapping of logical CPU index to punit CPU. More...
 
struct  sst_cpu_map_interface_batch_s
 
struct  sst_mmio_interface_s
 A single MMIO operation. More...
 
struct  sst_mmio_interface_batch_s
 
struct  sst_mbox_interface_s
 A single mailbox operation. More...
 
struct  sst_mbox_interface_batch_s
 
class  SSTIoctl
 Defines functions that interact directly with SST ioctls. More...
 
class  SSTIoctlImp
 
class  SSTIOGroup
 IOGroup that provides a signal for the time since GEOPM startup. More...
 
class  SSTIOImp
 
class  SSTSignal
 
class  StatsCollector
 Class that accumulates statistics based on PlatformIO requests. More...
 
class  StatsCollectorImp
 
class  SysfsDriver
 Class used to implement the SysfsIOGroup base class. More...
 
class  SysfsIOGroup
 
class  TimeIOGroup
 IOGroup that provides a signal for the time since GEOPM startup. More...
 
class  TimeSignal
 
class  TimeZero
 
class  UniqueFd
 A wrapper to close a file descriptor when the descriptor goes out of scope. More...
 
class  Agg
 
class  CircularBuffer
 Templated container for a circular buffer implementation. The CircularBuffer container implements a fixed size buffer. Once at capacity, any new insertions cause the oldest entry to be dropped. More...
 
class  Cpuid
 
class  Exception
 Class for all GEOPM-specific exceptions. More...
 
class  DeprecationWarning
 
class  IOGroup
 
class  IOGroupFactory
 
class  PlatformIO
 Class which is a collection of all valid control and signal objects for a platform. More...
 
class  PlatformTopo
 
class  PluginFactory
 
class  SaveControl
 Class that enables the save/restore feature for IOGroups. More...
 
class  SaveControlImp
 
struct  signal_info_s
 Information pertaining to a particular signal supported by PlatformIO. More...
 
struct  control_info_s
 Information pertaining to a particular control supported by PlatformIO. More...
 
class  ServiceProxy
 Proxy object for the io.github.geopm D-Bus interface used to implement the ServiceIOGroup. More...
 
class  ServiceProxyImp
 
class  SharedMemory
 This class encapsulates an inter-process shared memory region. More...
 
class  SharedMemoryScopedLock
 An object used to automatically hold a SharedMemory mutex while in scope, and release it when out of scope. More...
 

Enumerations

enum  string_format_e { STRING_FORMAT_DOUBLE , STRING_FORMAT_INTEGER , STRING_FORMAT_HEX , STRING_FORMAT_RAW64 }
 

Functions

std::vector< double > nan_filter (const std::vector< double > &operand)
 
const std::string cpufreq_sysfs_json (void)
 
DCGMDevicePooldcgm_device_pool ()
 
const std::string drm_sysfs_json (void)
 
std::string error_message (int error_value)
 Function that converts an error code into an error message. More...
 
int exception_handler (std::exception_ptr eptr, bool do_print=false)
 Handle a thrown exception and return an error value. More...
 
uint64_t hash (const std::string &key)
 
void plugin_load (const std::string &plugin_prefix)
 
void plugin_reset (void)
 
std::string shmem_path_prof (const std::string &shm_key, int pid, int uid)
 
void shmem_create_prof (const std::string &shm_key, size_t size, int pid, int uid, int gid)
 
std::string version (void)
 
std::vector< int > shared_object_version (void)
 
void check_hint (uint64_t hint)
 
const GPUTopogpu_topo (void)
 
std::string read_file (const std::string &path)
 Reads the specified file and returns the contents in a string. More...
 
double read_double_from_file (const std::string &path, const std::string &expected_units)
 Read a file and return a double read from the file. More...
 
void write_file (const std::string &path, const std::string &contents)
 Writes a string to a file. This will replace the file if it exists or create it if it does not exist. More...
 
std::vector< std::string > string_split (const std::string &str, const std::string &delim)
 Splits a string according to a delimiter. More...
 
std::string string_join (const std::vector< std::string > &string_list, const std::string &delim)
 Joins a vector of strings together with a delimiter. More...
 
std::string hostname (void)
 Returns the current hostname as a string. More...
 
std::vector< std::string > list_directory_files (const std::string &path)
 List all files in the given directory. More...
 
bool string_begins_with (const std::string &str, const std::string &key)
 Returns whether one string begins with another. More...
 
bool string_ends_with (std::string str, std::string key)
 Returns whether one string ends with another. More...
 
std::string string_format_double (double signal)
 Format a string to best represent a signal encoding a double precision floating point number. More...
 
std::string string_format_float (double signal)
 Format a string to best represent a signal encoding a single precision floating point number. More...
 
std::string string_format_integer (double signal)
 Format a string to best represent a signal encoding a decimal integer. More...
 
std::string string_format_hex (double signal)
 Format a string to best represent a signal encoding an unsigned hexadecimal integer. More...
 
std::string string_format_raw64 (double signal)
 Format a string to represent the raw memory supporting a signal as an unsigned hexadecimal integer. More...
 
std::function< std::string(double)> string_format_type_to_function (int format_type)
 Convert a format type enum string_format_e to a format function. More...
 
std::function< std::string(double)> string_format_name_to_function (const std::string &format_name)
 Convert a format function to a format name to a format function. More...
 
int string_format_function_to_type (std::function< std::string(double)> format_function)
 Convert a format function to a format type enum string_format_e. More...
 
std::string get_env (const std::string &name)
 Read an environment variable. More...
 
int verbosity_level (void)
 Query environment for verbosity level. More...
 
unsigned int pid_to_uid (const int pid)
 Query for the user id associated with the process id. More...
 
unsigned int pid_to_gid (const int pid)
 Query for the group id associated with the process id. More...
 
std::unique_ptr< cpu_set_t, std::function< void(cpu_set_t *)> > make_cpu_set (int num_cpu, const std::set< int > &cpu_enabled)
 Wrapper around CPU_ALLOC and CPU_FREE. More...
 
bool has_cap_sys_admin (void)
 Check if the caller has effective capability CAP_SYS_ADMIN. More...
 
bool has_cap_sys_admin (int pid)
 Check if the pid has effective capability CAP_SYS_ADMIN. More...
 
std::string read_symlink_target (const std::string &symlink_path)
 
void enable_fixed_counters (PlatformIO &pio)
 
IOGroupFactoryiogroup_factory (void)
 
const LevelZerolevelzero ()
 
const LevelZeroDevicePoollevelzero_device_pool ()
 
const std::string arch_msr_json (void)
 
const std::string knl_msr_json (void)
 
const std::string hsx_msr_json (void)
 
const std::string snb_msr_json (void)
 
const std::string skx_msr_json (void)
 
const std::string spr_msr_json (void)
 
void check_expected_key_values (const Json &root, const std::map< std::string, json_checker > &required_key_map, const std::map< std::string, json_checker > &optional_key_map, const std::string &loc_message)
 
NVMLDevicePoolnvml_device_pool (const int num_cpu)
 
PlatformIOplatform_io (void)
 
const PlatformTopoplatform_topo (void)
 
struct geopm_time_s time_zero (void)
 
void time_zero_reset (const geopm_time_s &zero)
 
struct geopm_time_s time_curr (void)
 
struct geopm_time_s time_curr_real (void)
 
std::string time_curr_string (void)
 
template<class Type , class ... Args>
std::unique_ptr< Type > make_unique (Args &&...args)
 Implementation of std::make_unique (C++14) for C++11. Note that this version will only work for non-array types. More...
 

Enumeration Type Documentation

◆ string_format_e

Enumerator
STRING_FORMAT_DOUBLE 
STRING_FORMAT_INTEGER 
STRING_FORMAT_HEX 
STRING_FORMAT_RAW64 

Function Documentation

◆ arch_msr_json()

const std::string geopm::arch_msr_json ( void  )

◆ check_expected_key_values()

void geopm::check_expected_key_values ( const Json &  root,
const std::map< std::string, json_checker > &  required_key_map,
const std::map< std::string, json_checker > &  optional_key_map,
const std::string &  loc_message 
)

◆ check_hint()

void geopm::check_hint ( uint64_t  hint)

◆ cpufreq_sysfs_json()

const std::string geopm::cpufreq_sysfs_json ( void  )

◆ dcgm_device_pool()

DCGMDevicePool & geopm::dcgm_device_pool ( )

◆ drm_sysfs_json()

const std::string geopm::drm_sysfs_json ( void  )

◆ enable_fixed_counters()

void GEOPM_PUBLIC geopm::enable_fixed_counters ( PlatformIO pio)

Enable MSR fixed counters.

Parameters
[in]pioReference to the PlatformIO object used to write the registers.

◆ error_message()

std::string GEOPM_PUBLIC geopm::error_message ( int  error_value)

Function that converts an error code into an error message.

Parameters
error_valueThe error code associated with the exception.
Returns
string The error message associated with the error code.

◆ exception_handler()

int GEOPM_PUBLIC geopm::exception_handler ( std::exception_ptr  eptr,
bool  do_print = false 
)

Handle a thrown exception and return an error value.

This exception handler is used by every GEOPM C interface to handle any exceptions that are thrown during execution of a C++ implementation. If GEOPM has been configured with debugging enabled, then this handler will print an explanatory message to standard error. In all cases it will convert the C++ exception into an error number which can be used with geopm_error_message() to obtain an error message. Note that the error message printed when debugging is enabled has more specific information than the message produced by geopm_error_message().

Parameters
[in]eptrA pointer to a thrown exception such as std::current_exception().
[in]do_printA bool specifying whether or not to print a debug string to standard error when handling exception.
Returns
Error number, positive numbers are system errors, negative numbers are GEOPM errors.

◆ get_env()

std::string GEOPM_PUBLIC geopm::get_env ( const std::string &  name)

Read an environment variable.

Parameters
[in]Thename of the environment variable to read.
Returns
The contents of the variable if present, otherwise an empty string.

◆ gpu_topo()

const GPUTopo & geopm::gpu_topo ( void  )

◆ has_cap_sys_admin() [1/2]

bool GEOPM_PUBLIC geopm::has_cap_sys_admin ( int  pid)

Check if the pid has effective capability CAP_SYS_ADMIN.

Parameters
[in]pidLinux PID to check
Returns
True if the PID has CAP_SYS_ADMIN

◆ has_cap_sys_admin() [2/2]

bool GEOPM_PUBLIC geopm::has_cap_sys_admin ( void  )

Check if the caller has effective capability CAP_SYS_ADMIN.

Returns
True if the PID has CAP_SYS_ADMIN

◆ hash()

uint64_t geopm::hash ( const std::string &  key)

◆ hostname()

std::string GEOPM_PUBLIC geopm::hostname ( void  )

Returns the current hostname as a string.

◆ hsx_msr_json()

const std::string geopm::hsx_msr_json ( void  )

◆ iogroup_factory()

IOGroupFactory GEOPM_PUBLIC & geopm::iogroup_factory ( void  )

◆ knl_msr_json()

const std::string geopm::knl_msr_json ( void  )

◆ levelzero()

const LevelZero & geopm::levelzero ( )

◆ levelzero_device_pool()

const LevelZeroDevicePool & geopm::levelzero_device_pool ( )

◆ list_directory_files()

std::vector< std::string > GEOPM_PUBLIC geopm::list_directory_files ( const std::string &  path)

List all files in the given directory.

Parameters
[in]pathPath to the directory.

◆ make_cpu_set()

std::unique_ptr< cpu_set_t, std::function< void(cpu_set_t *)> > GEOPM_PUBLIC geopm::make_cpu_set ( int  num_cpu,
const std::set< int > &  cpu_enabled 
)

Wrapper around CPU_ALLOC and CPU_FREE.

Parameters
[in]num_cpuThe number of CPUs to allocate the CPU set
[in]cpu_enabledThe CPUs to be included in the CPU set
Returns
A std::unique_ptr to a cpu_set_t configured to use CPU_FREE as the deleter.

◆ make_unique()

template<class Type , class ... Args>
std::unique_ptr<Type> geopm::make_unique ( Args &&...  args)

Implementation of std::make_unique (C++14) for C++11. Note that this version will only work for non-array types.

◆ nan_filter()

std::vector<double> geopm::nan_filter ( const std::vector< double > &  operand)

◆ nvml_device_pool()

NVMLDevicePool & geopm::nvml_device_pool ( const int  num_cpu)

◆ pid_to_gid()

unsigned int GEOPM_PUBLIC geopm::pid_to_gid ( const int  pid)

Query for the group id associated with the process id.

Parameters
[in]pidThe process id to query.
Returns
The group id.

◆ pid_to_uid()

unsigned int GEOPM_PUBLIC geopm::pid_to_uid ( const int  pid)

Query for the user id associated with the process id.

Parameters
[in]pidThe process id to query.
Returns
The user id.

◆ platform_io()

PlatformIO GEOPM_PUBLIC & geopm::platform_io ( void  )

◆ platform_topo()

const PlatformTopo GEOPM_PUBLIC & geopm::platform_topo ( void  )

◆ plugin_load()

void GEOPM_PUBLIC geopm::plugin_load ( const std::string &  plugin_prefix)

◆ plugin_reset()

void GEOPM_PUBLIC geopm::plugin_reset ( void  )

◆ read_double_from_file()

double GEOPM_PUBLIC geopm::read_double_from_file ( const std::string &  path,
const std::string &  expected_units 
)

Read a file and return a double read from the file.

If a double cannot be read from the file or the units reported in the file do not match the expected units, an exception is thrown.

Parameters
[in]pathThe path of the file to read.
[in]expected_unitsExpected units to follow the double. Provide an empty string if no units are expected.
Returns
The value read from the file.

◆ read_file()

std::string GEOPM_PUBLIC geopm::read_file ( const std::string &  path)

Reads the specified file and returns the contents in a string.

Parameters
[in]pathThe path of the file to read.
Returns
The contents of the file at path.

◆ read_symlink_target()

std::string GEOPM_PUBLIC geopm::read_symlink_target ( const std::string &  symlink_path)

Read a symlink, returning the target path contained in the symlink.

Parameters
[in]symlink_pathPath to the symlink

◆ shared_object_version()

std::vector<int> geopm::shared_object_version ( void  )

◆ shmem_create_prof()

void geopm::shmem_create_prof ( const std::string &  shm_key,
size_t  size,
int  pid,
int  uid,
int  gid 
)

◆ shmem_path_prof()

std::string geopm::shmem_path_prof ( const std::string &  shm_key,
int  pid,
int  uid 
)

◆ skx_msr_json()

const std::string geopm::skx_msr_json ( void  )

◆ snb_msr_json()

const std::string geopm::snb_msr_json ( void  )

◆ spr_msr_json()

const std::string geopm::spr_msr_json ( void  )

◆ string_begins_with()

bool GEOPM_PUBLIC geopm::string_begins_with ( const std::string &  str,
const std::string &  key 
)

Returns whether one string begins with another.

◆ string_ends_with()

bool GEOPM_PUBLIC geopm::string_ends_with ( std::string  str,
std::string  key 
)

Returns whether one string ends with another.

◆ string_format_double()

std::string GEOPM_PUBLIC geopm::string_format_double ( double  signal)

Format a string to best represent a signal encoding a double precision floating point number.

Parameters
[in]signalA real number that requires many significant digits to accurately represent.
Returns
A well-formatted string representation of the signal.

◆ string_format_float()

std::string GEOPM_PUBLIC geopm::string_format_float ( double  signal)

Format a string to best represent a signal encoding a single precision floating point number.

Parameters
[in]signalA real number that requires a few significant digits to accurately represent.
Returns
A well formatted string representation of the signal.

◆ string_format_function_to_type()

int GEOPM_PUBLIC geopm::string_format_function_to_type ( std::function< std::string(double)>  format_function)

Convert a format function to a format type enum string_format_e.

◆ string_format_hex()

std::string GEOPM_PUBLIC geopm::string_format_hex ( double  signal)

Format a string to best represent a signal encoding an unsigned hexadecimal integer.

Parameters
[in]signalAn unsigned integer that is best represented as a hexadecimal number and has been assigned to a double precision number
Returns
A well formatted string representation of the signal.

◆ string_format_integer()

std::string GEOPM_PUBLIC geopm::string_format_integer ( double  signal)

Format a string to best represent a signal encoding a decimal integer.

Parameters
[in]signalAn integer that is best represented as a decimal number.
Returns
A well formatted string representation of the signal.

◆ string_format_name_to_function()

std::function< std::string(double)> GEOPM_PUBLIC geopm::string_format_name_to_function ( const std::string &  format_name)

Convert a format function to a format name to a format function.

◆ string_format_raw64()

std::string GEOPM_PUBLIC geopm::string_format_raw64 ( double  signal)

Format a string to represent the raw memory supporting a signal as an unsigned hexadecimal integer.

Parameters
[in]signalA 64-bit unsigned integer that has been byte-wise copied into the memory of signal.
Returns
A well formatted string representation of the signal.

◆ string_format_type_to_function()

std::function< std::string(double)> GEOPM_PUBLIC geopm::string_format_type_to_function ( int  format_type)

Convert a format type enum string_format_e to a format function.

◆ string_join()

std::string GEOPM_PUBLIC geopm::string_join ( const std::vector< std::string > &  string_list,
const std::string &  delim 
)

Joins a vector of strings together with a delimiter.

Parameters
[in]string_listThe list of strings to be joined.
[in]delimThe delimiter to use to join the strings.
Returns
The joined string.

◆ string_split()

std::vector< std::string > GEOPM_PUBLIC geopm::string_split ( const std::string &  str,
const std::string &  delim 
)

Splits a string according to a delimiter.

Parameters
[in]strThe string to be split.
[in]delimThe delimiter to use to divide the string. Cannot be empty.
Returns
A vector of string pieces.

◆ time_curr()

struct geopm_time_s geopm::time_curr ( void  )

◆ time_curr_real()

struct geopm_time_s geopm::time_curr_real ( void  )

◆ time_curr_string()

std::string geopm::time_curr_string ( void  )

◆ time_zero()

struct geopm_time_s geopm::time_zero ( void  )

◆ time_zero_reset()

void geopm::time_zero_reset ( const geopm_time_s zero)

◆ verbosity_level()

int GEOPM_PUBLIC geopm::verbosity_level ( void  )

Query environment for verbosity level.

Read GEOPM_VERBOSITY environment variable. If set, convert to integer. If unset, or conversion fails, returns default value. The default value is 0 unless the GEOPM software is compiled with –enable-debug configuration. When debug is enabled at compile time, the default value is 2.

Level 0: Print errors and critical warning messages Level 1: Print warning messages Level 2: Print diagnostic info messages

Returns
Verbosity level for GEOPM messaging

◆ version()

std::string geopm::version ( void  )

◆ write_file()

void GEOPM_PUBLIC geopm::write_file ( const std::string &  path,
const std::string &  contents 
)

Writes a string to a file. This will replace the file if it exists or create it if it does not exist.

Parameters
[in]pathThe path to the file to write to.
[in]contentsThe string to write to the file.