]> git.karo-electronics.de Git - linux-beck.git/commitdiff
perf kvm: Add skip_event() for --duration option
authorAlexander Yarygin <yarygin@linux.vnet.ibm.com>
Thu, 3 Jul 2014 14:29:06 +0000 (18:29 +0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 16 Jul 2014 20:57:32 +0000 (17:57 -0300)
Current code skips output of the x86 specific HLT event in order to
avoid flooding the output with enabled --duration option. The events to
be skipped should be architecture dependent, though.

Let's add an architecture specific array of events to be skipped and
introduce a skip_event() function checking against that array.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1404397747-20939-4-git-send-email-yarygin@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/x86/util/kvm-stat.c
tools/perf/builtin-kvm.c
tools/perf/util/kvm-stat.h

index 2f8d2c1af5cacef02eb12ab666354d7a180a8643..14e4e668fad733c1802908047ae524318aa586de 100644 (file)
@@ -136,6 +136,11 @@ struct kvm_reg_events_ops kvm_reg_events_ops[] = {
        { NULL, NULL },
 };
 
+const char * const kvm_skip_events[] = {
+       "HLT",
+       NULL,
+};
+
 int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid)
 {
        if (strstr(cpuid, "Intel")) {
index 75ee8c1a6baf2255a8c167f8bb6b35891ba41c33..fc2d63d3e79141a73408d64f6de48eeb31a45422 100644 (file)
@@ -261,6 +261,17 @@ static bool update_kvm_event(struct kvm_event *event, int vcpu_id,
        return true;
 }
 
+static bool skip_event(const char *event)
+{
+       const char * const *skip_events;
+
+       for (skip_events = kvm_skip_events; *skip_events; skip_events++)
+               if (!strcmp(event, *skip_events))
+                       return true;
+
+       return false;
+}
+
 static bool handle_end_event(struct perf_kvm_stat *kvm,
                             struct vcpu_event_record *vcpu_record,
                             struct event_key *key,
@@ -312,7 +323,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm,
                char decode[DECODE_STR_LEN];
 
                kvm->events_ops->decode_key(kvm, &event->key, decode);
-               if (strcmp(decode, "HLT")) {
+               if (!skip_event(decode)) {
                        pr_info("%" PRIu64 " VM %d, vcpu %d: %s event took %" PRIu64 "usec\n",
                                 sample->time, sample->pid, vcpu_record->vcpu_id,
                                 decode, time_diff/1000);
index d0d9fb1ae52a39a2678a0809fdbb1b79eaf8d835..ba937caa28ac2cbd9f4d00a7c9bdbc8f43c716b0 100644 (file)
@@ -126,5 +126,6 @@ int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid);
 
 extern const char * const kvm_events_tp[];
 extern struct kvm_reg_events_ops kvm_reg_events_ops[];
+extern const char * const kvm_skip_events[];
 
 #endif /* __PERF_KVM_STAT_H */