aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorAlexander Yarygin <yarygin@linux.vnet.ibm.com>2014-07-03 10:29:06 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-07-16 16:57:32 -0400
commit54c801ff71ba9c9ae41871e226b9d846ff9c6bab (patch)
treef76af7d6d25bbf56be31d9c3bddaaae77205aa76 /tools/perf
parent9daa81239e60c162153fb2a365b8492c9a9bf632 (diff)
perf kvm: Add skip_event() for --duration option
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>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/arch/x86/util/kvm-stat.c5
-rw-r--r--tools/perf/builtin-kvm.c13
-rw-r--r--tools/perf/util/kvm-stat.h1
3 files changed, 18 insertions, 1 deletions
diff --git a/tools/perf/arch/x86/util/kvm-stat.c b/tools/perf/arch/x86/util/kvm-stat.c
index 2f8d2c1af5ca..14e4e668fad7 100644
--- a/tools/perf/arch/x86/util/kvm-stat.c
+++ b/tools/perf/arch/x86/util/kvm-stat.c
@@ -136,6 +136,11 @@ struct kvm_reg_events_ops kvm_reg_events_ops[] = {
136 { NULL, NULL }, 136 { NULL, NULL },
137}; 137};
138 138
139const char * const kvm_skip_events[] = {
140 "HLT",
141 NULL,
142};
143
139int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid) 144int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid)
140{ 145{
141 if (strstr(cpuid, "Intel")) { 146 if (strstr(cpuid, "Intel")) {
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 75ee8c1a6baf..fc2d63d3e791 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -261,6 +261,17 @@ static bool update_kvm_event(struct kvm_event *event, int vcpu_id,
261 return true; 261 return true;
262} 262}
263 263
264static bool skip_event(const char *event)
265{
266 const char * const *skip_events;
267
268 for (skip_events = kvm_skip_events; *skip_events; skip_events++)
269 if (!strcmp(event, *skip_events))
270 return true;
271
272 return false;
273}
274
264static bool handle_end_event(struct perf_kvm_stat *kvm, 275static bool handle_end_event(struct perf_kvm_stat *kvm,
265 struct vcpu_event_record *vcpu_record, 276 struct vcpu_event_record *vcpu_record,
266 struct event_key *key, 277 struct event_key *key,
@@ -312,7 +323,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm,
312 char decode[DECODE_STR_LEN]; 323 char decode[DECODE_STR_LEN];
313 324
314 kvm->events_ops->decode_key(kvm, &event->key, decode); 325 kvm->events_ops->decode_key(kvm, &event->key, decode);
315 if (strcmp(decode, "HLT")) { 326 if (!skip_event(decode)) {
316 pr_info("%" PRIu64 " VM %d, vcpu %d: %s event took %" PRIu64 "usec\n", 327 pr_info("%" PRIu64 " VM %d, vcpu %d: %s event took %" PRIu64 "usec\n",
317 sample->time, sample->pid, vcpu_record->vcpu_id, 328 sample->time, sample->pid, vcpu_record->vcpu_id,
318 decode, time_diff/1000); 329 decode, time_diff/1000);
diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h
index d0d9fb1ae52a..ba937caa28ac 100644
--- a/tools/perf/util/kvm-stat.h
+++ b/tools/perf/util/kvm-stat.h
@@ -126,5 +126,6 @@ int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid);
126 126
127extern const char * const kvm_events_tp[]; 127extern const char * const kvm_events_tp[];
128extern struct kvm_reg_events_ops kvm_reg_events_ops[]; 128extern struct kvm_reg_events_ops kvm_reg_events_ops[];
129extern const char * const kvm_skip_events[];
129 130
130#endif /* __PERF_KVM_STAT_H */ 131#endif /* __PERF_KVM_STAT_H */