![]() |
MySQL 9.4.0
Source Code Documentation
|
Functions to retrieve system information like total physical memory and total number of logical CPUs adhering to limits set by cgroups. More...
#include <cassert>
#include <cstdint>
#include <thread>
#include "my_config.h"
#include "my_system_api/my_system_api.h"
#include "mysql/components/library_mysys/my_system.h"
#include <unistd.h>
Namespaces | |
namespace | anonymous_namespace{my_system.cc} |
Functions | |
static uint64_t | total_physical_memory () noexcept |
Get the total physical memory accessible to the server. More... | |
bool | init_my_physical_memory (ulonglong memory) |
Initialize the my_physical_memory function using server_memory option. 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... | |
Variables | |
ulonglong | anonymous_namespace{my_system.cc}::configured_memory {0} |
Functions to retrieve system information like total physical memory and total number of logical CPUs adhering to limits set by cgroups.
bool init_my_physical_memory | ( | ulonglong | memory | ) |
Initialize the my_physical_memory function using server_memory option.
[in] | memory | Value of the server_memory startup option |
|
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.
|
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.
|
inlinestaticnoexcept |
Get the total physical memory accessible to the server.
Tries to read cgroup limits first. If failed or no limits were found, then tries to read from the system using corresponding system APIs.