summaryrefslogtreecommitdiff
path: root/Include/internal/pycore_code.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-05-27 16:31:41 +0100
committerGitHub <noreply@github.com>2022-05-27 16:31:41 +0100
commitbbcf42449e13c0b62f145cd49d12674ef3d5bf64 (patch)
tree68d3a84f78de47229c46df66eafd4c27474379a7 /Include/internal/pycore_code.h
parent8995177030c8b41885ad92b260279b7e622ecaea (diff)
downloadcpython-git-bbcf42449e13c0b62f145cd49d12674ef3d5bf64.tar.gz
GH-90230: Add stats to breakdown the origin of calls to `PyEval_EvalFrame` (GH-93284)
Diffstat (limited to 'Include/internal/pycore_code.h')
-rw-r--r--Include/internal/pycore_code.h5
1 files changed, 5 insertions, 0 deletions
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.