mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-108753: Enhance pystats (#108754)
Statistics gathering is now off by default. Use the "-X pystats" command line option or set the new PYTHONSTATS environment variable to 1 to turn statistics gathering on at Python startup. Statistics are no longer dumped at exit if statistics gathering was off or statistics have been cleared. Changes: * Add PYTHONSTATS environment variable. * sys._stats_dump() now returns False if statistics are not dumped because they are all equal to zero. * Add PyConfig._pystats member. * Add tests on sys functions and on setting PyConfig._pystats to 1. * Add Include/cpython/pystats.h and Include/internal/pycore_pystats.h header files. * Rename '_py_stats' variable to '_Py_stats'. * Exclude Include/cpython/pystats.h from the Py_LIMITED_API. * Move pystats.h include from object.h to Python.h. * Add _Py_StatsOn() and _Py_StatsOff() functions. Remove '_py_stats_struct' variable from the API: make it static in specialize.c. * Document API in Include/pystats.h and Include/cpython/pystats.h. * Complete pystats documentation in Doc/using/configure.rst. * Don't write "all zeros" stats: if _stats_off() and _stats_clear() or _stats_dump() were called. * _PyEval_Fini() now always call _Py_PrintSpecializationStats() which does nothing if stats are all zeros. Co-authored-by: Michael Droettboom <mdboom@gmail.com>
This commit is contained in:
parent
8ff1142578
commit
a0773b89df
19 changed files with 403 additions and 184 deletions
|
@ -176,6 +176,7 @@
|
|||
<ClInclude Include="..\Include\cpython\pylifecycle.h" />
|
||||
<ClInclude Include="..\Include\cpython\pymem.h" />
|
||||
<ClInclude Include="..\Include\cpython\pystate.h" />
|
||||
<ClInclude Include="..\Include\cpython\pystats.h" />
|
||||
<ClInclude Include="..\Include\cpython\pythonrun.h" />
|
||||
<ClInclude Include="..\Include\cpython\pythread.h" />
|
||||
<ClInclude Include="..\Include\cpython\setobject.h" />
|
||||
|
@ -261,6 +262,7 @@
|
|||
<ClInclude Include="..\Include\internal\pycore_pymem.h" />
|
||||
<ClInclude Include="..\Include\internal\pycore_pymem_init.h" />
|
||||
<ClInclude Include="..\Include\internal\pycore_pystate.h" />
|
||||
<ClInclude Include="..\Include\internal\pycore_pystats.h" />
|
||||
<ClInclude Include="..\Include\internal\pycore_pythonrun.h" />
|
||||
<ClInclude Include="..\Include\internal\pycore_pythread.h" />
|
||||
<ClInclude Include="..\Include\internal\pycore_range.h" />
|
||||
|
|
|
@ -492,6 +492,9 @@
|
|||
<ClInclude Include="..\Include\cpython\pystate.h">
|
||||
<Filter>Include\cpython</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\cpython\pystats.h">
|
||||
<Filter>Include\cpython</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\cpython\initconfig.h">
|
||||
<Filter>Include\cpython</Filter>
|
||||
</ClInclude>
|
||||
|
@ -693,6 +696,9 @@
|
|||
<ClInclude Include="..\Include\internal\pycore_pystate.h">
|
||||
<Filter>Include\internal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\internal\pycore_pystats.h">
|
||||
<Filter>Include\internal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\internal\pycore_pythonrun.h">
|
||||
<Filter>Include\internal</Filter>
|
||||
</ClInclude>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue