Questo contenuto non è disponibile nella lingua selezionata.

Chapter 29. Adding and removing tracepoints from a running perf collector without stopping or restarting perf


By using the control pipe interface to enable and disable different tracepoints in a running perf collector, you can dynamically adjust what data you are collecting without having to stop or restart perf. This ensures you do not lose performance data that would have otherwise been recorded during the stopping or restarting process.

Add tracepoints to a running perf collector using the control pipe interface to adjust the data you are recording without having to stop perf and losing performance data.

Prerequisites

  • You have the perf user space tool installed as described in Installing perf.

Procedure

  1. Configure the control pipe interface:

    # mkfifo control ack perf.pipe
    Copy to Clipboard Toggle word wrap
  2. Run perf record with the control file setup and events you are interested in enabling:

    # perf record --control=fifo:control,ack -D -1 --no-buffering -e 'sched:*' -o - > perf.pipe
    Copy to Clipboard Toggle word wrap

    In this example, declaring 'sched:*' after the -e option starts perf record with scheduler events.

  3. In a second terminal, start the read side of the control pipe:

    # cat perf.pipe | perf --no-pager script -i -
    Copy to Clipboard Toggle word wrap

    Starting the read side of the control pipe triggers the following message in the first terminal:

    Events disabled
    Copy to Clipboard Toggle word wrap
  4. In a third terminal, enable a tracepoint using the control file:

    # echo 'enable sched:sched_process_fork' > control
    Copy to Clipboard Toggle word wrap

    This command triggers perf to scan the current event list in the control file for the declared event. If the event is present, the tracepoint is enabled and the following message appears in the first terminal:

    event sched:sched_process_fork enabled
    Copy to Clipboard Toggle word wrap

    Once the tracepoint is enabled, the second terminal displays the output from perf detecting the tracepoint:

    bash 33349 [034] 149587.674295: sched:sched_process_fork: comm=bash pid=33349 child_comm=bash child_pid=34056
    Copy to Clipboard Toggle word wrap

Remove tracepoints from a running perf collector using the control pipe interface to reduce the scope of data you are collecting without having to stop perf and losing performance data.

Prerequisites

Procedure

  • Remove the tracepoint:

    # echo 'disable sched:sched_process_fork' > control
    Copy to Clipboard Toggle word wrap
    Note

    This example assumes you have previously loaded scheduler events into the control file and enabled the tracepoint sched:sched_process_fork.

    This command triggers perf to scan the current event list in the control file for the declared event. If the event is present, the tracepoint is disabled and the following message appears in the terminal used to configure the control pipe:

    event sched:sched_process_fork disabled
    Copy to Clipboard Toggle word wrap
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2026 Red Hat