162306a36Sopenharmony_ciperf-kvm(1) 262306a36Sopenharmony_ci=========== 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciNAME 562306a36Sopenharmony_ci---- 662306a36Sopenharmony_ciperf-kvm - Tool to trace/measure kvm guest os 762306a36Sopenharmony_ci 862306a36Sopenharmony_ciSYNOPSIS 962306a36Sopenharmony_ci-------- 1062306a36Sopenharmony_ci[verse] 1162306a36Sopenharmony_ci'perf kvm' [--host] [--guest] [--guestmount=<path> 1262306a36Sopenharmony_ci [--guestkallsyms=<path> --guestmodules=<path> | --guestvmlinux=<path>]] 1362306a36Sopenharmony_ci {top|record|report|diff|buildid-list} [<options>] 1462306a36Sopenharmony_ci'perf kvm' [--host] [--guest] [--guestkallsyms=<path> --guestmodules=<path> 1562306a36Sopenharmony_ci | --guestvmlinux=<path>] {top|record|report|diff|buildid-list|stat} [<options>] 1662306a36Sopenharmony_ci'perf kvm stat [record|report|live] [<options>] 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciDESCRIPTION 1962306a36Sopenharmony_ci----------- 2062306a36Sopenharmony_ciThere are a couple of variants of perf kvm: 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci 'perf kvm [options] top <command>' to generates and displays 2362306a36Sopenharmony_ci a performance counter profile of guest os in realtime 2462306a36Sopenharmony_ci of an arbitrary workload. 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci 'perf kvm record <command>' to record the performance counter profile 2762306a36Sopenharmony_ci of an arbitrary workload and save it into a perf data file. We set the 2862306a36Sopenharmony_ci default behavior of perf kvm as --guest, so if neither --host nor --guest 2962306a36Sopenharmony_ci is input, the perf data file name is perf.data.guest. If --host is input, 3062306a36Sopenharmony_ci the perf data file name is perf.data.kvm. If you want to record data into 3162306a36Sopenharmony_ci perf.data.host, please input --host --no-guest. The behaviors are shown as 3262306a36Sopenharmony_ci following: 3362306a36Sopenharmony_ci Default('') -> perf.data.guest 3462306a36Sopenharmony_ci --host -> perf.data.kvm 3562306a36Sopenharmony_ci --guest -> perf.data.guest 3662306a36Sopenharmony_ci --host --guest -> perf.data.kvm 3762306a36Sopenharmony_ci --host --no-guest -> perf.data.host 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci 'perf kvm report' to display the performance counter profile information 4062306a36Sopenharmony_ci recorded via perf kvm record. 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci 'perf kvm diff' to displays the performance difference amongst two perf.data 4362306a36Sopenharmony_ci files captured via perf record. 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci 'perf kvm buildid-list' to display the buildids found in a perf data file, 4662306a36Sopenharmony_ci so that other tools can be used to fetch packages with matching symbol tables 4762306a36Sopenharmony_ci for use by perf report. As buildid is read from /sys/kernel/notes in os, then 4862306a36Sopenharmony_ci if you want to list the buildid for guest, please make sure your perf data file 4962306a36Sopenharmony_ci was captured with --guestmount in perf kvm record. 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci 'perf kvm stat <command>' to run a command and gather performance counter 5262306a36Sopenharmony_ci statistics. 5362306a36Sopenharmony_ci Especially, perf 'kvm stat record/report' generates a statistical analysis 5462306a36Sopenharmony_ci of KVM events. Currently, vmexit, mmio (x86 only) and ioport (x86 only) 5562306a36Sopenharmony_ci events are supported. 'perf kvm stat record <command>' records kvm events 5662306a36Sopenharmony_ci and the events between start and end <command>. 5762306a36Sopenharmony_ci And this command produces a file which contains tracing results of kvm 5862306a36Sopenharmony_ci events. 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci 'perf kvm stat report' reports statistical data which includes events 6162306a36Sopenharmony_ci handled sample, percent_sample, time, percent_time, max_t, min_t, mean_t. 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci 'perf kvm stat live' reports statistical data in a live mode (similar to 6462306a36Sopenharmony_ci record + report but with statistical data updated live at a given display 6562306a36Sopenharmony_ci rate). 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ciOPTIONS 6862306a36Sopenharmony_ci------- 6962306a36Sopenharmony_ci-i:: 7062306a36Sopenharmony_ci--input=<path>:: 7162306a36Sopenharmony_ci Input file name, for the 'report', 'diff' and 'buildid-list' subcommands. 7262306a36Sopenharmony_ci-o:: 7362306a36Sopenharmony_ci--output=<path>:: 7462306a36Sopenharmony_ci Output file name, for the 'record' subcommand. Doesn't work with 'report', 7562306a36Sopenharmony_ci just redirect the output to a file when using 'report'. 7662306a36Sopenharmony_ci--host:: 7762306a36Sopenharmony_ci Collect host side performance profile. 7862306a36Sopenharmony_ci--guest:: 7962306a36Sopenharmony_ci Collect guest side performance profile. 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci:GMEXAMPLECMD: kvm --host --guest 8262306a36Sopenharmony_ci:GMEXAMPLESUBCMD: top 8362306a36Sopenharmony_ciinclude::guest-files.txt[] 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci--stdio:: Use the stdio interface. 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci-v:: 8862306a36Sopenharmony_ci--verbose:: 8962306a36Sopenharmony_ci Be more verbose (show counter open errors, etc). 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ciSTAT REPORT OPTIONS 9262306a36Sopenharmony_ci------------------- 9362306a36Sopenharmony_ci--vcpu=<value>:: 9462306a36Sopenharmony_ci analyze events which occur on this vcpu. (default: all vcpus) 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci--event=<value>:: 9762306a36Sopenharmony_ci event to be analyzed. Possible values: vmexit, mmio (x86 only), 9862306a36Sopenharmony_ci ioport (x86 only). (default: vmexit) 9962306a36Sopenharmony_ci-k:: 10062306a36Sopenharmony_ci--key=<value>:: 10162306a36Sopenharmony_ci Sorting key. Possible values: sample (default, sort by samples 10262306a36Sopenharmony_ci number), percent_sample (sort by sample percentage), time 10362306a36Sopenharmony_ci (sort by average time), precent_time (sort by time percentage), 10462306a36Sopenharmony_ci max_t (sort by maximum time), min_t (sort by minimum time), mean_t 10562306a36Sopenharmony_ci (sort by mean time). 10662306a36Sopenharmony_ci-p:: 10762306a36Sopenharmony_ci--pid=:: 10862306a36Sopenharmony_ci Analyze events only for given process ID(s) (comma separated list). 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ciSTAT LIVE OPTIONS 11162306a36Sopenharmony_ci----------------- 11262306a36Sopenharmony_ci-d:: 11362306a36Sopenharmony_ci--display:: 11462306a36Sopenharmony_ci Time in seconds between display updates 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci-m:: 11762306a36Sopenharmony_ci--mmap-pages=:: 11862306a36Sopenharmony_ci Number of mmap data pages (must be a power of two) or size 11962306a36Sopenharmony_ci specification with appended unit character - B/K/M/G. The 12062306a36Sopenharmony_ci size is rounded up to have nearest pages power of two value. 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci-a:: 12362306a36Sopenharmony_ci--all-cpus:: 12462306a36Sopenharmony_ci System-wide collection from all CPUs. 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci-p:: 12762306a36Sopenharmony_ci--pid=:: 12862306a36Sopenharmony_ci Analyze events only for given process ID(s) (comma separated list). 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci--vcpu=<value>:: 13162306a36Sopenharmony_ci analyze events which occur on this vcpu. (default: all vcpus) 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci--event=<value>:: 13562306a36Sopenharmony_ci event to be analyzed. Possible values: vmexit, 13662306a36Sopenharmony_ci mmio (x86 only), ioport (x86 only). 13762306a36Sopenharmony_ci (default: vmexit) 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci-k:: 14062306a36Sopenharmony_ci--key=<value>:: 14162306a36Sopenharmony_ci Sorting key. Possible values: sample (default, sort by samples 14262306a36Sopenharmony_ci number), time (sort by average time). 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci--duration=<value>:: 14562306a36Sopenharmony_ci Show events other than HLT (x86 only) or Wait state (s390 only) 14662306a36Sopenharmony_ci that take longer than duration usecs. 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci--proc-map-timeout:: 14962306a36Sopenharmony_ci When processing pre-existing threads /proc/XXX/mmap, it may take 15062306a36Sopenharmony_ci a long time, because the file may be huge. A time out is needed 15162306a36Sopenharmony_ci in such cases. 15262306a36Sopenharmony_ci This option sets the time out limit. The default value is 500 ms. 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ciSEE ALSO 15562306a36Sopenharmony_ci-------- 15662306a36Sopenharmony_cilinkperf:perf-top[1], linkperf:perf-record[1], linkperf:perf-report[1], 15762306a36Sopenharmony_cilinkperf:perf-diff[1], linkperf:perf-buildid-list[1], 15862306a36Sopenharmony_cilinkperf:perf-stat[1] 159