Ce contenu n'est pas disponible dans la langue sélectionnée.

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

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.