Patchwork KVM:PPC:clean up in-kernel exit_timing statistics

login
register
mail settings
Submitter Olivia Yin
Date May 22, 2012, 8:37 a.m.
Message ID <1337675877-2949-1-git-send-email-hong-hua.yin@freescale.com>
Download mbox | patch
Permalink /patch/160567/
State New
Headers show

Comments

Olivia Yin - May 22, 2012, 8:37 a.m.
1. Line up the columns with headings.
2. Add units for min/max/sum columns.
3. add_exit_timing only count the exited types. For other types, the min value 
should be zero, instead of the init value (0xFFFFFFFF).

Signed-off-by: Olivia Yin <hong-hua.yin@freescale.com>
---
 arch/powerpc/kvm/timing.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

Patch

diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
index 07b6110..11a67db 100644
--- a/arch/powerpc/kvm/timing.c
+++ b/arch/powerpc/kvm/timing.c
@@ -144,13 +144,18 @@  static int kvmppc_exit_timing_show(struct seq_file *m, void *private)
 	int i;
 	u64 min, max, sum, sum_quad;
 
-	seq_printf(m, "%s", "type	count	min	max	sum	sum_squared\n");
+	seq_printf(m, "%s", "\ttype\t     count\t   min(ns)\t   max(ns)\
+		sum(ns)\t\t sum_squared\n");
 
 
 	for (i = 0; i < __NUMBER_OF_KVM_EXIT_TYPES; i++) {
 
-		min = vcpu->arch.timing_min_duration[i];
-		do_div(min, tb_ticks_per_usec);
+		if (vcpu->arch.timing_count_type[i] != 0) {
+			min = vcpu->arch.timing_min_duration[i];
+			do_div(min, tb_ticks_per_usec);
+		} else {
+			min = 0;
+		}
 		max = vcpu->arch.timing_max_duration[i];
 		do_div(max, tb_ticks_per_usec);
 		sum = vcpu->arch.timing_sum_duration[i];
@@ -158,7 +163,7 @@  static int kvmppc_exit_timing_show(struct seq_file *m, void *private)
 		sum_quad = vcpu->arch.timing_sum_quad_duration[i];
 		do_div(sum_quad, tb_ticks_per_usec);
 
-		seq_printf(m, "%12s	%10d	%10lld	%10lld	%20lld	%20lld\n",
+		seq_printf(m, "%12s	%10d	%10lld	%10lld	%15lld	%20lld\n",
 			kvm_exit_names[i],
 			vcpu->arch.timing_count_type[i],
 			min,