[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230228115125.144172-6-leo.yan@linaro.org>
Date: Tue, 28 Feb 2023 19:51:16 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
James Clark <james.clark@....com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Leo Yan <leo.yan@...aro.org>
Subject: [PATCH v3 05/14] perf kvm: Introduce histograms data structures
This is a preparation to support histograms in perf kvm tool. As first
step, this patch defines histograms data structures and initialize them.
Signed-off-by: Leo Yan <leo.yan@...aro.org>
Reviewed-by: James Clark <james.clark@....com>
---
tools/perf/builtin-kvm.c | 18 ++++++++++++++++++
tools/perf/util/kvm-stat.h | 1 +
2 files changed, 19 insertions(+)
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 6eec0db2dda6..4ae54ba4fdaf 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -85,6 +85,20 @@ static struct kvm_event_key keys[] = {
{ NULL, NULL }
};
+struct kvm_hists {
+ struct hists hists;
+ struct perf_hpp_list list;
+};
+
+static struct kvm_hists kvm_hists;
+
+static int kvm_hists__init(void)
+{
+ __hists__init(&kvm_hists.hists, &kvm_hists.list);
+ perf_hpp_list__init(&kvm_hists.list);
+ return 0;
+}
+
static const char *get_filename_for_perf_kvm(void)
{
const char *filename;
@@ -957,6 +971,8 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm)
set_term_quiet_input(&save);
init_kvm_event_record(kvm);
+ kvm_hists__init();
+
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
@@ -1152,6 +1168,8 @@ static int kvm_events_report_vcpu(struct perf_kvm_stat *kvm)
init_kvm_event_record(kvm);
setup_pager();
+ kvm_hists__init();
+
ret = read_events(kvm);
if (ret)
goto exit;
diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h
index 40a4b66cfee6..a3219829c448 100644
--- a/tools/perf/util/kvm-stat.h
+++ b/tools/perf/util/kvm-stat.h
@@ -5,6 +5,7 @@
#ifdef HAVE_KVM_STAT_SUPPORT
#include "tool.h"
+#include "sort.h"
#include "stat.h"
#include "record.h"
--
2.34.1
Powered by blists - more mailing lists