diff options
author | David Ahern <dsahern@gmail.com> | 2013-08-05 21:41:35 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-07 16:35:38 -0400 |
commit | 62d04dbf3652264157e646d93006b2d74cf1be93 (patch) | |
tree | a9134c7d84606d7d2690f5697e25cae9a1b19058 /tools | |
parent | 1afe1d148491069ef51ed69fa53b09e1cb3ec30d (diff) |
perf kvm: Add min and max stats to display
Add max and min times for exit events.
v2: address Xiao's comment to use get_event function for pulling max and
min from stats struct similar to mean and count
Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Runzhen Wang <runzhen@linux.vnet.ibm.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1375753297-69645-4-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-kvm.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 29bfca78613e..b6595e932a7f 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -337,14 +337,19 @@ static void clear_events_cache_stats(struct list_head *kvm_events_cache) | |||
337 | struct list_head *head; | 337 | struct list_head *head; |
338 | struct kvm_event *event; | 338 | struct kvm_event *event; |
339 | unsigned int i; | 339 | unsigned int i; |
340 | int j; | ||
340 | 341 | ||
341 | for (i = 0; i < EVENTS_CACHE_SIZE; i++) { | 342 | for (i = 0; i < EVENTS_CACHE_SIZE; i++) { |
342 | head = &kvm_events_cache[i]; | 343 | head = &kvm_events_cache[i]; |
343 | list_for_each_entry(event, head, hash_entry) { | 344 | list_for_each_entry(event, head, hash_entry) { |
344 | /* reset stats for event */ | 345 | /* reset stats for event */ |
345 | memset(&event->total, 0, sizeof(event->total)); | 346 | event->total.time = 0; |
346 | memset(event->vcpu, 0, | 347 | init_stats(&event->total.stats); |
347 | event->max_vcpu * sizeof(*event->vcpu)); | 348 | |
349 | for (j = 0; j < event->max_vcpu; ++j) { | ||
350 | event->vcpu[j].time = 0; | ||
351 | init_stats(&event->vcpu[j].stats); | ||
352 | } | ||
348 | } | 353 | } |
349 | } | 354 | } |
350 | } | 355 | } |
@@ -583,6 +588,8 @@ static int compare_kvm_event_ ## func(struct kvm_event *one, \ | |||
583 | GET_EVENT_KEY(time, time); | 588 | GET_EVENT_KEY(time, time); |
584 | COMPARE_EVENT_KEY(count, stats.n); | 589 | COMPARE_EVENT_KEY(count, stats.n); |
585 | COMPARE_EVENT_KEY(mean, stats.mean); | 590 | COMPARE_EVENT_KEY(mean, stats.mean); |
591 | GET_EVENT_KEY(max, stats.max); | ||
592 | GET_EVENT_KEY(min, stats.min); | ||
586 | 593 | ||
587 | #define DEF_SORT_NAME_KEY(name, compare_key) \ | 594 | #define DEF_SORT_NAME_KEY(name, compare_key) \ |
588 | { #name, compare_kvm_event_ ## compare_key } | 595 | { #name, compare_kvm_event_ ## compare_key } |
@@ -727,20 +734,26 @@ static void print_result(struct perf_kvm_stat *kvm) | |||
727 | pr_info("%9s ", "Samples%"); | 734 | pr_info("%9s ", "Samples%"); |
728 | 735 | ||
729 | pr_info("%9s ", "Time%"); | 736 | pr_info("%9s ", "Time%"); |
737 | pr_info("%10s ", "Min Time"); | ||
738 | pr_info("%10s ", "Max Time"); | ||
730 | pr_info("%16s ", "Avg time"); | 739 | pr_info("%16s ", "Avg time"); |
731 | pr_info("\n\n"); | 740 | pr_info("\n\n"); |
732 | 741 | ||
733 | while ((event = pop_from_result(&kvm->result))) { | 742 | while ((event = pop_from_result(&kvm->result))) { |
734 | u64 ecount, etime; | 743 | u64 ecount, etime, max, min; |
735 | 744 | ||
736 | ecount = get_event_count(event, vcpu); | 745 | ecount = get_event_count(event, vcpu); |
737 | etime = get_event_time(event, vcpu); | 746 | etime = get_event_time(event, vcpu); |
747 | max = get_event_max(event, vcpu); | ||
748 | min = get_event_min(event, vcpu); | ||
738 | 749 | ||
739 | kvm->events_ops->decode_key(kvm, &event->key, decode); | 750 | kvm->events_ops->decode_key(kvm, &event->key, decode); |
740 | pr_info("%20s ", decode); | 751 | pr_info("%20s ", decode); |
741 | pr_info("%10llu ", (unsigned long long)ecount); | 752 | pr_info("%10llu ", (unsigned long long)ecount); |
742 | pr_info("%8.2f%% ", (double)ecount / kvm->total_count * 100); | 753 | pr_info("%8.2f%% ", (double)ecount / kvm->total_count * 100); |
743 | pr_info("%8.2f%% ", (double)etime / kvm->total_time * 100); | 754 | pr_info("%8.2f%% ", (double)etime / kvm->total_time * 100); |
755 | pr_info("%8" PRIu64 "us ", min / 1000); | ||
756 | pr_info("%8" PRIu64 "us ", max / 1000); | ||
744 | pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount/1e3, | 757 | pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount/1e3, |
745 | kvm_event_rel_stddev(vcpu, event)); | 758 | kvm_event_rel_stddev(vcpu, event)); |
746 | pr_info("\n"); | 759 | pr_info("\n"); |