diff options
author | Mark Shannon <mark@hotpy.org> | 2021-12-15 15:32:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 15:32:32 (GMT) |
commit | 342b93f9f28746abb7b221a61d5a9b26ccbb395a (patch) | |
tree | ebbe62af5b0853d8a8922c203174a88553ad798f /Include | |
parent | 3a60bfef49b3324660a615a8e6d10710e5f669d9 (diff) | |
download | cpython-342b93f9f28746abb7b221a61d5a9b26ccbb395a.zip cpython-342b93f9f28746abb7b221a61d5a9b26ccbb395a.tar.gz cpython-342b93f9f28746abb7b221a61d5a9b26ccbb395a.tar.bz2 |
bpo-46072: Add --with-pystats configure option to simplify gathering of VM stats (GH-30116)
* Simplify specialization stats collection macros.
* Add --enable-pystats option to configure.
* Update specialization summary script to handle larger number of kinds
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_code.h | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index b0463e3..e9b1ad4 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -276,22 +276,11 @@ void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache); void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache); -#define PRINT_SPECIALIZATION_STATS 0 -#define PRINT_SPECIALIZATION_STATS_DETAILED 0 -#define PRINT_SPECIALIZATION_STATS_TO_FILE 0 -#ifdef Py_DEBUG -#define COLLECT_SPECIALIZATION_STATS 1 -#define COLLECT_SPECIALIZATION_STATS_DETAILED 1 -#else -#define COLLECT_SPECIALIZATION_STATS PRINT_SPECIALIZATION_STATS -#define COLLECT_SPECIALIZATION_STATS_DETAILED PRINT_SPECIALIZATION_STATS_DETAILED -#endif +#ifdef Py_STATS #define SPECIALIZATION_FAILURE_KINDS 30 -#if COLLECT_SPECIALIZATION_STATS - typedef struct _stats { uint64_t specialization_success; uint64_t specialization_failure; @@ -300,15 +289,13 @@ typedef struct _stats { uint64_t miss; uint64_t deopt; uint64_t unquickened; -#if COLLECT_SPECIALIZATION_STATS_DETAILED uint64_t specialization_failure_kinds[SPECIALIZATION_FAILURE_KINDS]; -#endif } SpecializationStats; extern SpecializationStats _specialization_stats[256]; #define STAT_INC(opname, name) _specialization_stats[opname].name++ #define STAT_DEC(opname, name) _specialization_stats[opname].name-- -void _Py_PrintSpecializationStats(void); +void _Py_PrintSpecializationStats(int to_file); PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); |