Add runtime control for `profiling.sampling`
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Feature or enhancement
Proposal:
The idea is to add an optional control channel (socket? named pipe?), so another process can start, stop etc. profiling without killing/restarting the profiler completely. Right now, the only option is to interact with it via TUI mode or just stop it via Ctrl-C.
While working on https://github.com/psf/pyperf/pull/230 I ran into the following problem: some parts (eg: warming up) of benchmarking should not be profiled, as they do not add any value. My only option was sending SIGINT signal.
Generally, the current flow is nice for headful sessions but it could be improved for (especially long-running) headless sessions.
perf record --control does it in a similar way:
--control=fifo:ctl-fifo[,ack-fifo], --control=fd:ctl-fd[,ack-fd]
ctl-fifo / ack-fifo are opened and used as ctl-fd / ack-fd as
follows. Listen on ctl-fd descriptor for command to control
measurement.
Available commands:
• enable : enable events
• disable : disable events
• enable name : enable event name
• disable name : disable event name
• snapshot : AUX area tracing snapshot).
• stop : stop perf record
• ping : ping
• 'evlist [-v|-g|-F] : display all events
-F Show just the sample frequency used for each event.
-v Show all fields.
-g Show event group information.
Specifically:
- We could start with just
enableanddisableinitially.snapshotnext but it'd be lovely to dump without loosing accumulated data. Or maybe evenset_rate. - Possible transport layers could be Unix sockets (works great on Linux) or named pipe. One option might be portable, another not?
- Possble new arguments like
--control unix:/tmp/tachyon-ctl.sockor--control fifo:/tmp/tachyon-ctl, similar to what perf record --control does.
It could be also ommited from the documentation initially, so we don't limit ourselves too early.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-149958
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza siguiendo el flujo existente de profiling.sampling y cómo el modo TUI y SIGINT controlan actualmente el profiling. Compara el flujo de control propuesto para habilitar/deshabilitar con perf record --control, incluidas las opciones de socket Unix o named pipe y el argumento --control propuesto. Se considera terminado cuando exista una interfaz de control en tiempo de ejecución definida que admita profiling sin interfaz gráfica sin reiniciar el profiler.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- performance, tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 20/100