Commit 2d08124b authored by Leo Yan's avatar Leo Yan Committed by Arnaldo Carvalho de Melo

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.

Committer notes:

Those are only used by functions enclosed in:

  #if efined(HAVE_KVM_STAT_SUPPORT) && defined(HAVE_LIBTRACEEVENT)

So do this for these new functions and struct as well.
Reviewed-by: default avatarJames Clark <james.clark@arm.com>
Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 2d31e0bf
...@@ -85,6 +85,20 @@ static struct kvm_event_key keys[] = { ...@@ -85,6 +85,20 @@ static struct kvm_event_key keys[] = {
DEF_SORT_NAME_KEY(time, mean), DEF_SORT_NAME_KEY(time, mean),
{ NULL, NULL } { 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;
}
#endif // defined(HAVE_KVM_STAT_SUPPORT) && defined(HAVE_LIBTRACEEVENT) #endif // defined(HAVE_KVM_STAT_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
static const char *get_filename_for_perf_kvm(void) static const char *get_filename_for_perf_kvm(void)
...@@ -959,6 +973,8 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm) ...@@ -959,6 +973,8 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm)
set_term_quiet_input(&save); set_term_quiet_input(&save);
init_kvm_event_record(kvm); init_kvm_event_record(kvm);
kvm_hists__init();
signal(SIGINT, sig_handler); signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler); signal(SIGTERM, sig_handler);
...@@ -1154,6 +1170,8 @@ static int kvm_events_report_vcpu(struct perf_kvm_stat *kvm) ...@@ -1154,6 +1170,8 @@ static int kvm_events_report_vcpu(struct perf_kvm_stat *kvm)
init_kvm_event_record(kvm); init_kvm_event_record(kvm);
setup_pager(); setup_pager();
kvm_hists__init();
ret = read_events(kvm); ret = read_events(kvm);
if (ret) if (ret)
goto exit; goto exit;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifdef HAVE_KVM_STAT_SUPPORT #ifdef HAVE_KVM_STAT_SUPPORT
#include "tool.h" #include "tool.h"
#include "sort.h"
#include "stat.h" #include "stat.h"
#include "record.h" #include "record.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment