Skip to content

perf output should include line numbers #134023

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

Closed
carl-mastrangelo opened this issue May 15, 2025 · 2 comments
Closed

perf output should include line numbers #134023

carl-mastrangelo opened this issue May 15, 2025 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@carl-mastrangelo
Copy link

carl-mastrangelo commented May 15, 2025

Feature or enhancement

Proposal:

When running Python 3.12 or later on Linux, it's possible to get profiling information on the process by running perf. This is helpful, but the output only includes the function names on the stack. It would be useful if the line numbers were included, to see what part of the function is causing the majority of the CPU usage.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

@carl-mastrangelo carl-mastrangelo added the type-feature A feature request or enhancement label May 15, 2025
@picnixz picnixz added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label May 15, 2025
@picnixz
Copy link
Member

picnixz commented May 15, 2025

cc @pablogsal

@pablogsal
Copy link
Member

pablogsal commented May 15, 2025

Unfortunately this is not possible. The way the Perf integration works is by jit compiling a piece of code and assigning that to a function. We then create a mapping between that jit compiled function and a string representing the name. This happens when the function is first entered. We cannot update this mapping once created so we cannot tell Perf of the line number that the function is in. Even if we could that would be very expensive unfortunately because we would need to update the file with the relationship mapping every time something changes line number. It also wouldn't work with threads.

@pablogsal pablogsal closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants