From 09487c11a582be1f20d34319a82cfaf72d5c27a5 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Tue, 22 Feb 2022 17:18:10 +0000 Subject: [PATCH] Fix reporting of specialization stats. (GH-31503) --- Python/ceval.c | 2 ++ Tools/scripts/summarize_stats.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index 4d7c0d015bc..308271b8953 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4691,6 +4691,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr DEOPT_IF(func->func_version != cache1->func_version, CALL); PyCodeObject *code = (PyCodeObject *)func->func_code; DEOPT_IF(code->co_argcount != argcount, CALL); + STAT_INC(CALL, hit); InterpreterFrame *new_frame = _PyFrame_Push(tstate, func); if (new_frame == NULL) { goto error; @@ -4725,6 +4726,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr DEOPT_IF(argcount > code->co_argcount, CALL); int minargs = cache1->min_args; DEOPT_IF(argcount < minargs, CALL); + STAT_INC(CALL, hit); InterpreterFrame *new_frame = _PyFrame_Push(tstate, func); if (new_frame == NULL) { goto error; diff --git a/Tools/scripts/summarize_stats.py b/Tools/scripts/summarize_stats.py index df20959ea87..69babfd2dda 100644 --- a/Tools/scripts/summarize_stats.py +++ b/Tools/scripts/summarize_stats.py @@ -38,7 +38,7 @@ def print_specialization_stats(name, family_stats, defines): for key in sorted(family_stats): if key.startswith("specialization.failure_kinds"): continue - if key.startswith("specialization."): + if key in ("specialization.hit", "specialization.miss"): label = key[len("specialization."):] elif key == "execution_count": label = "unquickened"