8000 GH-90230: Add stats to breakdown the origin of calls to `PyEval_EvalFrame` by markshannon · Pull Request #93284 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-90230: Add stats to breakdown the origin of calls to PyEval_EvalFrame #93284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refine stats for PyEval_EvalFrame.
  • Loading branch information
markshannon committed May 26, 2022
commit bdcd0e55f1f75dae9315d586764e184549d910c8
3 changes: 2 additions & 1 deletion Include/pystats.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ extern "C" {
#define EVAL_CALL_FUNCTION 4
#define EVAL_CALL_BUILD_CLASS 5
#define EVAL_CALL_SLOT 6
#define EVAL_CALL_FUNCTION_EX 7

#define EVAL_CALL_KINDS 7
#define EVAL_CALL_KINDS 8

typedef struct _specialization_stats {
uint64_t success;
Expand Down
6 changes: 5 additions & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -7302,7 +7302,6 @@ do_call_core(PyThreadState *tstate,
)
{
PyObject *result;

if (PyCFunction_CheckExact(func) || PyCMethod_CheckExact(func)) {
C_TRACE(result, PyObject_Call(func, callargs, kwdict));
return result;
Expand Down Expand Up @@ -7332,6 +7331,11 @@ do_call_core(PyThreadState *tstate,
return result;
}
}
#ifdef Py_STATS
if (PyFunction_Check(func)) {
EVAL_CALL_STAT_INC(EVAL_CALL_FUNCTION_EX);
}
#endif
return PyObject_Call(func, callargs, kwdict);
}

Expand Down
0