MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
my_system.h File Reference
#include <cstdint>

Go to the source code of this file.

Functions

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...
 

Function Documentation

◆ 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