Skip to contentSkip to conversation

Howto: Using KVM TRACE

DISCUSSION Jerone Young 1 participant 1 message Jun 24, 2008

lore
Share & tools
lore
#0 lore raw

This is a short HOWTO for using KVM TRACE.

1) Enable Kernel
========
Enable CONFIG_KVM_TRACE in your kernel config. You will enable CONFIG_MARKERS & CONFIG_SYSFS to enable. CONFIG_DEBUG_FS should be enabled once you enable KVM_TRACE.

Build and boot.

2) Mount debugfs
========
You must mount debugfs before using kvmtrace. One way to do this is by placing an entry into your /etc/fstab , such as the following:

debugfs /sys/kernel/debug debugfs defaults 0 0

Reboot and it will mounted.

3) Build kvmtrace tool
===========
Go to kvm-userspace directory. Configure the directory with the configure command. Then go to "kvm-userspace/user" directory and type
command: "make kvmtrace".

This will build the trace tool you'll need to generate your trace file. Copy tool over to machine, so you can execute it later.

4) Running kvmtrace
==========Once on kvm host start a guest. To trace KVM use the kvmtrace tool, like in the following example.
./kvmtrace -o TRACE1 -w 5

This will run kvmtrace tool for 5 seconds and produce a binary file with your trace output named "TRACE1.kvmtrace.0".

5) Reading the data
===========
Copy file with trace output to somewhere you can access. Go back into kvm-userspace/user directory. You will need two files:

-kvmtrace_format
-formats <-- file describes how to printout the kvmtrace events into a readable form

Make sure your system has python. Now run kvmtrace_format like the following:

cat TRACE1.kvmtrace.0 | ./kvmtrace_format formats

You will then see your trace points displayed in a readable form.