MySQL 9.6.0
Source Code Documentation
my_system_api.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/**
27 Determines if the current process is running in a container.
28 @return true if running in either cgroup v1 or cgroup v2, false otherwise
29*/
31
32/**
33 Determines if cgroup restricts resources
34 @return true if cgroup restricts resources like CPU or memory
35*/
37
38/**
39 Read the memory limit set by the container. Try cgroup v2, and then cgroup v1
40 @return memory limit set by cgroup v2 or cgroup v1; or 0
41 @note Return value of 0 implies either no limits are set or server is not
42 running in a container
43*/
44uint64_t my_cgroup_mem_limit();
45
46/**
47 Read the CPU limit set by the container. Try cgroup v2, and then cgroup v1
48 @return CPU limit set by cgroup v2 or cgroup v1; or 0
49 @note Return value of 0 implies either no limits are set or server is not
50 running in a container
51*/
52uint32_t my_cgroup_vcpu_limit();
53
54/**
55 Find number of VCPUs as seen by the current process based on the
56 affinity between each process and VCPU.
57*/
59
60/**
61 Get the number of VCPUS based on system configuration.
62*/
63uint32_t num_vcpus_using_config();
64
65/**
66 Get the number of VCPU.
67*/
68uint32_t my_system_num_vcpus();
uint64_t my_cgroup_mem_limit()
Read the memory limit set by the container.
Definition: my_system_api_cgroup.cc:182
bool does_cgroup_limit_resources()
Determines if cgroup restricts resources.
Definition: my_system_api_cgroup.cc:162
uint32_t my_system_num_vcpus()
Get the number of VCPU.
Definition: my_system_api_common.cc:35
uint32_t num_vcpus_using_config()
Get the number of VCPUS based on system configuration.
Definition: my_system_api_apple.cc:38
uint32_t my_cgroup_vcpu_limit()
Read the CPU limit set by the container.
Definition: my_system_api_cgroup.cc:193
uint32_t num_vcpus_using_affinity()
Find number of VCPUs as seen by the current process based on the affinity between each process and VC...
Definition: my_system_api_apple.cc:36
bool is_running_in_cgroup()
Determines if the current process is running in a container.
Definition: my_system_api_cgroup.cc:157