From bbcf42449e13c0b62f145cd49d12674ef3d5bf64 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Fri, 27 May 2022 16:31:41 +0100 Subject: GH-90230: Add stats to breakdown the origin of calls to `PyEval_EvalFrame` (GH-93284) --- Include/internal/pycore_code.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Include/internal/pycore_code.h') diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 3d19843274..2cfa319f2d 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -265,6 +265,9 @@ extern int _PyStaticCode_InternStrings(PyCodeObject *co); #define OBJECT_STAT_INC(name) _py_stats.object_stats.name++ #define OBJECT_STAT_INC_COND(name, cond) \ do { if (cond) _py_stats.object_stats.name++; } while (0) +#define EVAL_CALL_STAT_INC(name) _py_stats.call_stats.eval_calls[name]++ +#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) \ + do { if (PyFunction_Check(callable)) _py_stats.call_stats.eval_calls[name]++; } while (0) // Used by the _opcode extension which is built as a shared library PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); @@ -276,6 +279,8 @@ PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); #define CALL_STAT_INC(name) ((void)0) #define OBJECT_STAT_INC(name) ((void)0) #define OBJECT_STAT_INC_COND(name, cond) ((void)0) +#define EVAL_CALL_STAT_INC(name) ((void)0) +#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) ((void)0) #endif // !Py_STATS // Cache values are only valid in memory, so use native endianness. -- cgit v1.2.1