MySQL
9.3.0
Source Code Documentation
my_system.h
Go to the documentation of this file.
1
/* Copyright (c) 2025 Oracle and/or its affiliates.
2
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License, version 2.0,
5
as published by the Free Software Foundation.
6
7
This program is designed to work with certain software (including
8
but not limited to OpenSSL) that is licensed under separate terms,
9
as designated in a particular file or component or in included license
10
documentation. The authors of MySQL hereby grant you an additional
11
permission to link the program and your derivative works with the
12
separately licensed software that they have either included with
13
the program or referenced in the documentation.
14
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License, version 2.0, for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24
#pragma once
25
26
#include <cstdint>
27
28
/**
29
Determine the total physical memory available in bytes.
30
31
If process is running within a container, then memory available is the maximum
32
limit set for the container. If the process is not running in a container then
33
it uses the appropriate system APIs to determine the available memory.
34
35
If the API is unable to determine the available memory, then it returns 0.
36
37
@return physical memory in bytes or 0
38
*/
39
uint64_t
my_physical_memory
() noexcept;
40
41
/**
42
Determine the total number of logical CPUs available.
43
44
If process is running within a container, the number of logical CPUs is the
45
maximum limit set for the container. If the process is not running in a
46
container then it uses the appropriate system APIs to determine the number of
47
logical CPUs.
48
49
If the API is unable to determine the number of logical CPUs, then it returns
50
0.
51
52
@note: The container set limits are calculated from the CFS quota and period
53
as quota/period and is round down. A limit of 0.5 will return the value 0 and
54
is treated as though no limits are set.
55
56
@return number of logical CPUs or 0
57
*/
58
uint32_t
my_num_vcpus
() noexcept;
my_num_vcpus
uint32_t my_num_vcpus() noexcept
Determine the total number of logical CPUs available.
Definition:
my_system.cc:80
my_physical_memory
uint64_t my_physical_memory() noexcept
Determine the total physical memory available in bytes.
Definition:
my_system.cc:51
include
mysql
components
library_mysys
my_system.h
Generated by
1.9.2