summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2023-10-10 10:00:09 (GMT)
committerGitHub <noreply@github.com>2023-10-10 10:00:09 (GMT)
commit0362cbf908aff2b87298f8a9422e7b368f890071 (patch)
tree7d5ae0e1f44801fe2102cb783938c60ef99b7ae4 /Python/sysmodule.c
parent5aa62a8de15212577a13966710b3aede46e93824 (diff)
downloadcpython-0362cbf908aff2b87298f8a9422e7b368f890071.zip
cpython-0362cbf908aff2b87298f8a9422e7b368f890071.tar.gz
cpython-0362cbf908aff2b87298f8a9422e7b368f890071.tar.bz2
gh-109595: Add -Xcpu_count=<n> cmdline for container users (#109667)
--------- Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index a7ce07d..3debe7f 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -2306,6 +2306,20 @@ sys__getframemodulename_impl(PyObject *module, int depth)
return Py_NewRef(r);
}
+/*[clinic input]
+sys._get_cpu_count_config -> int
+
+Private function for getting PyConfig.cpu_count
+[clinic start generated code]*/
+
+static int
+sys__get_cpu_count_config_impl(PyObject *module)
+/*[clinic end generated code: output=36611bb5efad16dc input=523e1ade2204084e]*/
+{
+ const PyConfig *config = _Py_GetConfig();
+ return config->cpu_count;
+}
+
static PerfMapState perf_map_state;
PyAPI_FUNC(int) PyUnstable_PerfMapState_Init(void) {
@@ -2440,6 +2454,7 @@ static PyMethodDef sys_methods[] = {
SYS__STATS_CLEAR_METHODDEF
SYS__STATS_DUMP_METHODDEF
#endif
+ SYS__GET_CPU_COUNT_CONFIG_METHODDEF
{NULL, NULL} // sentinel
};