aboutsummaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2021-08-12 12:15:06 +0100
committerGitHub <noreply@github.com>2021-08-12 12:15:06 +0100
commit8ac0886091c27bf4b6bb0a9b571e174b554d31a4 (patch)
tree9e9f3710581381eaa65a4e89eadfbb493228fffc /Include
parenta530a9538f3f444bebd2d2b71fe5f2e747e76d73 (diff)
downloadcpython3-8ac0886091c27bf4b6bb0a9b571e174b554d31a4.tar.gz
bpo-44890: collect specialization stats if Py_DEBUG (GH-27731)
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_code.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index 7ae7aee961..85f09544d4 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -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;