Este conteúdo não está disponível no idioma selecionado.

A.3. Capturing Trace Data on a Constant Basis Using the Systemtap Flight Recorder


You can capture QEMU trace data all the time using a systemtap initscript provided in the qemu-kvm package. This package uses SystemTap's flight recorder mode to trace all running guest virtual machines and to save the results to a fixed-size buffer on the host. Old trace entries are overwritten by new entries when the buffer is filled.

Procedure A.1. Configuring and running systemtap

  1. Install the package

    Install the systemtap-initscript package by running the following command:
    # yum install systemtap-initscript
  2. Copy the configuration file

    Copy the systemtap scripts and the configuration files to the systemtap directory by running the following commands:
    # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/
    # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/
    The set of trace events to enable is given in qemu_kvm.stp. This SystemTap script can be customized to add or remove trace events provided in /usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp.
    SystemTap customizations can be made to qemu_kvm.conf to control the flight recorder buffer size and whether to store traces in memory only or in the disk as well.
  3. Start the service

    Start the systemtap service by running the following command:
    # systemctl start systemtap qemu_kvm
  4. Make systemtap enabled to run at boot time

    Enable the systemtap service to run at boot time by running the following command:
    # systemctl enable systemtap qemu_kvm
  5. Confirmation the service is running

    Confirm that the service is working by running the following command:
    # systemctl status systemtap qemu_kvm
    qemu_kvm is running...
    

Procedure A.2. Inspecting the trace buffer

  1. Create a trace buffer dump file

    Create a trace buffer dump file called trace.log and place it in the tmp directory by running the following command:
    # staprun -A qemu_kvm >/tmp/trace.log
    You can change the file name and location to something else.
  2. Start the service

    As the previous step stops the service, start it again by running the following command:
    # systemctl start systemtap qemu_kvm
  3. Convert the trace contents into a readable format

    To convert the trace file contents into a more readable format, enter the following command:
    # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log

Note

The following notes and limitations should be noted:
  • The systemtap service is disabled by default.
  • There is a small performance penalty when this service is enabled, but it depends on which events are enabled in total.
  • There is a README file located in /usr/share/doc/qemu-kvm-*/README.systemtap.
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja oBlog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

© 2024 Red Hat, Inc.