summaryrefslogtreecommitdiffstats
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2021-08-12 11:15:06 (GMT)
committerGitHub <noreply@github.com>2021-08-12 11:15:06 (GMT)
commit8ac0886091c27bf4b6bb0a9b571e174b554d31a4 (patch)
tree9e9f3710581381eaa65a4e89eadfbb493228fffc /Python/specialize.c
parenta530a9538f3f444bebd2d2b71fe5f2e747e76d73 (diff)
downloadcpython-8ac0886091c27bf4b6bb0a9b571e174b554d31a4.zip
cpython-8ac0886091c27bf4b6bb0a9b571e174b554d31a4.tar.gz
cpython-8ac0886091c27bf4b6bb0a9b571e174b554d31a4.tar.bz2
bpo-44890: collect specialization stats if Py_DEBUG (GH-27731)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index f0d68f0..e653ae4 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -37,7 +37,7 @@
*/
Py_ssize_t _Py_QuickenedCount = 0;
-#if SPECIALIZATION_STATS
+#if COLLECT_SPECIALIZATION_STATS
SpecializationStats _specialization_stats[256] = { 0 };
#define ADD_STAT_TO_DICT(res, field) \
@@ -69,7 +69,7 @@ stats_to_dict(SpecializationStats *stats)
ADD_STAT_TO_DICT(res, miss);
ADD_STAT_TO_DICT(res, deopt);
ADD_STAT_TO_DICT(res, unquickened);
-#if SPECIALIZATION_STATS_DETAILED
+#if COLLECT_SPECIALIZATION_STATS_DETAILED
PyObject *failure_kinds = PyTuple_New(SPECIALIZATION_FAILURE_KINDS);
if (failure_kinds == NULL) {
Py_DECREF(res);
@@ -111,7 +111,7 @@ add_stat_dict(
return err;
}
-#if SPECIALIZATION_STATS
+#if COLLECT_SPECIALIZATION_STATS
PyObject*
_Py_GetSpecializationStats(void) {
PyObject *stats = PyDict_New();
@@ -144,7 +144,7 @@ print_stats(FILE *out, SpecializationStats *stats, const char *name)
PRINT_STAT(name, miss);
PRINT_STAT(name, deopt);
PRINT_STAT(name, unquickened);
-#if SPECIALIZATION_STATS_DETAILED
+#if PRINT_SPECIALIZATION_STATS_DETAILED
for (int i = 0; i < SPECIALIZATION_FAILURE_KINDS; i++) {
fprintf(out, " %s.specialization_failure_kinds[%d] : %" PRIu64 "\n",
name, i, stats->specialization_failure_kinds[i]);
@@ -157,7 +157,7 @@ void
_Py_PrintSpecializationStats(void)
{
FILE *out = stderr;
-#if SPECIALIZATION_STATS_TO_FILE
+#if PRINT_SPECIALIZATION_STATS_TO_FILE
/* Write to a file instead of stderr. */
# ifdef MS_WINDOWS
const char *dirname = "c:\\temp\\py_stats\\";
@@ -182,7 +182,7 @@ _Py_PrintSpecializationStats(void)
}
}
-#if SPECIALIZATION_STATS_DETAILED
+#if COLLECT_SPECIALIZATION_STATS_DETAILED
#define SPECIALIZATION_FAIL(opcode, kind) _specialization_stats[opcode].specialization_failure_kinds[kind]++