-
Notifications
You must be signed in to change notification settings - Fork 224
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
Stop built-in code showing as 'None' in traces #254
Conversation
Profiling the code from the issue now shows this, which is better but still has
|
I think |
Weirdly I don't see this Though I think your solution sounds right. |
Using this python on macOS
I create a venv
then install pyinstrument with
If I stop inside |
Weird.... I get $ python -m pyinstrument /tmp/profile.py
_ ._ __/__ _ _ _ _ _/_ Recorded: 19:13:42 Samples: 5
/_//_/// /_\ / //_// / //_'/ // Duration: 1.020 CPU time: 0.003
/ _/ v4.5.0
Program: /tmp/profile.py
1.018 <module> profile.py:1
└─ 1.018 A profile.py:16
├─ 0.704 D profile.py:3
│ └─ 0.704 sleep <built-in>
│ [2 frames hidden] <built-in>
└─ 0.314 sleep <built-in>
[2 frames hidden] <built-in>
To view this report with different options, run:
pyinstrument --load-prev 2023-07-13T19-13-42 [options] I'm on python 3.10.7, on mac. |
Are you on homebrew python? could that be the difference? |
Ah, I managed to recreate it, by using a venv in a different directory $ python -m pyinstrument /tmp/profile.py
_ ._ __/__ _ _ _ _ _/_ Recorded: 19:18:10 Samples: 4
/_//_/// /_\ / //_// / //_'/ // Duration: 1.019 CPU time: 0.001
/ _/ v4.5.0
Program: /tmp/profile.py
1.019 <module> profile.py:1
└─ 1.019 A profile.py:16
├─ 0.703 D profile.py:3
│ └─ 0.703 sleep ../Users/joerick/Projects/pyinstrument/<built-in>
│ [2 frames hidden] ..
└─ 0.315 sleep ../Users/joerick/Projects/pyinstrument/<built-in>
[2 frames hidden] ..
To view this report with different options, run:
pyinstrument --load-prev 2023-07-13T19-18-10 [options] |
Fixes #252.
The issue here was a simple coding error,
self.line_no
was0
so it was falling back as you said @mattip. I decided to keep the if as it was, though, since a line_no of 0 is still invalid, line numbers start at 1, but it will fallback to just the file_path_short, if it's available.