python / python/cpython

Sampling profiler fails to display user-defined function in IDLE when started with the run command

Abierto
#142,325 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

3.15 stdlib topic-profiling type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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.

Image

If I use the run command instead, I never see fib show in the display. Instead, I see something like this:

Image

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce la diferencia entre los comandos profiling.sampling run y attach contra idlelib usando una llamada recursiva a fib() como se describe. Empieza trazando cómo profiling.sampling gestiona la ruta run y compara las muestras mostradas con attach; el trabajo estará terminado cuando las funciones definidas por el usuario, como fib, aparezcan en la visualización de run en lugar de atribuirse a Misc.mainloop.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
devtools, performance
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.