xentrace: add a tool to break down the result of vmexit
PATCH 1/1 xentrace: add a tool to break down the result of vmexit
From: Yang Zhang <[email protected]>
The tool is able to provide a summary of vmexit. Currently, it only supports to summay one VCPU result at a time.
For example:
xentrace -D -T 10 -e 0x8f000 trace.dat
cat trace.dat | xentrace_format formats > trace.log
1. If the guest only has one vcpu, then you can run:
cat trace.log | perl analyze.pl
2. If the guest has more than one vcpus, you should pin the VCPU before dump trace result. Then use the follow command to get the result separately.
cat trace.log | grep CPUn | perl analyze.pl
Here is an example of output:
Start record TSC: 3450116314185050
End record TSC: 3450118790633050
TSC Offset: 2476448000 (1.03s)
VMExit TSC: 1787465188
TSC Ratio: 0.72
VMExit Count: 57802
Type Total TSC TSC Ratio Total Count Count Ratio Avg TSC
NMI or Exception 10167 0.00 2 0.00 5083
External Interrupt 2371685 0.00 156 0.00 15203
Halt 1578760226 0.88 1003 0.02 1574038
RDTSC 137125388 0.08 51150 0.88 2680
I/O Instruction 4386099 0.00 28 0.00 156646
WRMSR 53299084 0.03 4247 0.07 12549
Virtualized EOI 4557005 0.00 1180 0.02 3861
EPT violation 6955534 0.00 36 0.00 193209PF_XEN:
counts:0 TSC:0 TSC ratio of NMI/Exception=0.00PAGE_FAULT_CODE details:
CODE TSC Count TSC ratio Average TSC
Guest fault details:
Total TSC counts Average TSC
No device details:
Total TSC counts Average TSC
Interrupt details:
vector counts count ratio TSC TSC ratio Average TSC
IO details:
IO read:
port counts
IO write:
port counts
--- tools/xentrace/analyze.pl | 527 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 527 insertions(+), 0 deletions(-) create mode 100755 tools/xentrace/analyze.pl
tools/xentrace/analyze.pl new file +527 -0
@@ -0,0 +1,527 @@ +#!/usr/bin/perl + +# Copyright Xingchang Jiang <[email protected]>. GPL. +# Perform IA-32 xentrace raw data analysis +# Many thanks to Yang Xiaowei's review <[email protected]> +# Refined by Yang Zhang <[email protected]> + +my @VM_ENTYR; +my @VM_SUB; +my @XEN_ERROR; +my @GUEST_ERROR; +my @left; +my @VECTOR; + +my $cpuid; +my $tsc; +my $diff; +my $flag; +my $starttsc; +my $endtsc; +my $tscdiff; +my $totaltsc; +my $total_count; +my $generate_table; +my $sub_table; +my $exit_flag; +my $startcpuid; +my $endcpuid; +my $typeid; +my $errorcode; +my $vector; +my $subtypeid; +my $useless; +my $start; +my $end; +my $startlag; + +my $freq = 2393918000; + +$VM_ENTRY[0] = ["NMI or Exception"]; +$VM_ENTRY[1] = ["External Interrupt"]; +$VM_ENTRY[2] = ["Triple fault"]; +$VM_ENTRY[3] = ["Init signal"]; +$VM_ENTRY[4] = ["Startup IPI"]; +$VM_ENTRY[5] = ["I/O SMI"]; +$VM_ENTRY[6] = ["Other SMI"]; +$VM_ENTRY[7] = ["Interrupt window"]; +$VM_ENTRY[8] = ["nmi window"]; +$VM_ENTRY[9] = ["Task Switch"]; +$VM_ENTRY[10] = ["CPUID"]; +$VM_ENTRY[11] = ["getsec"]; +$VM_ENTRY[12] = ["Halt"]; +$VM_ENTRY[13] = ["INVD"]; +$VM_ENTRY[14] = ["INVLPG"]; +$VM_ENTRY[15] = ["RDPMC"]; +$VM_ENTRY[16] = ["RDTSC"]; +$VM_ENTRY[17] = ["RSM"]; +$VM_ENTRY[18] = ["VMCALL"]; +$VM_ENTRY[19] = ["VMCLEAR"]; +$VM_ENTRY[20] = ["VMLAUNCH"]; +$VM_ENTRY[21] = ["VMPTRLD"]; +$VM_ENTRY[22] = ["VMPTRST"]; +$VM_ENTRY[23] = ["VMREAD"]; +$VM_ENTRY[24] = ["VMRESUME"]; +$VM_ENTRY[25] = ["VMWRITE"]; +$VM_ENTRY[26] = ["VMXOFF"]; +$VM_ENTRY[27] = ["VMXON"]; +$VM_ENTRY[28] = ["CR access"]; +$VM_ENTRY[29] = ["MOV DR"]; +$VM_ENTRY[30] = ["I/O Instruction"]; +$VM_ENTRY[31] = ["RDMSR"]; +$VM_ENTRY[32] = ["WRMSR"]; +$VM_ENTRY[33] = ["VM-entry failure due to invalid guest state"]; +$VM_ENTRY[34] = ["VM-entry failure due to MSR loading"]; +$VM_ENTRY[35] = ["UNKNOWN 35"]; +$VM_ENTRY[36] = ["MWAIT"]; +$VM_ENTRY[37] = ["monitor trap"]; +$VM_ENTRY[38] = ["UNKNOWN 38"]; +$VM_ENTRY[39] = ["MONITOR"]; +$VM_ENTRY[40] = ["PAUSE"]; +$VM_ENTRY[41] = ["VM-entry failure due to machine check"]; +$VM_ENTRY[42] = ["UNKNOWN 42"]; +$VM_ENTRY[43] = ["TPR below threshold"]; +$VM_ENTRY[44] = ["APIC ACCESS"]; +$VM_ENTRY[45] = ["Virtualized EOI"]; +$VM_ENTRY[46] = ["Access GDTR/IDTR"]; +$VM_ENTRY[47] = ["Access LDTR/TR"]; +$VM_ENTRY[48] = ["EPT violation"]; +$VM_ENTRY[49] = ["EPT misconfiguration"]; +$VM_ENTRY[50] = ["invept"]; +$VM_ENTRY[51] = ["rdtscp"]; +$VM_ENTRY[52] = ["vmx-preemption timer expired"]; +$VM_ENTRY[53] = ["invvpid"]; +$VM_ENTRY[54] = ["wbinvd"]; +$VM_ENTRY[55] = ["xsetbv"]; +$VM_ENTRY[56] = ["APIC write"]; +$VM_ENTRY[57] = ["rdrand"]; +$VM_ENTRY[58] = ["invpcid"]; +$VM_ENTRY[59] = ["vmfunc"]; + + +$VM_SUB[0] = ["PF_XEN"]; +$VM_SUB[1] = ["PF_INJECT"]; +$VM_SUB[2] = ["INJ_EXC"]; +$VM_SUB[3] = ["INJ_VIRQ"]; +$VM_SUB[4] = ["REINJ_VIRQ"]; +$VM_SUB[5] = ["IO_READ"]; +$VM_SUB[6] = ["IO_WRITE"]; +$VM_SUB[7] = ["CR_READ"]; +$VM_SUB[8] = ["CR_WRITE"]; +$VM_SUB[9] = ["DR_READ"]; +$VM_SUB[10] = ["DR_WRITE"]; +$VM_SUB[11] = ["MSR_READ"]; +$VM_SUB[12] = ["MSR_WRITE"]; +$VM_SUB[13] = ["CPUID"]; +$VM_SUB[14] = ["INTR"]; +$VM_SUB[15] = ["NMI"]; +$VM_SUB[16] = ["SMI"]; +$VM_SUB[17] = ["VMMCALL"]; +$VM_SUB[18] = ["HLT"]; +$VM_SUB[19] = ["INVLPG"]; +$VM_SUB[20] = ["NODEVICE"]; +$VM_SUB[21] = ["GUEST_FAULT"]; + +my $SHADOW_FAULT_count = 0; +my $SHADOW_FAULT_totaltime = 0; +#Error code of PAGE_FAULT +# +#THE FAULT WAS CAUSED BY A NOT-PRESENT PAGE. +#THE ACCESS CAUSING THE FAULT WAS A READ. +#THE ACCESS CAUSING THE FAULT ORIGINATED WHEN THE +#PROCESSOR WAS EXECUTING IN SUPERVISOR MODE. +my $PAGE_FAULT_ERROR_CODE0_count = 0; +my $PAGE_FAULT_ERROR_CODE0_totaltime = 0; +#THE FAULT WAS CAUSED BY A PAGE-LEVEL PROTECTION VIOLATION. +#THE ACCESS CAUSING THE FAULT WAS A READ. +#THE ACCESS CAUSING THE FAULT ORIGINATED WHEN THE +#PROCESSOR WAS EXECUTING IN SUPERVISOR MODE. +my $PAGE_FAULT_ERROR_CODE1_count = 0; +my $PAGE_FAULT_ERROR_CODE1_totaltime = 0; +#THE FAULT WAS CAUSED BY A NOT-PRESENT PAGE. +#THE ACCESS CAUSING THE FAULT WAS A WRITE. +#THE ACCESS CAUSING THE FAULT ORIGINATED WHEN THE +#PROCESSOR WAS EXECUTING IN SUPERVISOR MODE. +my $PAGE_FAULT_ERROR_CODE2_count = 0; +my $PAGE_FAULT_ERROR_CODE2_totaltime = 0; +#THE FAULT WAS CAUSED BY A PAGE-LEVEL PROTECTION VIOLATION. +#THE ACCESS CAUSING THE FAULT WAS A WRITE. +#THE ACCESS CAUSING THE FAULT ORIGINATED WHEN THE +#PROCESSOR WAS EXECUTING IN USER MODE. +my $PAGE_FAULT_ERROR_CODE3_count = 0; +my $PAGE_FAULT_ERROR_CODE3_totaltime = 0; +#THE FAULT WAS CAUSED BY A NOT-PRESENT PAGE. +#THE ACCESS CAUSING THE FAULT WAS A READ. +#THE ACCESS CAUSING THE FAULT ORIGINATED WHEN THE +#PROCESSOR WAS EXECUTING IN USER MODE. +my $PAGE_FAULT_ERROR_CODE4_count = 0; +my $PAGE_FAULT_ERROR_CODE4_totaltime = 0; +#THE FAULT WAS CAUSED BY A PAGE-LEVEL PROTECTION VIOLATION. +#THE ACCESS CAUSING THE FAULT WAS A READ. +#THE ACCESS CAUSING THE FAULT ORIGINATED WHEN THE +#PROCESSOR WAS EXECUTING IN USER MODE. +my $PAGE_FAULT_ERROR_CODE5_count = 0; +my $PAGE_FAULT_ERROR_CODE5_totaltime = 0; +#THE FAULT WAS CAUSED BY A NOT-PRESENT PAGE. +#THE ACCESS CAUSING THE FAULT WAS A WRITE. +#THE ACCESS CAUSING THE FAULT ORIGINATED WHEN THE +#PROCESSOR WAS EXECUTING IN USER MODE. +my $PAGE_FAULT_ERROR_CODE6_count = 0; +my $PAGE_FAULT_ERROR_CODE6_totaltime = 0; +#THE FAULT WAS CAUSED BY A PAGE-LEVEL PROTECTION VIOLATION. +#THE ACCESS CAUSING THE FAULT WAS A WRITE. +#THE ACCESS CAUSING THE FAULT ORIGINATED WHEN THE +#PROCESSOR WAS EXECUTING IN USER MODE. +my $PAGE_FAULT_ERROR_CODE7_count = 0; +my $PAGE_FAULT_ERROR_CODE7_totaltime = 0; + +my $PAGE_FAULT_ERROR_CODE8_count = 0; +my $PAGE_FAULT_ERROR_CODE8_totaltime = 0; + +my $PAGE_FAULT_ERROR_CODE9_count = 0; +my $PAGE_FAULT_ERROR_CODE9_totaltime = 0; + +my $PAGE_FAULT_ERROR_CODE10_count = 0; +my $PAGE_FAULT_ERROR_CODE10_totaltime = 0; + +my $PAGE_FAULT_ERROR_CODE11_count = 0; +my $PAGE_FAULT_ERROR_CODE11_totaltime = 0; + +my $PAGE_FAULT_ERROR_CODE12_count = 0; +my $PAGE_FAULT_ERROR_CODE12_totaltime = 0; + +my $PAGE_FAULT_ERROR_CODE13_count = 0; +my $PAGE_FAULT_ERROR_CODE13_totaltime = 0; + +my $PAGE_FAULT_ERROR_CODE14_count = 0; +my $PAGE_FAULT_ERROR_CODE14_totaltime = 0; + +my $PAGE_FAULT_ERROR_CODE15_count = 0; +my $PAGE_FAULT_ERROR_CODE15_totaltime = 0; + +#other cases +my $PAGE_FAULT_ERROR_CODE16_count = 0; +my $PAGE_FAULT_ERROR_CODE16_totaltime = 0; + + +for ($i=0;$i<256;$i++){ + $VECTOR[$i]->[0]=$i; +} + +$generate_table = undef; +$exit_flag = 0; +$startflag = 0; +$errorcode = -1; +$port = -1; +$intr = 0; + +$sub_table = $VM_SUB[5]; +for($i=0;$i<65536;$i++) +{ + $sub_table->[$i] = 0; +} + +$sub_table = $VM_SUB[6]; +for($i=0;$i<65536;$i++) +{ + $sub_table->[$i] = 0; +} + +while ( <> ) { + chomp; + ($cpuid, $tsc, $diff, $useless, $flag, @left) = split /\s+/; + if ($flag eq "VMENTRY") { + next if($exit_flag != 1); + $exit_flag = 0; + + $endtsc = $tsc; + $end = $tsc; + $tscdiff = $endtsc - $starttsc; + $totaltsc += $tscdiff; + $totalcount += 1; + $generate_table->[1] += $tscdiff; + $generate_table->[2] += 1; + + next if(! defined $sub_table); + + if($intr == 1) { + $sub_table->[1] += $tscdiff; + $sub_table->[2] += 1; + $intr = 0; + } + elsif($errorcode >= 0) { + $sub_table->[1] += $tscdiff; + $sub_table->[2] += 1; + update_errorcode($errorcode,$tscdiff); + $errorcode = -1; + } + elsif($port != -1) { + $sub_table->[$port] += 1; + $port = -1; + } + else { + $sub_table->[1] += $tscdiff; + $sub_table->[2] += 1; + } + } + # If there are lost records, restart from next VMEXIT + elsif ($flag eq "lost_records") { + printf("lost_records...\n"); + $exit_flag = 0; + } + elsif ($flag eq "VMEXIT") { + $typeid = get_typeid(\@left); + $generate_table = $VM_ENTRY[$typeid]; + $starttsc = $tsc; + $exit_flag = 1; + $sub_table = undef; + if ($startflag == 0) { + $start = $tsc; + $startflag = 1; + } + } + elsif ($flag eq "PF_XEN") { + $sub_table = $VM_SUB[0]; + $errorcode = get_errorcode(\@left); + } + elsif ($flag eq "INTR") { + $vector = get_vector(\@left); + $sub_table = $VECTOR[$vector]; + $intr = 1; + } + elsif ($flag eq "IO_READ") { + $port = get_port(\@left); + $sub_table = $VM_SUB[5]; + } + elsif ($flag eq "IO_WRITE") { + $port = get_port(\@left); + $sub_table = $VM_SUB[6]; + } + elsif ($flag eq "NODEVICE") { + $sub_table = $VM_SUB[20]; + } + elsif ($flag eq "GUEST_FAULT") { + $sub_table = $VM_SUB[21]; + } +} + +&generate_report; + +sub generate_report { + my $i; + printf("Start record TSC: %d\nEnd record TSC: %d\nTSC Offset: %d (%.2fs)\n\n",$start,$end,$end-$start,($end-$start)/$freq); + printf("VMExit TSC: %d\nTSC Ratio: %.2f\n\nVMExit Count: %d\n", $totaltsc, ($totaltsc/($end-$start)),$totalcount); + printf("%20s%15s%15s%15s%15s%15s\n","Type","Total TSC","TSC Ratio","Total Count","Count Ratio","Avg TSC"); + for ($i=0; $i<50; $i++) { + $generate_table=$VM_ENTRY[$i]; + + next if ($generate_table->[0] eq ""); + next if ($generate_table->[2] == 0); + if (defined $generate_table->[2]) { + printf("%20s%15d%15.2f%15d%15.2f%15d\n", $generate_table->[0], $generate_table->[1], $generate_table->[1]/$totaltsc, $generate_table->[2], $generate_table->[2]/$totalcount, $generate_table->[1]/$generate_table->[2]); + } + else { + printf("%20s%15d%15.2f%15d%15.2f%15d\n", $generate_table->[0], $generate_table->[1], $generate_table->[1]/$totaltsc, $generate_table->[2], $generate_table->[2]/$totalcount, 0); + } + } + + $generate_table = $VM_ENTRY[0]; + $sub_table = $VM_SUB[0]; + if ($generate_table->[1] !=0) { + printf("\n\nPF_XEN:\ncounts:%d\t\tTSC:%d\t\tTSC ratio of NMI/Exception=%.2f\n",$sub_table->[2],$sub_table->[1],$sub_table->[1]/$generate_table->[1]); + } + + printf("PAGE_FAULT_CODE details:\n"); + printf("CODE\t\tTSC\tCount\tTSC ratio\tAverage TSC\n"); + if($PAGE_FAULT_ERROR_CODE0_count != 0){ + printf("0: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE0_totaltime,$PAGE_FAULT_ERROR_CODE0_count,$PAGE_FAULT_ERROR_CODE0_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE0_totaltime/$PAGE_FAULT_ERROR_CODE0_count); + } + if($PAGE_FAULT_ERROR_CODE1_count != 0){ + printf("1: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE1_totaltime,$PAGE_FAULT_ERROR_CODE1_count,$PAGE_FAULT_ERROR_CODE1_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE1_totaltime/$PAGE_FAULT_ERROR_CODE1_count); + } + if($PAGE_FAULT_ERROR_CODE2_count != 0){ + printf("2: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE2_totaltime,$PAGE_FAULT_ERROR_CODE2_count,$PAGE_FAULT_ERROR_CODE2_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE2_totaltime/$PAGE_FAULT_ERROR_CODE2_count); + } + if($PAGE_FAULT_ERROR_CODE3_count != 0){ + printf("3: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE3_totaltime,$PAGE_FAULT_ERROR_CODE3_count,$PAGE_FAULT_ERROR_CODE3_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE3_totaltime/$PAGE_FAULT_ERROR_CODE3_count); + } + if($PAGE_FAULT_ERROR_CODE4_count != 0){ + printf("4: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE4_totaltime,$PAGE_FAULT_ERROR_CODE4_count,$PAGE_FAULT_ERROR_CODE4_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE4_totaltime/$PAGE_FAULT_ERROR_CODE4_count); + } + if($PAGE_FAULT_ERROR_CODE5_count != 0){ + printf("5: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE5_totaltime,$PAGE_FAULT_ERROR_CODE5_count,$PAGE_FAULT_ERROR_CODE5_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE5_totaltime/$PAGE_FAULT_ERROR_CODE5_count); + } + if($PAGE_FAULT_ERROR_CODE6_count != 0){ + printf("6: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE6_totaltime,$PAGE_FAULT_ERROR_CODE6_count,$PAGE_FAULT_ERROR_CODE6_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE6_totaltime/$PAGE_FAULT_ERROR_CODE6_count); + } + if($PAGE_FAULT_ERROR_CODE7_count != 0){ + printf("7: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE7_totaltime,$PAGE_FAULT_ERROR_CODE7_count,$PAGE_FAULT_ERROR_CODE7_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE7_totaltime/$PAGE_FAULT_ERROR_CODE7_count); + } + if($PAGE_FAULT_ERROR_CODE8_count != 0){ + printf("8: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE8_totaltime,$PAGE_FAULT_ERROR_CODE8_count,$PAGE_FAULT_ERROR_CODE8_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE8_totaltime/$PAGE_FAULT_ERROR_CODE8_count); + } + if($PAGE_FAULT_ERROR_CODE9_count != 0){ + printf("9: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE9_totaltime,$PAGE_FAULT_ERROR_CODE9_count,$PAGE_FAULT_ERROR_CODE9_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE9_totaltime/$PAGE_FAULT_ERROR_CODE9_count); + } + if($PAGE_FAULT_ERROR_CODE10_count != 0){ + printf("10: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE10_totaltime,$PAGE_FAULT_ERROR_CODE10_count,$PAGE_FAULT_ERROR_CODE10_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE10_totaltime/$PAGE_FAULT_ERROR_CODE10_count); + } + if($PAGE_FAULT_ERROR_CODE11_count != 0){ + printf("11: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE11_totaltime,$PAGE_FAULT_ERROR_CODE11_count,$PAGE_FAULT_ERROR_CODE11_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE11_totaltime/$PAGE_FAULT_ERROR_CODE11_count); + } + if($PAGE_FAULT_ERROR_CODE12_count != 0){ + printf("12: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE12_totaltime,$PAGE_FAULT_ERROR_CODE12_count,$PAGE_FAULT_ERROR_CODE12_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE12_totaltime/$PAGE_FAULT_ERROR_CODE12_count); + } + if($PAGE_FAULT_ERROR_CODE13_count != 0){ + printf("13: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE13_totaltime,$PAGE_FAULT_ERROR_CODE13_count,$PAGE_FAULT_ERROR_CODE13_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE13_totaltime/$PAGE_FAULT_ERROR_CODE13_count); + } + if($PAGE_FAULT_ERROR_CODE14_count != 0){ + printf("14: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE14_totaltime,$PAGE_FAULT_ERROR_CODE14_count,$PAGE_FAULT_ERROR_CODE14_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE14_totaltime/$PAGE_FAULT_ERROR_CODE14_count); + } + if($PAGE_FAULT_ERROR_CODE15_count != 0){ + printf("15: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE15_totaltime,$PAGE_FAULT_ERROR_CODE15_count,$PAGE_FAULT_ERROR_CODE15_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE15_totaltime/$PAGE_FAULT_ERROR_CODE15_count); + } + if($PAGE_FAULT_ERROR_CODE16_count != 0){ + printf("Others: \t%10d\t%6d\t%6.2f\t%15d\n",$PAGE_FAULT_ERROR_CODE16_totaltime,$PAGE_FAULT_ERROR_CODE16_count,$PAGE_FAULT_ERROR_CODE16_totaltime/$SHADOW_FAULT_totaltime,$PAGE_FAULT_ERROR_CODE16_totaltime/$PAGE_FAULT_ERROR_CODE16_count); + } + + printf("\n\nGuest fault details:\n"); + printf("Total TSC\tcounts\tAverage TSC\n"); + $sub_table = $VM_SUB[21]; + if ($sub_table->[2] != 0) { + printf("%10d\t%6d\t%15d\n", $sub_table->[1], $sub_table->[2], $sub_table->[1]/$sub_table->[2]); + } + + printf("\n\nNo device details:\n"); + printf("Total TSC\tcounts\tAverage TSC\n"); + $sub_table = $VM_SUB[20]; + if ($sub_table->[2] != 0) { + printf("%10d\t%6d\t%15d\n", $sub_table->[1], $sub_table->[2], $sub_table->[1]/$sub_table->[2]); + } + + printf("\n\nInterrupt details:\n"); + printf("vector\tcounts\tcount ratio\tTSC\tTSC ratio\tAverage TSC\n"); + $generate_table = $VM_ENTRY[1]; + for($i=0;$i<256;$i++){ + $sub_table = $VECTOR[$i]; + next if ($sub_table->[2] eq undef); + printf("#0x%x\t%5d\t%5.2f\t%10d\t%5.2f\t%15d\n",$sub_table->[0],$sub_table->[2],$sub_table->[2]/$generate_table->[2],$sub_table->[1],$sub_table->[1]/$generate_table->[1],$sub_table->[1]/$sub_table->[2]); + } + printf("\n\nIO details:\n"); + printf("IO read:\n"); + printf("port\tcounts\n"); + $sub_table = $VM_SUB[5]; + for($i=0;$i<65536;$i++){ + next if($sub_table->[$i] eq 0); + printf("0x%x\t%d\n",$i,$sub_table->[$i]); + } + printf("\nIO write:\n"); + printf("port\tcounts\n"); + $sub_table = $VM_SUB[6]; + for($i=0;$i<65536;$i++){ + next if($sub_table->[$i] eq 0); + printf("0x%x\t%d\n",$i,$sub_table->[$i]); + } +} + +sub get_typeid { + my ($temp1, $temp2) = split /exitcode\ \=\ /, "@{$_[0]}"; + ($temp1) = split /\ /, $temp2; + return hex $temp1; +} + +sub get_errorcode{ + my ($temp1, $temp2) = split /errorcode\ \=\ /, "@{$_[0]}"; + ($temp1) = split /\ /, $temp2; + return hex $temp1; +} + +sub get_vector{ + my ($temp1, $temp2) = split /vector\ \=\ /,"@{$_[0]}"; + ($temp1) = split /\ /, $temp2; + return hex $temp1; +} + +sub get_port{ + my ($temp1, $temp2) = split /port\ \=\ /,"@{$_[0]}"; + ($temp1) = split /\,/, $temp2; + return hex $temp1; +} + + +sub update_errorcode{ + my $code = $_[0]; + my $time = $_[1]; + + $SHADOW_FAULT_count += 1; + $SHADOW_FAULT_totaltime += $time; + + if($code eq 0){ + $PAGE_FAULT_ERROR_CODE0_count += 1; + $PAGE_FAULT_ERROR_CODE0_totaltime += $time; + } + elsif($code eq 1){ + $PAGE_FAULT_ERROR_CODE1_count += 1; + $PAGE_FAULT_ERROR_CODE1_totaltime += $time; + } + elsif($code eq 2){ + $PAGE_FAULT_ERROR_CODE2_count += 1; + $PAGE_FAULT_ERROR_CODE2_totaltime += $time; + } + elsif($code eq 3){ + $PAGE_FAULT_ERROR_CODE3_count += 1; + $PAGE_FAULT_ERROR_CODE3_totaltime += $time; + } + elsif($code eq 4){ + $PAGE_FAULT_ERROR_CODE4_count += 1; + $PAGE_FAULT_ERROR_CODE4_totaltime += $time; + } + elsif($code eq 5){ + $PAGE_FAULT_ERROR_CODE5_count += 1; + $PAGE_FAULT_ERROR_CODE5_totaltime += $time; + } + elsif($code eq 6){ + $PAGE_FAULT_ERROR_CODE6_count += 1; + $PAGE_FAULT_ERROR_CODE6_totaltime += $time; + } + elsif($code eq 7){ + $PAGE_FAULT_ERROR_CODE7_count += 1; + $PAGE_FAULT_ERROR_CODE7_totaltime += $time; + } + elsif($code eq 8){ + $PAGE_FAULT_ERROR_CODE8_count += 1; + $PAGE_FAULT_ERROR_CODE8_totaltime += $time; + } + elsif($code eq 9){ + $PAGE_FAULT_ERROR_CODE9_count += 1; + $PAGE_FAULT_ERROR_CODE9_totaltime += $time; + } + elsif($code eq 10){ + $PAGE_FAULT_ERROR_CODE10_count += 1; + $PAGE_FAULT_ERROR_CODE10_totaltime += $time; + } + elsif($code eq 11){ + $PAGE_FAULT_ERROR_CODE11_count += 1; + $PAGE_FAULT_ERROR_CODE11_totaltime += $time; + } + elsif($code eq 12){ + $PAGE_FAULT_ERROR_CODE12_count += 1; + $PAGE_FAULT_ERROR_CODE12_totaltime += $time; + } + elsif($code eq 13){ + $PAGE_FAULT_ERROR_CODE13_count += 1; + $PAGE_FAULT_ERROR_CODE13_totaltime += $time; + } + elsif($code eq 14){ + $PAGE_FAULT_ERROR_CODE14_count += 1; + $PAGE_FAULT_ERROR_CODE14_totaltime += $time; + } + elsif($code eq 15){ + $PAGE_FAULT_ERROR_CODE15_count += 1; + $PAGE_FAULT_ERROR_CODE15_totaltime += $time; + } + else{ + $PAGE_FAULT_ERROR_CODE16_count += 1; + $PAGE_FAULT_ERROR_CODE16_totaltime += $time; + } +}
Signature · 1 line
1.7.1.1
Quoted 4 lines · Yang Zhang
From: Yang Zhang <[email protected]>
The tool is able to provide a summary of vmexit. Currently, it only supports to summay one VCPU result at a time.
Have you seen xenalyze?
hg clone http://xenbits.xen.org/ext/xenalyze
-George
George Dunlap wrote on 2013-08-09:
Quoted 9 lines · Yang Zhang
Quoted 4 lines
From: Yang Zhang <[email protected]>
The tool is able to provide a summary of vmexit. Currently, it only supports to summay one VCPU result at a time.
Have you seen xenalyze?
hg clone http://xenbits.xen.org/ext/xenalyze
Thanks. Now I see it. It's a great tool.
Best regards,
Yang
Zhang, Yang Z wrote on 2013-08-09:
Quoted 5 lines
George Dunlap wrote on 2013-08-09:
Quoted 1 line
On Fri, Aug 9, 2013 at 7:34 AM, Yang Zhang <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
From: Yang Zhang <[email protected]>
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
The tool is able to provide a summary of vmexit. Currently, it only supports to summay one VCPU result at a time.
Have you seen xenalyze?
hg clone http://xenbits.xen.org/ext/xenalyze
Thanks. Now I see it. It's a great tool.
Does it integrate to Xen source? If no, it's better to add it to tool/xentrace/ instead use a separate repo to let more people know it. :)
Best regards,
Yang
Quoted 6 lines · Yang Z
Zhang, Yang Z wrote on 2013-08-09:
Quoted 5 lines
George Dunlap wrote on 2013-08-09:
Quoted 1 line
On Fri, Aug 9, 2013 at 7:34 AM, Yang Zhang <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
From: Yang Zhang <[email protected]>
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
The tool is able to provide a summary of vmexit. Currently, it only supports to summay one VCPU result at a time.
Have you seen xenalyze?
hg clone http://xenbits.xen.org/ext/xenalyze
Thanks. Now I see it. It's a great tool.
Does it integrate to Xen source? If no, it's better to add it to tool/xentrace/ instead use a separate repo to let more people know it. :)
Yes, this has been suggested before. The original reason for having it be a separate repo is that most of the xenalyze development happened after a Xen release. But I think it has more or less reached a 1.0 level some time ago, and isn't seeing as many changes.
I'm not sure what it would take to get it checked into the main repo. At the moment the code is just one massive file (with a couple of helper files), and no doubt has a number of coding style inconsistencies - though I there is certainly worse code in the tree. :-)
Ian / Ian, any thoughts?
-George
Quoted 20 lines · George Dunlap
Quoted 6 lines · Yang Z
Zhang, Yang Z wrote on 2013-08-09:
Quoted 5 lines
George Dunlap wrote on 2013-08-09:
Quoted 1 line
On Fri, Aug 9, 2013 at 7:34 AM, Yang Zhang <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
From: Yang Zhang <[email protected]>
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
The tool is able to provide a summary of vmexit. Currently, it only supports to summay one VCPU result at a time.
Have you seen xenalyze?
hg clone http://xenbits.xen.org/ext/xenalyze
Thanks. Now I see it. It's a great tool.
Does it integrate to Xen source? If no, it's better to add it to tool/xentrace/ instead use a separate repo to let more people know it. :)
Yes, this has been suggested before. The original reason for having it be a separate repo is that most of the xenalyze development happened after a Xen release. But I think it has more or less reached a 1.0 level some time ago, and isn't seeing as many changes.
Quoted 7 lines
I'm not sure what it would take to get it checked into the main repo. At the moment the code is just one massive file (with a couple of helper files), and no doubt has a number of coding style inconsistencies - though I there is certainly worse code in the tree. :-)
Ian / Ian, any thoughts?
My opinion is that it should have the same treatment as any new code added - adhere to the StyleGuide.
That is the same way as it is done in the Linux code - if somebody wants to add an out-off-tree driver that has diverged from the StyleGuide
- well, one has to fix it up.
This is what I did for Xen blkback, pciback, pcifront, and I am sure that is what Ian C did for Xen netback as well.
Quoted 27 lines · Konrad Rzeszutek Wilk
Quoted 26 lines · George Dunlap
Quoted 6 lines · Yang Z
Zhang, Yang Z wrote on 2013-08-09:
Quoted 5 lines
George Dunlap wrote on 2013-08-09:
Quoted 1 line
On Fri, Aug 9, 2013 at 7:34 AM, Yang Zhang <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
From: Yang Zhang <[email protected]>
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
The tool is able to provide a summary of vmexit. Currently, it only supports to summay one VCPU result at a time.
Have you seen xenalyze?
hg clone http://xenbits.xen.org/ext/xenalyze
Thanks. Now I see it. It's a great tool.
Does it integrate to Xen source? If no, it's better to add it to tool/xentrace/ instead use a separate repo to let more people know it. :)
Yes, this has been suggested before. The original reason for having it be a separate repo is that most of the xenalyze development happened after a Xen release. But I think it has more or less reached a 1.0 level some time ago, and isn't seeing as many changes.
I'm not sure what it would take to get it checked into the main repo. At the moment the code is just one massive file (with a couple of helper files), and no doubt has a number of coding style inconsistencies - though I there is certainly worse code in the tree. :-)
Quoted 4 lines
Quoted 1 line
Ian / Ian, any thoughts?
My opinion is that it should have the same treatment as any new code added - adhere to the StyleGuide.
I was mostly asking about having one monolithic file vs. being broken down further.
If it requires many changes, I won't personally have time to get to it this release cycle. If anyone else wanted to clean it up and submit on the other hand... :-)
-George
George Dunlap writes ("Re: [Xen-devel] [PATCH] xentrace: add a tool to break down the result of vmexit"):
Quoted 8 lines
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · George Dunlap
I'm not sure what it would take to get it checked into the main repo. At the moment the code is just one massive file (with a couple of helper files), and no doubt has a number of coding style inconsistencies - though I there is certainly worse code in the tree. :-)
I think there is no problem introducing it into the main tree.
If we reach consensus, I would be happy to do that as a subtree merge followed by adjustments to the build machinery. (So we would import with a git version of the existing history.)
Things that I think might need attention and haven't seen discussed are:
1. Build system. Can it easily be plumbed into the build system for tools ?
2. Copyright. Does the xenalyse history contain good copyright information for all the code ?
Quoted 2 lines
Quoted 2 lines
My opinion is that it should have the same treatment as any new code added - adhere to the StyleGuide.
I don't think we should block addition of new code under a new tools/ directory for style reasons. tools/ is already full of code under a variety of different styles. Our practice has been to insist that each directory has a single style, and to expect changes to maintain the style of existing code.
Quoted 3 lines
If it requires many changes, I won't personally have time to get to it this release cycle. If anyone else wanted to clean it up and submit on the other hand... :-)
Do you have it in the form of a git tree we could merge ?
Ian.
Quoted 15 lines · Ian Jackson
George Dunlap writes ("Re: [Xen-devel] [PATCH] xentrace: add a tool to break down the result of vmexit"):
Quoted 8 lines
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · George Dunlap
I'm not sure what it would take to get it checked into the main repo. At the moment the code is just one massive file (with a couple of helper files), and no doubt has a number of coding style inconsistencies - though I there is certainly worse code in the tree. :-)
I think there is no problem introducing it into the main tree.
If we reach consensus, I would be happy to do that as a subtree merge followed by adjustments to the build machinery. (So we would import with a git version of the existing history.)
Quoted 5 lines
Things that I think might need attention and haven't seen discussed are:
1. Build system. Can it easily be plumbed into the build system for tools ?
There shouldn't be a major problem integrating it into the build system.
One issue at the moment is that it requires the GNU arg parsing library, so it would either need to be ported to the older POSIX arg parsing stuff to build on BSD, or just be disabled on systems without it. I would prefer the second, because I think the GNU library is much better. But I don't know the policy for the tools tree. (Christoph Egger may want to make a case for moving to the POSIX arg parsing library.)
Quoted 2 lines
2. Copyright. Does the xenalyse history contain good copyright information for all the code ?
Yes. It was developed entirely by myself, while working for Citrix, until the time that I made it public; after that time I required the standard Signed-off-by's (and included them in my own commits).
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
My opinion is that it should have the same treatment as any new code added - adhere to the StyleGuide.
I don't think we should block addition of new code under a new
tools/directory for style reasons.tools/is already full of code under a variety of different styles. Our practice has been to insist that each directory has a single style, and to expect changes to maintain the style of existing code.
It's mostly consistent with the hypervisor style, but tended to drift a bit when I started doing more coding for the toolstack. :-/
Quoted 4 lines
Quoted 3 lines
If it requires many changes, I won't personally have time to get to it this release cycle. If anyone else wanted to clean it up and submit on the other hand... :-)
Do you have it in the form of a git tree we could merge ?
It's in mercurial at the moment. I'm sure it wouldn't be too hard to do a one-time translation into git which you could then pull.
-George
George Dunlap writes ("Re: [Xen-devel] [PATCH] xentrace: add a tool to break down the result of vmexit"):
Quoted 12 lines · Ian Jackson
Quoted 2 lines
1. Build system. Can it easily be plumbed into the build system for tools ?
There shouldn't be a major problem integrating it into the build system.
One issue at the moment is that it requires the GNU arg parsing library, so it would either need to be ported to the older POSIX arg parsing stuff to build on BSD, or just be disabled on systems without it. I would prefer the second, because I think the GNU library is much better. But I don't know the policy for the tools tree. (Christoph Egger may want to make a case for moving to the POSIX arg parsing library.)
You mean it depends on glibc's version of getopt ?
I wouldn't have a problem with disabling it on systems without a "sufficiently good" getopt. If Christoph would like to submit portability patches I'm sure you'd welcome them ? :-)
Quoted 6 lines
Quoted 2 lines
2. Copyright. Does the xenalyse history contain good copyright information for all the code ?
Yes. It was developed entirely by myself, while working for Citrix, until the time that I made it public; after that time I required the standard Signed-off-by's (and included them in my own commits).
Good.
Quoted 2 lines
It's mostly consistent with the hypervisor style, but tended to drift a bit when I started doing more coding for the toolstack. :-/
Right. I have no problem with this.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
If it requires many changes, I won't personally have time to get to it this release cycle. If anyone else wanted to clean it up and submit on the other hand... :-)
Do you have it in the form of a git tree we could merge ?
It's in mercurial at the moment. I'm sure it wouldn't be too hard to do a one-time translation into git which you could then pull.
Right.
Ian.