bpo-46072: Add some frame stats. (GH-31060)

This commit is contained in:
Mark Shannon 2022-02-02 11:01:33 +00:00 committed by GitHub
parent a05866ce3e
commit 187930f74c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 1 deletions

View file

@ -2242,6 +2242,7 @@ handle_eval_breaker:
if (new_frame == NULL) {
goto error;
}
CALL_STAT_INC(frames_pushed);
_PyFrame_InitializeSpecials(new_frame, getitem,
NULL, code->co_nlocalsplus);
STACK_SHRINK(2);
@ -4660,6 +4661,7 @@ handle_eval_breaker:
if (new_frame == NULL) {
goto error;
}
CALL_STAT_INC(inlined_py_calls);
STACK_SHRINK(argcount);
for (int i = 0; i < argcount; i++) {
new_frame->localsplus[i] = stack_pointer[i];
@ -4690,6 +4692,7 @@ handle_eval_breaker:
if (new_frame == NULL) {
goto error;
}
CALL_STAT_INC(inlined_py_calls);
STACK_SHRINK(argcount);
for (int i = 0; i < argcount; i++) {
new_frame->localsplus[i] = stack_pointer[i];
@ -4708,7 +4711,6 @@ handle_eval_breaker:
_PyFrame_SetStackPointer(frame, stack_pointer);
new_frame->previous = frame;
frame = cframe.current_frame = new_frame;
CALL_STAT_INC(inlined_py_calls);
goto start_frame;
}
@ -6078,6 +6080,7 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func,
{
PyCodeObject * code = (PyCodeObject *)func->func_code;
size_t size = code->co_nlocalsplus + code->co_stacksize + FRAME_SPECIALS_SIZE;
CALL_STAT_INC(frames_pushed);
InterpreterFrame *frame = _PyThreadState_BumpFramePointer(tstate, size);
if (frame == NULL) {
goto fail;