Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
2.2. perf kvm
perf command with the kvm option to collect guest operating system statistics from the host.
perf command. Run rpm -q perf to see if the perf package is installed. If it is not installed, and you want to install it to collect and analyze guest operating system statistics, run the following command as the root user:
yum install perf
yum install perf
perf kvm in the host, you must have access to the /proc/modules and /proc/kallsyms files from the guest. There are two methods to achieve this. Refer to the following procedure, Procedure 2.1, “Copying /proc files from guest to host” to transfer the files into the host and run reports on the files. Alternatively, refer to Procedure 2.2, “Alternative: using sshfs to directly access files” to directly mount the guest and access the files.
Procedure 2.1. Copying /proc files from guest to host
Important
scp) you will only copy files of zero length. This procedure describes how to first save the files in the guest to a temporary location (with the cat command), and then copy them to the host for use by perf kvm.
Log in to the guest and save files
Log in to the guest and save/proc/modulesand/proc/kallsymsto a temporary location,/tmp:cat /proc/modules > /tmp/modules cat /proc/kallsyms > /tmp/kallsyms
# cat /proc/modules > /tmp/modules # cat /proc/kallsyms > /tmp/kallsymsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the temporary files to the host
Once you have logged off from the guest, run the following examplescpcommands to copy the saved files to the host. You should substitute your host name and TCP port if they are different:scp root@GuestMachine:/tmp/kallsyms guest-kallsyms scp root@GuestMachine:/tmp/modules guest-modules
# scp root@GuestMachine:/tmp/kallsyms guest-kallsyms # scp root@GuestMachine:/tmp/modules guest-modulesCopy to Clipboard Copied! Toggle word wrap Toggle overflow You now have two files from the guest (guest-kallsymsandguest-modules) on the host, ready for use byperf kvm.Recording and reporting events with perf kvm
Using the files obtained in the previous steps, recording and reporting of events in the guest, the host, or both is now possible.Run the following example command:perf kvm --host --guest --guestkallsyms=guest-kallsyms \ --guestmodules=guest-modules record -a -o perf.data
# perf kvm --host --guest --guestkallsyms=guest-kallsyms \ --guestmodules=guest-modules record -a -o perf.dataCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note
If both --host and --guest are used in the command, output will be stored inperf.data.kvm. If only --host is used, the file will be namedperf.data.host. Similarly, if only --guest is used, the file will be namedperf.data.guest.Pressing Ctrl-C stops recording.Reporting events
The following example command uses the file obtained by the recording process, and redirects the output into a new file,analyze.perf kvm --host --guest --guestmodules=guest-modules report -i perf.data.kvm \ --force > analyze
perf kvm --host --guest --guestmodules=guest-modules report -i perf.data.kvm \ --force > analyzeCopy to Clipboard Copied! Toggle word wrap Toggle overflow View the contents of theanalyzefile to examine the recorded events:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure 2.2. Alternative: using sshfs to directly access files
Important
This is provided as an example only. You will need to substitute values according to your environment.Copy to Clipboard Copied! Toggle word wrap Toggle overflow