![]() |
MySQL 9.7.0
Source Code Documentation
|
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< std::string > | get_cgroup_path (std::string_view pattern) |
| Determine which cgroup we belong to. More... | |
| static bool | is_valid_path (const std::string_view &path) |
| std::optional< uint64_t > | cgroup_memory (const std::string_view &info_prefix, const std::string &mem_prefix, const std::string &mem_suffix, const bool with_root, std::function< bool(const std::string_view &)> v2_default_handler=nullptr) |
| Read memory limits from cgroups. More... | |
| uint64_t | handle_v1_memory_default (uint64_t memory) |
| Determine if the cgroup v1 memory is the default value and return 0 if it is. More... | |
| std::optional< uint64_t > | cgroup_v1_memory () |
| bool | handle_v2_memory_default (const std::string_view &path) |
| Identify if cgroup v2 memory is the default or if could not be determined. More... | |
| std::optional< uint64_t > | cgroup_v2_memory () |
Variables | |
| constexpr std::string_view | cgroup_info {"/proc/self/cgroup"} |
| Path containing information about which cgroup we belong to. More... | |
| constexpr std::string_view | v1_info_prefix {":memory:"} |
| cgroup v1 pattern to extract cgroup path from cgroup_info More... | |
| const std::string | v1_mem_prefix {"/sys/fs/cgroup/memory"} |
| cgroup v1 prefix to read memory limits More... | |
| const std::string | v1_mem_suffix {"/memory.limit_in_bytes"} |
| cgroup v1 suffix to read memory limits More... | |
| constexpr std::string_view | v2_info_prefix {"0::"} |
| cgroup v2 pattern to extract cgroup path from cgroup_info More... | |
| const std::string | v2_mem_prefix {"/sys/fs/cgroup"} |
| cgroup v2 prefix to read memory limits More... | |
| const std::string | v2_mem_suffix {"/memory.max"} |
| cgroup v2 suffix to read memory limits More... | |
| std::optional< uint64_t > anonymous_namespace{my_system_api_cgroup.cc}::cgroup_memory | ( | const std::string_view & | info_prefix, |
| const std::string & | mem_prefix, | ||
| const std::string & | mem_suffix, | ||
| const bool | with_root, | ||
| std::function< bool(const std::string_view &)> | v2_default_handler = nullptr |
||
| ) |
Read memory limits from cgroups.
This wrapper is common for both cgroup v1, v2
| [in] | info_prefix | Pattern used to extract cgroup from proc/self/cgroup |
| [in] | mem_prefix | cgroup path prefix to identify memory controller |
| [in] | mem_suffix | cgroup path suffix to identify file with memory limit |
| [in] | with_root | True if limits are to be read from root cgroup, false otherwise (read cgroup from info_prefix) |
| [in] | v2_default_handler | Function to handle default memory in cgroup v2 |
| std::optional< uint64_t > anonymous_namespace{my_system_api_cgroup.cc}::cgroup_v1_memory | ( | ) |
| std::optional< uint64_t > anonymous_namespace{my_system_api_cgroup.cc}::cgroup_v2_memory | ( | ) |
| std::optional< std::string > anonymous_namespace{my_system_api_cgroup.cc}::get_cgroup_path | ( | std::string_view | pattern | ) |
Determine which cgroup we belong to.
This is common for cgroup v1 and v2.
| uint64_t anonymous_namespace{my_system_api_cgroup.cc}::handle_v1_memory_default | ( | uint64_t | memory | ) |
Determine if the cgroup v1 memory is the default value and return 0 if it is.
Return the input if it is not the default value or if the default could not be determined.
| [in] | memory | memory read from cgroup v1 paths |
| bool anonymous_namespace{my_system_api_cgroup.cc}::handle_v2_memory_default | ( | const std::string_view & | path | ) |
Identify if cgroup v2 memory is the default or if could not be determined.
| [in] | path | Path to the memory v2 cgroup path |
|
inlinestatic |
| 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.
| [in] | path | Path to file |
| [out] | args | Pass the arguments that you expect to read from the file in the order of their appearance in the file |
|
constexpr |
Path containing information about which cgroup we belong to.
|
constexpr |
cgroup v1 pattern to extract cgroup path from cgroup_info
| const std::string anonymous_namespace{my_system_api_cgroup.cc}::v1_mem_prefix {"/sys/fs/cgroup/memory"} |
cgroup v1 prefix to read memory limits
| const std::string anonymous_namespace{my_system_api_cgroup.cc}::v1_mem_suffix {"/memory.limit_in_bytes"} |
cgroup v1 suffix to read memory limits
|
constexpr |
cgroup v2 pattern to extract cgroup path from cgroup_info
| const std::string anonymous_namespace{my_system_api_cgroup.cc}::v2_mem_prefix {"/sys/fs/cgroup"} |
cgroup v2 prefix to read memory limits
| const std::string anonymous_namespace{my_system_api_cgroup.cc}::v2_mem_suffix {"/memory.max"} |
cgroup v2 suffix to read memory limits