Sampling profiler fails to display user-defined function in IDLE when started with the run command
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci la differenza tra i comandi profiling.sampling run e attach su idlelib, usando una chiamata ricorsiva a fib() come descritto. Inizia tracciando come profiling.sampling gestisce il percorso run e confronta i campioni visualizzati con attach; il lavoro è completato quando le funzioni definite dall’utente come fib compaiono nella visualizzazione di run invece di essere attribuite a Misc.mainloop.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- devtools, performance
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100