Skip to content

Use PyFrame_GetLineNumber to get line numbers #8

Open

Description

@timpalpant

The CPU profiler currently uses f_lineno as the line associated with each sample. However, f_lineno points to the start of the frame. Looking at a source listing of these profiles in pprof results in all samples appearing to be from the function definition.

One can use PyFrame_GetLineNumber (available in Python 2.7 as well) instead to get the currently-executing line from a frame. This can help understand where within a function the program is executing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions