From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>,
Jin Yao <yao.jin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 01/12] perf hists: Save the callchain_size in struct hist_entry
Date: Mon, 11 Jun 2018 14:47:59 -0300 [thread overview]
Message-ID: <20180611174810.14815-2-acme@kernel.org> (raw)
In-Reply-To: <20180611174810.14815-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
So that we can figure out the real size of the struct and also be able
to tell if callchains may be present in this histogram entry.
Since we can't always guarantee that from hist_entry->hists we can use
hists_to_evsel, to then look at evsel->attr.sample_type for
PERF_SAMPLE_CALLCHAIN, like with the 'perf c2c' tool, that uses plain
'struct hists' instances, we need another way of deciding if a specific
hist_entry instance has callchains associated with it, i.e. if its
hist_entry->callchain[0] has space allocated for.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-ptvndealxs1k7myluvu9flnq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 6 ++++--
tools/perf/util/sort.h | 2 ++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 52e8fda93a47..0441a92b855f 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -370,9 +370,11 @@ void hists__delete_entries(struct hists *hists)
static int hist_entry__init(struct hist_entry *he,
struct hist_entry *template,
- bool sample_self)
+ bool sample_self,
+ size_t callchain_size)
{
*he = *template;
+ he->callchain_size = callchain_size;
if (symbol_conf.cumulate_callchain) {
he->stat_acc = malloc(sizeof(he->stat));
@@ -473,7 +475,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template,
he = ops->new(callchain_size);
if (he) {
- err = hist_entry__init(he, template, sample_self);
+ err = hist_entry__init(he, template, sample_self, callchain_size);
if (err) {
ops->free(he);
he = NULL;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 7cf2d5cc038e..9ab9257ed887 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -112,6 +112,8 @@ struct hist_entry {
char level;
u8 filtered;
+
+ u16 callchain_size;
union {
/*
* Since perf diff only supports the stdio output, TUI
--
2.14.3
next prev parent reply other threads:[~2018-06-11 17:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 17:47 [GIT PULL 00/12] perf/urgent fixes and improvements Arnaldo Carvalho de Melo
2018-06-11 17:47 ` Arnaldo Carvalho de Melo [this message]
2018-06-11 17:48 ` [PATCH 02/12] perf hists: Make hist_entry__has_callchains() work with 'perf c2c' Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 03/12] perf hists browser gtk: Use hist_entry__has_callchains() Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 04/12] perf hists: Reimplement hists__has_callchains() Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 05/12] perf tools: Fix error index for pmu event parser Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 06/12] perf stat: Add --interval-clear option Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 07/12] perf stat: Use only color_fprintf call in print_metric_only Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 08/12] perf stat: Fix metric column header display alignment Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 09/12] perf stat: Allow to specify specific metric column len Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 10/12] perf stat: Add event parsing error handling to add_default_attributes Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 11/12] perf c2c: Keep struct hist_entry at the end of struct c2c_hist_entry Arnaldo Carvalho de Melo
2018-06-11 17:48 ` [PATCH 12/12] perf script: Show hw-cache events Arnaldo Carvalho de Melo
2018-06-14 6:13 ` [GIT PULL 00/12] perf/urgent fixes and improvements Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180611174810.14815-2-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=wangnan0@huawei.com \
--cc=williams@redhat.com \
--cc=yao.jin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).