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>
This commit is contained in:
Donghee Na 2023-10-10 19:00:09 +09:00 committed by GitHub
parent 5aa62a8de1
commit 0362cbf908
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 192 additions and 11 deletions

View file

@ -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
};