MySQL 9.6.0
Source Code Documentation
my_system.h File Reference
#include <cstdint>
#include <string>

Go to the source code of this file.

Typedefs

using ulonglong = unsigned long long
 

Functions

bool init_my_physical_memory (ulonglong memory)
 Initialize the my_physical_memory function using server_memory option. More...
 
bool init_my_physical_memory (const std::string &memory)
 Overloaded function for easy use. More...
 
uint64_t my_physical_memory () noexcept
 Determine the total physical memory available in bytes. More...
 
uint32_t my_num_vcpus () noexcept
 Determine the total number of logical CPUs available. More...
 
bool init_container_aware (const bool is_container_aware) noexcept
 Determine if resource limits set by container must be respected and checks the correctness of the configurations. More...
 
bool init_container_aware (const std::string &is_container_aware) noexcept
 Overloaded function for easy use. More...
 
void deinit_container_aware () noexcept
 Release internal state and deinitialize container awareness. More...
 
bool has_container_resource_limits ()
 Determines if container configurations has set resource limits. More...
 

Typedef Documentation

◆ ulonglong

using ulonglong = unsigned long long

Function Documentation

◆ deinit_container_aware()

void deinit_container_aware ( )
noexcept

Release internal state and deinitialize container awareness.

◆ has_container_resource_limits()

bool has_container_resource_limits ( )

Determines if container configurations has set resource limits.

Returns
true if container configuration resource limits

◆ init_container_aware() [1/2]

bool init_container_aware ( const bool  is_container_aware)
noexcept

Determine if resource limits set by container must be respected and checks the correctness of the configurations.

Initializes internal state with input

Parameters
[in]is_container_awaretrue if container config must be respected
Returns
true if container configurations are correct, false otherwise

◆ init_container_aware() [2/2]

bool init_container_aware ( const std::string &  is_container_aware)
noexcept

Overloaded function for easy use.

Parameters
[in]is_container_awarestring considered to be true if "ON", false otherwise
Returns
true if container configurations are correct, false otherwise

◆ init_my_physical_memory() [1/2]

bool init_my_physical_memory ( const std::string &  memory)

Overloaded function for easy use.

Parameters
[in]memorystring containing value of server_memory
Returns
true on success, false if input memory value is invalid

◆ init_my_physical_memory() [2/2]

bool init_my_physical_memory ( ulonglong  memory)

Initialize the my_physical_memory function using server_memory option.

Parameters
[in]memoryValue of the server_memory startup option
Note
The input value of 0 indicates no limits, and underlying container/host configuration must be used
Returns
true on success, false if input memory value is invalid

◆ my_num_vcpus()

uint32_t my_num_vcpus ( )
noexcept

Determine the total number of logical CPUs available.

If process is running within a container, the number of logical CPUs is the maximum limit set for the container. If the process is not running in a container then it uses the appropriate system APIs to determine the number of logical CPUs.

If the API is unable to determine the number of logical CPUs, then it returns 0.

Note
: The container set limits are calculated from the CFS quota and period as quota/period and is round down. A limit of 0.5 will return the value 0 and is treated as though no limits are set.
Returns
number of logical CPUs or 0

◆ my_physical_memory()

uint64_t my_physical_memory ( )
noexcept

Determine the total physical memory available in bytes.

If process is running within a container, then memory available is the maximum limit set for the container. If the process is not running in a container then it uses the appropriate system APIs to determine the available memory.

If the API is unable to determine the available memory, then it returns 0.

Returns
physical memory in bytes or 0