bpo-44890: collect specialization stats if Py_DEBUG (GH-27731)

This commit is contained in:
Irit Katriel 2021-08-12 12:15:06 +01:00 • committed by GitHub
parent a530a9538f
commit 8ac0886091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 13 deletions

View file

@ -301,13 +301,16 @@ int _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *nam
int _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache);
int _Py_Specialize_BinarySubscr(PyObject *sub, PyObject *container, _Py_CODEUNIT *instr);
#define SPECIALIZATION_STATS 0
#define SPECIALIZATION_STATS_DETAILED 0
#define SPECIALIZATION_STATS_TO_FILE 0
#define PRINT_SPECIALIZATION_STATS 0
#define PRINT_SPECIALIZATION_STATS_DETAILED 0
#define PRINT_SPECIALIZATION_STATS_TO_FILE 0
#define COLLECT_SPECIALIZATION_STATS (Py_DEBUG || PRINT_SPECIALIZATION_STATS)
#define COLLECT_SPECIALIZATION_STATS_DETAILED (Py_DEBUG || PRINT_SPECIALIZATION_STATS_DETAILED)
#define SPECIALIZATION_FAILURE_KINDS 20
#if SPECIALIZATION_STATS
#if COLLECT_SPECIALIZATION_STATS
typedef struct _stats {
uint64_t specialization_success;
@ -317,7 +320,7 @@ typedef struct _stats {
uint64_t miss;
uint64_t deopt;
uint64_t unquickened;
#if SPECIALIZATION_STATS_DETAILED
#if COLLECT_SPECIALIZATION_STATS_DETAILED
uint64_t specialization_failure_kinds[SPECIALIZATION_FAILURE_KINDS];
#endif
} SpecializationStats;