Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753473Ab3EIEdB (ORCPT ); Thu, 9 May 2013 00:33:01 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:60429 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753166Ab3EIEc1 (ORCPT ); Thu, 9 May 2013 00:32:27 -0400 From: David Ahern To: linux-kernel@vger.kernel.org Cc: acme@ghostprotocols.net, mingo@kernel.org, fweisbec@gmail.com, peterz@infradead.org, jolsa@redhat.com, namhyung@kernel.org, xiaoguangrong@linux.vnet.ibm.com, David Ahern Subject: [PATCH 11/13] perf kvm: add min and max stats to display Date: Wed, 8 May 2013 22:31:47 -0600 Message-Id: <1368073909-8825-12-git-send-email-dsahern@gmail.com> X-Mailer: git-send-email 1.7.10.1 In-Reply-To: <1368073909-8825-1-git-send-email-dsahern@gmail.com> References: <1368073909-8825-1-git-send-email-dsahern@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2782 Lines: 83 Signed-off-by: David Ahern Cc: Arnaldo Carvalho de Melo Cc: Ingo Molnar Cc: Frederic Weisbecker Cc: Peter Zijlstra Cc: Jiri Olsa Cc: Namhyung Kim Cc: Xiao Guangrong --- tools/perf/builtin-kvm.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 6071998..905aa75 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) struct list_head *head; struct kvm_event *event; unsigned int i; + int j; for (i = 0; i < EVENTS_CACHE_SIZE; i++) { head = &kvm_events_cache[i]; list_for_each_entry(event, head, hash_entry) { /* reset stats for event */ - memset(&event->total, 0, sizeof(event->total)); - memset(event->vcpu, 0, - event->max_vcpu * sizeof(*event->vcpu)); + event->total.time = 0; + init_stats(&event->total.stats); + + for (j = 0; j < event->max_vcpu; ++j) { + event->vcpu[j].time = 0; + init_stats(&event->vcpu[j].stats); + } } } } @@ -718,6 +723,7 @@ static void print_result(struct perf_kvm_stat *kvm) char decode[20]; struct kvm_event *event; int vcpu = kvm->trace_vcpu; + struct kvm_event_stats *kvm_stats; if (kvm->live) { puts(CONSOLE_CLEAR); @@ -731,6 +737,8 @@ static void print_result(struct perf_kvm_stat *kvm) pr_info("%9s ", "Samples%"); pr_info("%9s ", "Time%"); + pr_info("%10s ", "Min Time"); + pr_info("%10s ", "Max Time"); pr_info("%16s ", "Avg time"); pr_info("\n\n"); @@ -740,11 +748,18 @@ static void print_result(struct perf_kvm_stat *kvm) ecount = get_event_count(event, vcpu); etime = get_event_time(event, vcpu); + if (vcpu == -1) + kvm_stats = &event->total; + else + kvm_stats = &event->vcpu[vcpu]; + kvm->events_ops->decode_key(kvm, &event->key, decode); pr_info("%20s ", decode); pr_info("%10llu ", (unsigned long long)ecount); pr_info("%8.2f%% ", (double)ecount / kvm->total_count * 100); pr_info("%8.2f%% ", (double)etime / kvm->total_time * 100); + pr_info("%8" PRIu64 "us ", kvm_stats->stats.min / 1000); + pr_info("%8" PRIu64 "us ", kvm_stats->stats.max / 1000); pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount/1e3, kvm_event_rel_stddev(vcpu, event)); pr_info("\n"); -- 1.7.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/