From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung.kim@lge.com>,
LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Arun Sharma <asharma@fb.com>, Jiri Olsa <jolsa@redhat.com>,
Rodrigo Campos <rodrigo@sdfg.com.ar>
Subject: [PATCH 06/18] perf hists: Add support for accumulated stat of hist entry
Date: Wed, 18 Dec 2013 14:21:14 +0900 [thread overview]
Message-ID: <1387344086-12744-7-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1387344086-12744-1-git-send-email-namhyung@kernel.org>
From: Namhyung Kim <namhyung.kim@lge.com>
Maintain accumulated stat information in hist_entry->stat_acc if
symbol_conf.cumulate_callchain is set. Fields in ->stat_acc have same
vaules initially, and will be updated as callchain is processed later.
Cc: Arun Sharma <asharma@fb.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/hist.c | 18 ++++++++++++++++++
tools/perf/util/sort.h | 1 +
tools/perf/util/symbol.h | 1 +
3 files changed, 20 insertions(+)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 1f84314546a2..6dfa1b48a1a9 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -238,6 +238,8 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
return true;
he_stat__decay(&he->stat);
+ if (symbol_conf.cumulate_callchain)
+ he_stat__decay(he->stat_acc);
if (!he->filtered)
hists->stats.total_period -= prev_period - he->stat.period;
@@ -285,6 +287,15 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template)
if (he != NULL) {
*he = *template;
+ if (symbol_conf.cumulate_callchain) {
+ he->stat_acc = malloc(sizeof(he->stat));
+ if (he->stat_acc == NULL) {
+ free(he);
+ return NULL;
+ }
+ memcpy(he->stat_acc, &he->stat, sizeof(he->stat));
+ }
+
if (he->ms.map)
he->ms.map->referenced = true;
@@ -296,6 +307,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template)
*/
he->branch_info = malloc(sizeof(*he->branch_info));
if (he->branch_info == NULL) {
+ free(he->stat_acc);
free(he);
return NULL;
}
@@ -368,6 +380,8 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
if (!cmp) {
he_stat__add_period(&he->stat, period, weight);
+ if (symbol_conf.cumulate_callchain)
+ he_stat__add_period(he->stat_acc, period, weight);
/*
* This mem info was allocated from machine__resolve_mem
@@ -404,6 +418,8 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
rb_insert_color(&he->rb_node_in, hists->entries_in);
out:
he_stat__add_cpumode_period(&he->stat, al->cpumode, period);
+ if (symbol_conf.cumulate_callchain)
+ he_stat__add_cpumode_period(he->stat_acc, al->cpumode, period);
return he;
}
@@ -503,6 +519,8 @@ static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused,
if (!cmp) {
he_stat__add_stat(&iter->stat, &he->stat);
+ if (symbol_conf.cumulate_callchain)
+ he_stat__add_stat(iter->stat_acc, he->stat_acc);
if (symbol_conf.use_callchain) {
callchain_cursor_reset(&callchain_cursor);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 43e5ff42a609..309f2838a1b4 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -81,6 +81,7 @@ struct hist_entry {
struct list_head head;
} pairs;
struct he_stat stat;
+ struct he_stat *stat_acc;
struct map_symbol ms;
struct thread *thread;
struct comm *comm;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 8a9d910c5345..66f429633804 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -92,6 +92,7 @@ struct symbol_conf {
show_nr_samples,
show_total_period,
use_callchain,
+ cumulate_callchain,
exclude_other,
show_cpu_utilization,
initialized,
--
1.7.11.7
next prev parent reply other threads:[~2013-12-18 5:21 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 5:21 [RFC/PATCHSET 00/18] perf report: Add support to accumulate hist periods (v3) Namhyung Kim
2013-12-18 5:21 ` [PATCH 01/18] perf sort: Compare addresses if no symbol info Namhyung Kim
2013-12-18 15:38 ` Jiri Olsa
2013-12-18 17:35 ` Arnaldo Carvalho de Melo
2013-12-18 17:39 ` Arnaldo Carvalho de Melo
2013-12-19 7:17 ` Namhyung Kim
2014-01-12 18:30 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-12-18 5:21 ` [PATCH 02/18] perf sort: Do not compare dso again Namhyung Kim
2013-12-18 15:40 ` Jiri Olsa
2014-01-12 18:31 ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-12-18 5:21 ` [PATCH 03/18] perf tools: Do not pass period and weight to add_hist_entry() Namhyung Kim
2013-12-18 15:41 ` Jiri Olsa
2014-01-12 18:31 ` [tip:perf/core] perf hists: " tip-bot for Namhyung Kim
2013-12-18 5:21 ` [PATCH 04/18] perf tools: Introduce struct add_entry_iter Namhyung Kim
2013-12-18 15:50 ` Jiri Olsa
2013-12-19 7:15 ` Namhyung Kim
2013-12-18 5:21 ` [PATCH 05/18] perf hists: Convert hist entry functions to use struct he_stat Namhyung Kim
2013-12-18 5:21 ` Namhyung Kim [this message]
2013-12-18 5:21 ` [PATCH 07/18] perf hists: Check if accumulated when adding a hist entry Namhyung Kim
2013-12-18 5:21 ` [PATCH 08/18] perf hists: Accumulate hist entry stat based on the callchain Namhyung Kim
2013-12-18 5:21 ` [PATCH 09/18] perf tools: Update cpumode for each cumulative entry Namhyung Kim
2013-12-18 5:21 ` [PATCH 10/18] perf report: Cache cumulative callchains Namhyung Kim
2013-12-18 5:21 ` [PATCH 11/18] perf hists: Sort hist entries by accumulated period Namhyung Kim
2013-12-18 5:21 ` [PATCH 12/18] perf ui/hist: Add support to accumulated hist stat Namhyung Kim
2013-12-18 5:21 ` [PATCH 13/18] perf ui/browser: " Namhyung Kim
2013-12-18 5:21 ` [PATCH 14/18] perf ui/gtk: " Namhyung Kim
2013-12-18 5:21 ` [PATCH 15/18] perf tools: Apply percent-limit to cumulative percentage Namhyung Kim
2013-12-18 5:21 ` [PATCH 16/18] perf tools: Add more hpp helper functions Namhyung Kim
2013-12-18 5:21 ` [PATCH 17/18] perf report: Add --cumulate option Namhyung Kim
2013-12-18 5:21 ` [PATCH 18/18] perf report: Add report.cumulate config option Namhyung Kim
2013-12-18 9:46 ` [RFC/PATCHSET 00/18] perf report: Add support to accumulate hist periods (v3) Ingo Molnar
2013-12-18 10:38 ` Arun Sharma
2013-12-18 14:39 ` Namhyung Kim
2013-12-23 9:16 ` Arun Sharma
2013-12-24 7:59 ` Namhyung Kim
2013-12-18 14:37 ` Namhyung Kim
2013-12-18 17:47 ` Arnaldo Carvalho de Melo
2013-12-19 7:20 ` Namhyung Kim
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=1387344086-12744-7-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=asharma@fb.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=paulus@samba.org \
--cc=rodrigo@sdfg.com.ar \
/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
all inboxes | Powered by JetHome®