MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
anonymous_namespace{my_system_api_cgroup.cc} Namespace Reference

Functions

template<typename... Args>
bool read_line_from_file (const std::string_view &path, Args &...args)
 Utility: Read the first line from the file specified in path and copy its contents into the arguments passed. More...
 
std::optional< uint32_t > cgroup_v1_cpu ()
 Read CPU limits as if it were set by cgroup v1. More...
 
std::optional< uint64_t > cgroup_v1_memory ()
 Read memory limits as if it were set by cgroup v1. More...
 
std::optional< uint32_t > cgroup_v2_cpu ()
 Read CPU limits as if it were set by cgroup v2. More...
 
std::optional< uint64_t > cgroup_v2_memory ()
 Read Memory limits as if it were set by cgroup v2. More...
 

Variables

constexpr std::string_view quota_path {"/sys/fs/cgroup/cpu/cpu.cfs_quota_us"}
 cgroup v1 path to file containing CPU quota More...
 
constexpr std::string_view period_path {"/sys/fs/cgroup/cpu/cpu.cfs_period_us"}
 cgroup v1 path to file containing CPU period More...
 
constexpr std::string_view mem_path_v1
 cgroup v1 path to file containing Memory limits More...
 
constexpr std::string_view cpu_path_v2 {"/sys/fs/cgroup/cpu.max"}
 cgroup v2 path to file containing CPU limts More...
 
constexpr std::string_view mem_path_v2 {"/sys/fs/cgroup/memory.max"}
 cgroup v2 path to file containing Memory limits More...
 

Function Documentation

◆ cgroup_v1_cpu()

std::optional< uint32_t > anonymous_namespace{my_system_api_cgroup.cc}::cgroup_v1_cpu ( )

Read CPU limits as if it were set by cgroup v1.

Returns
CPU limits set by cgroup v1 or std::nullopt on failure
Note
Return value of 0.0 implies no limits are set

◆ cgroup_v1_memory()

std::optional< uint64_t > anonymous_namespace{my_system_api_cgroup.cc}::cgroup_v1_memory ( )

Read memory limits as if it were set by cgroup v1.

Returns
Memory limits set by cgroup v1 or std::nullopt on failure
Note
Return value of 0.0 implies no limits are set

◆ cgroup_v2_cpu()

std::optional< uint32_t > anonymous_namespace{my_system_api_cgroup.cc}::cgroup_v2_cpu ( )

Read CPU limits as if it were set by cgroup v2.

Returns
CPU limits set by cgroup v2 or std::nullopt on failure
Note
Return value of 0.0 implies no limits are set

◆ cgroup_v2_memory()

std::optional< uint64_t > anonymous_namespace{my_system_api_cgroup.cc}::cgroup_v2_memory ( )

Read Memory limits as if it were set by cgroup v2.

Returns
Memory limits set by cgroup v2 or std::nullopt on failure
Note
Return value of 0.0 implies no limits are set

◆ read_line_from_file()

template<typename... Args>
bool anonymous_namespace{my_system_api_cgroup.cc}::read_line_from_file ( const std::string_view &  path,
Args &...  args 
)

Utility: Read the first line from the file specified in path and copy its contents into the arguments passed.

Parameters
[in]pathPath to file
[out]argsPass the arguments that you expect to read from the file in the order of their appearance in the file
Returns
true if able to read and parse the file, false otherwise

Variable Documentation

◆ cpu_path_v2

constexpr std::string_view anonymous_namespace{my_system_api_cgroup.cc}::cpu_path_v2 {"/sys/fs/cgroup/cpu.max"}
constexpr

cgroup v2 path to file containing CPU limts

◆ mem_path_v1

constexpr std::string_view anonymous_namespace{my_system_api_cgroup.cc}::mem_path_v1
constexpr
Initial value:
{
"/sys/fs/cgroup/memory/memory.limit_in_bytes"}

cgroup v1 path to file containing Memory limits

◆ mem_path_v2

constexpr std::string_view anonymous_namespace{my_system_api_cgroup.cc}::mem_path_v2 {"/sys/fs/cgroup/memory.max"}
constexpr

cgroup v2 path to file containing Memory limits

◆ period_path

constexpr std::string_view anonymous_namespace{my_system_api_cgroup.cc}::period_path {"/sys/fs/cgroup/cpu/cpu.cfs_period_us"}
constexpr

cgroup v1 path to file containing CPU period

◆ quota_path

constexpr std::string_view anonymous_namespace{my_system_api_cgroup.cc}::quota_path {"/sys/fs/cgroup/cpu/cpu.cfs_quota_us"}
constexpr

cgroup v1 path to file containing CPU quota