Skip to content

Call stats are incorrect for tier 2 and maybe for tier 1 as well #118036

@markshannon

Description

@markshannon

Bug report

Bug description:

The call stats for tier 2 differ significantly from tier 1, but it is not clear that the tier 1 call stats are correct either.

The main purpose of the call stats is to track the fraction of Python frames that are created with and without calls to PyEval_EvalDefault. However, the stats don't make that clear and may be incorrect.

Currently the table looks like this:

  Count Ratio
Calls to PyEval_EvalDefault 2,309,411,110 32.0%
Calls to Python functions inlined 4,908,275,087 68.0%
Calls via PyEval_EvalFrame (total) 2,309,411,110 32.0%
Calls via PyEval_EvalFrame (vector) 1,447,866,962 20.1%
Calls via PyEval_EvalFrame (generator) 861,544,148 11.9%
Calls via PyEval_EvalFrame (legacy) 4,418,464 0.1%
Calls via PyEval_EvalFrame (function vectorcall) 1,443,417,872 20.0%
Calls via PyEval_EvalFrame (build class) 30,626 0.0%
Calls via PyEval_EvalFrame (slot) 475,837,706 6.6%
Calls via PyEval_EvalFrame (function ex) 38,365,096 0.5%
Calls via PyEval_EvalFrame (api) 256,353,600 3.6%
Calls via PyEval_EvalFrame (method) 213,159,135 3.0%
Frame objects created 88,466,853 1.2%
Frames pushed 4,953,781,868 68.6%

Note that the numbers don't add up.
The number of "frames pushed" is actually the total number of frames created. As it is function frames pushed, generator frames are not counted.

Frame objects created should be a fraction of "frames created". All other numbers should be a fraction of "frames pushed"

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions