diff options
author | Michael Droettboom <mdboom@gmail.com> | 2022-12-12 14:50:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-12 14:50:43 (GMT) |
commit | 1583c6e326a8454d3c806763620e1329bf6b7cbe (patch) | |
tree | d18e4187fa1f991f73d730439325e1532f6ee001 /Python/initconfig.c | |
parent | e4ea33b17807d99ed737f800d9b0006957c008d2 (diff) | |
download | cpython-1583c6e326a8454d3c806763620e1329bf6b7cbe.zip cpython-1583c6e326a8454d3c806763620e1329bf6b7cbe.tar.gz cpython-1583c6e326a8454d3c806763620e1329bf6b7cbe.tar.bz2 |
GH-100143: Improve collecting pystats for parts of runs (GH-100144)
* pystats off by default
* Add -Xpystats flag
* Always dump pystats, even if turned off
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r-- | Python/initconfig.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c index 64ae987..d05099c 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -129,7 +129,14 @@ The following implementation-specific options are available:\n\ \n\ -X int_max_str_digits=number: limit the size of int<->str conversions.\n\ This helps avoid denial of service attacks when parsing untrusted data.\n\ - The default is sys.int_info.default_max_str_digits. 0 disables."; + The default is sys.int_info.default_max_str_digits. 0 disables." + +#ifdef Py_STATS +"\n\ +\n\ +-X pystats: Enable pystats collection at startup." +#endif +; /* Envvars that don't have equivalent command-line options are listed first */ static const char usage_envvars[] = @@ -2186,6 +2193,12 @@ config_read(PyConfig *config, int compute_path_config) config->show_ref_count = 1; } +#ifdef Py_STATS + if (config_get_xoption(config, L"pystats")) { + _py_stats = &_py_stats_struct; + } +#endif + status = config_read_complex_options(config); if (_PyStatus_EXCEPTION(status)) { return status; |