cpython/Include/internal
Victor Stinner a0773b89df
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>
2023-09-06 15:54:59 +00:00
..
pycore_abstract.h gh-106320: Remove private AC converter functions (#108505) 2023-08-26 04:05:17 +02:00
pycore_asdl.h
pycore_ast.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_ast_state.h gh-104656: Rename typeparams AST node to type_params (#104657) 2023-05-21 21:25:09 -07:00
pycore_atexit.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_atomic.h gh-108337: Add pyatomic.h header (#108701) 2023-08-31 21:41:18 +00:00
pycore_atomic_funcs.h
pycore_bitutils.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_blocks_output_buffer.h gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221) 2023-08-21 19:15:52 +02:00
pycore_bytes_methods.h
pycore_bytesobject.h gh-107211: No longer export internal functions (5) (#108423) 2023-08-24 16:06:53 +00:00
pycore_call.h gh-106320: Remove private _Py_Identifier API (#108593) 2023-08-29 02:29:46 +02:00
pycore_capsule.h gh-108240: Add pycore_capsule.h internal header file (#108596) 2023-08-29 01:20:02 +00:00
pycore_ceval.h gh-106320: Remove private _PyEval function (#108433) 2023-08-24 20:25:22 +02:00
pycore_ceval_state.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_code.h gh-108753: Enhance pystats (#108754) 2023-09-06 15:54:59 +00:00
pycore_codecs.h gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221) 2023-08-21 19:15:52 +02:00
pycore_compile.h gh-107211: No longer export internal functions (5) (#108423) 2023-08-24 16:06:53 +00:00
pycore_complexobject.h gh-107211: No longer export internal functions (5) (#108423) 2023-08-24 16:06:53 +00:00
pycore_condvar.h gh-108765: Move standard includes to Python.h (#108769) 2023-09-01 21:03:20 +02:00
pycore_context.h gh-106320: Remove private _PyContext_NewHamtForTests() (#108434) 2023-08-24 19:37:41 +02:00
pycore_descrobject.h gh-106320: Move _PyMethodWrapper_Type to internal C API (#107064) 2023-07-22 20:57:59 +00:00
pycore_dict.h gh-106320: Remove private _Py_Identifier API (#108593) 2023-08-29 02:29:46 +02:00
pycore_dict_state.h gh-104252: Immortalize Py_EMPTY_KEYS (gh-104253) 2023-05-10 07:28:40 -06:00
pycore_dtoa.h gh-107211: No longer export internal functions (1) (#107213) 2023-07-25 03:44:11 +02:00
pycore_emscripten_signal.h gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221) 2023-08-21 19:15:52 +02:00
pycore_exceptions.h
pycore_faulthandler.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_fileutils.h gh-106320: Fix test_peg_generator: _Py_UniversalNewlineFgetsWithSize() (#108609) 2023-08-29 03:40:13 +00:00
pycore_fileutils_windows.h gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221) 2023-08-21 19:15:52 +02:00
pycore_floatobject.h gh-106320: Remove private float C API functions (#108430) 2023-08-24 19:09:49 +02:00
pycore_flowgraph.h gh-106149: move CFG and basicblock definitions into flowgraph.c, use them as opaque types in compile.c (#107639) 2023-08-10 13:03:47 +01:00
pycore_format.h gh-104018: remove unused format "z" handling in string formatfloat() (#104107) 2023-05-07 10:11:42 +05:30
pycore_frame.h gh-107149: Make PyUnstable_ExecutableKinds public (#108440) 2023-08-31 09:56:06 +02:00
pycore_function.h gh-106581: Project through calls (#108067) 2023-08-17 11:29:58 -07:00
pycore_gc.h gh-105268: Add _Py_FROM_GC() function to pycore_gc.h (#105362) 2023-06-06 14:44:48 +02:00
pycore_genobject.h gh-107211: No longer export internal functions (5) (#108423) 2023-08-24 16:06:53 +00:00
pycore_getopt.h
pycore_gil.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_global_objects.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_global_objects_fini_generated.h Run make regen-global-objects (#108714) 2023-08-31 15:37:14 +02:00
pycore_global_strings.h Run make regen-global-objects (#108714) 2023-08-31 15:37:14 +02:00
pycore_hamt.h gh-81057: Move contextvars-related Globals to _PyRuntimeState (gh-99400) 2022-11-16 09:54:28 -07:00
pycore_hashtable.h gh-107211: No longer export internal functions (5) (#108423) 2023-08-24 16:06:53 +00:00
pycore_identifier.h gh-106320: Remove private _Py_Identifier API (#108593) 2023-08-29 02:29:46 +02:00
pycore_import.h gh-107211: No longer export internal functions (5) (#108423) 2023-08-24 16:06:53 +00:00
pycore_initconfig.h gh-108634: PyInterpreterState_New() no longer calls Py_FatalError() (#108748) 2023-09-01 12:43:30 +02:00
pycore_instruments.h GH-108390: Prevent non-local events being set with `sys.monitoring.set_local_events()` (GH-108420) 2023-09-05 08:03:53 +01:00
pycore_interp.h GH-108390: Prevent non-local events being set with `sys.monitoring.set_local_events()` (GH-108420) 2023-09-05 08:03:53 +01:00
pycore_intrinsics.h gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221) 2023-08-21 19:15:52 +02:00
pycore_list.h gh-106320: Remove private _PyList functions (#108451) 2023-08-24 19:44:34 +00:00
pycore_long.h gh-106320: Remove private _PyLong_Sign() (#108743) 2023-09-01 09:13:07 +02:00
pycore_memoryobject.h gh-106320: Remove private _PyManagedBuffer_Type (#108431) 2023-08-24 19:07:54 +02:00
pycore_modsupport.h gh-106320: Create pycore_modsupport.h header file (#106355) 2023-07-03 09:39:11 +00:00
pycore_moduleobject.h gh-106320: Remove private _PyModule API (#107070) 2023-07-22 21:41:11 +00:00
pycore_namespace.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_object.h gh-108634: PyInterpreterState_New() no longer calls Py_FatalError() (#108748) 2023-09-01 12:43:30 +02:00
pycore_object_state.h gh-108634: Py_TRACE_REFS uses a hash table (#108663) 2023-08-31 18:33:34 +02:00
pycore_obmalloc.h gh-107211: No longer export internal functions (6) (#108424) 2023-08-24 17:28:35 +02:00
pycore_obmalloc_init.h gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660) 2023-04-24 17:23:57 -06:00
pycore_opcode_metadata.h GH-108614: Remove `TIER_ONE` and `TIER_TWO` from `_PUSH_FRAME` (GH-108725) 2023-09-04 11:36:57 +01:00
pycore_opcode_utils.h gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. (#108367) 2023-08-23 18:39:00 +01:00
pycore_optimizer.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_parser.h gh-81057: Move the Cached Parser Dummy Name to _PyRuntimeState (#100277) 2022-12-16 13:48:03 +00:00
pycore_pathconfig.h gh-107211: No longer export internal functions (6) (#108424) 2023-08-24 17:28:35 +02:00
pycore_pyarena.h gh-107211: Fix test_peg_generator (#108435) 2023-08-24 17:47:44 +00:00
pycore_pyerrors.h gh-106320: Remove private _PyErr_WriteUnraisableMsg() (#108863) 2023-09-05 01:54:55 +02:00
pycore_pyhash.h gh-107211: No longer export internal functions (6) (#108424) 2023-08-24 17:28:35 +02:00
pycore_pylifecycle.h gh-107211: No longer export internal functions (7) (#108425) 2023-08-24 17:40:56 +02:00
pycore_pymath.h Remove unused internal macros (#102415) 2023-03-04 12:20:14 +00:00
pycore_pymem.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_pymem_init.h gh-108216: Cleanup #include in internal header files (#108228) 2023-08-21 18:05:59 +00:00
pycore_pystate.h gh-106320: Remove private _PyGILState_GetInterpreterStateUnsafe() (#108603) 2023-08-29 02:44:38 +00:00
pycore_pystats.h gh-108753: Enhance pystats (#108754) 2023-09-06 15:54:59 +00:00
pycore_pythonrun.h gh-106320: Remove private pythonrun API (#108599) 2023-08-29 04:18:52 +02:00
pycore_pythread.h gh-106320: Remove private _PyThread_at_fork_reinit() function (#108601) 2023-08-29 02:38:23 +00:00
pycore_range.h gh-89189: More compact range iterator (GH-27986) 2022-11-30 23:04:30 +02:00
pycore_runtime.h gh-107211: No longer export internal functions (7) (#108425) 2023-08-24 17:40:56 +02:00
pycore_runtime_init.h gh-108634: Py_TRACE_REFS uses a hash table (#108663) 2023-08-31 18:33:34 +02:00
pycore_runtime_init_generated.h Run make regen-global-objects (#108714) 2023-08-31 15:37:14 +02:00
pycore_setobject.h gh-107211: No longer export internal functions (7) (#108425) 2023-08-24 17:40:56 +02:00
pycore_signal.h gh-106320: Remove private _PyOS_IsMainThread() function (#108605) 2023-08-29 03:20:31 +00:00
pycore_sliceobject.h
pycore_strhex.h gh-107211: No longer export pycore_strhex.h functions (#108229) 2023-08-21 18:12:22 +00:00
pycore_structseq.h gh-107211: No longer export internal functions (4) (#107217) 2023-07-25 03:16:28 +00:00
pycore_symtable.h gh-107211: Rename PySymtable_Lookup() to _PySymtable_Lookup() (#107212) 2023-07-25 00:54:09 +00:00
pycore_sysmodule.h gh-106320: Remove private _PySys functions (#108452) 2023-08-24 20:02:09 +00:00
pycore_time.h gh-107211: No longer export PyTime internal functions (#108422) 2023-08-24 17:17:40 +02:00
pycore_token.h gh-107211: No longer export internal functions (7) (#108425) 2023-08-24 17:40:56 +02:00
pycore_traceback.h gh-106320: Remove private _PyTraceback functions (#108453) 2023-08-24 23:35:47 +00:00
pycore_tracemalloc.h gh-107211: No longer export internal functions (3) (#107215) 2023-07-25 02:25:45 +00:00
pycore_tuple.h gh-106320: Remove _PyTuple_MaybeUntrack() C API (#107143) 2023-07-23 19:16:21 +00:00
pycore_typeobject.h gh-107211: No longer export internal functions (7) (#108425) 2023-08-24 17:40:56 +02:00
pycore_typevarobject.h gh-104549: Set __module__ on TypeAliasType (#104550) 2023-05-18 15:56:15 -07:00
pycore_ucnhash.h
pycore_unicodeobject.h gh-106320: Remove private _Py_Identifier API (#108593) 2023-08-29 02:29:46 +02:00
pycore_unicodeobject_generated.h Run make regen-global-objects (#108714) 2023-08-31 15:37:14 +02:00
pycore_unionobject.h
pycore_uops.h gh-108765: Cleanup #include in Python/*.c files (#108977) 2023-09-06 15:56:08 +02:00
pycore_warnings.h gh-107211: No longer export internal functions (3) (#107215) 2023-07-25 02:25:45 +00:00
pycore_weakref.h gh-105927: Remove _PyWeakref_GetWeakrefCount() (#106007) 2023-06-23 03:00:56 +00:00