Sampling profiler fails to display user-defined function in IDLE when started with the run command
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug report
Bug description:
This is my simple test running IDLE at profiler startup (sudo as I'm running on a Mac, YMMV):
sudo -E ./python.exe -m profiling.sampling run -a --realtime-stats -d 99999 --live -m idlelib
As expected, I can also attach to a running IDLE session:
sudo -E ./python.exe -m profiling.sampling attach -a --realtime-stats -d 99999 --live <PID>
The two versions display things differently. If I attach to a running IDLE, define fib(), then call it with a large n (say, 200), it will run for a while before returning a result. I can see the recursive calls to fib in the display.
If I use the run command instead, I never see fib show in the display. Instead, I see something like this:
It appears all the samples in fib are credited to Misc.mainloop. I know the function is executing, given that small-n calls return quickly with the correct result, but shouldn't fib show up in the display when called with a large value for n if I use the run command to start IDLE?
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Unterschied zwischen den Befehlen profiling.sampling run und attach für idlelib, indem du wie beschrieben einen rekursiven fib()-Aufruf verwendest. Beginne damit nachzuverfolgen, wie profiling.sampling den run-Pfad behandelt, und vergleiche die angezeigten Samples mit attach; fertig ist es, wenn benutzerdefinierte Funktionen wie fib in der run-Anzeige erscheinen, statt Misc.mainloop zugerechnet zu werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools, performance
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100