aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Yan <[email protected]>2023-03-15 22:51:04 +0800
committerArnaldo Carvalho de Melo <[email protected]>2023-03-15 16:46:53 -0300
commit001b08f4e2aab9748b5d5e49b68d5444715ffda9 (patch)
tree6acb9136ed6d71bd910a8317899e4e7eeeabe70a
parent730651f7177f473345ab470db212c7b5a18466f0 (diff)
perf kvm: Parse address location for samples
Parse address location for samples and save it into the structure 'perf_kvm_stat', it is to be used by histograms entry. Reviewed-by: James Clark <[email protected]> Signed-off-by: Leo Yan <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/builtin-kvm.c5
-rw-r--r--tools/perf/util/kvm-stat.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index ef502c19bc40..17a8219a702a 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -706,6 +706,11 @@ static int process_sample_event(struct perf_tool *tool,
if (skip_sample(kvm, sample))
return 0;
+ if (machine__resolve(machine, &kvm->al, sample) < 0) {
+ pr_warning("Fail to resolve address location, skip sample.\n");
+ return 0;
+ }
+
thread = machine__findnew_thread(machine, sample->pid, sample->tid);
if (thread == NULL) {
pr_debug("problem processing %d event, skipping it.\n",
diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h
index e2c17662bac7..3b2eab91a9be 100644
--- a/tools/perf/util/kvm-stat.h
+++ b/tools/perf/util/kvm-stat.h
@@ -7,6 +7,7 @@
#include "tool.h"
#include "sort.h"
#include "stat.h"
+#include "symbol.h"
#include "record.h"
#define KVM_EVENT_NAME_LEN 40
@@ -88,6 +89,9 @@ struct perf_kvm_stat {
const char *sort_key;
int trace_vcpu;
+ /* Used when process events */
+ struct addr_location al;
+
struct exit_reasons_table *exit_reasons;
const char *exit_reasons_isa;