From: Jiri Olsa <jolsa@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@kernel.org>
Subject: [PATCH 03/27] perf hists: Add support for accumulated stat of hist entry
Date: Sun, 1 Jun 2014 15:31:14 +0200 [thread overview]
Message-ID: <1401629498-8726-4-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1401629498-8726-1-git-send-email-jolsa@kernel.org>
From: Namhyung Kim <namhyung@kernel.org>
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.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arun Sharma <asharma@fb.com>
Tested-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1401335910-16832-4-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/hist.c | 28 ++++++++++++++++++++++++++--
tools/perf/util/sort.h | 1 +
tools/perf/util/symbol.h | 1 +
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d866235..dfff2ee 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -232,6 +232,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);
diff = prev_period - he->stat.period;
@@ -279,12 +281,26 @@ void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel)
static struct hist_entry *hist_entry__new(struct hist_entry *template)
{
- size_t callchain_size = symbol_conf.use_callchain ? sizeof(struct callchain_root) : 0;
- struct hist_entry *he = zalloc(sizeof(*he) + callchain_size);
+ size_t callchain_size = 0;
+ struct hist_entry *he;
+
+ if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain)
+ callchain_size = sizeof(struct callchain_root);
+
+ he = zalloc(sizeof(*he) + callchain_size);
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 +312,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;
}
@@ -359,6 +376,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 sample__resolve_mem
@@ -394,6 +413,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;
}
@@ -768,6 +789,7 @@ void hist_entry__free(struct hist_entry *he)
{
zfree(&he->branch_info);
zfree(&he->mem_info);
+ zfree(&he->stat_acc);
free_srcline(he->srcline);
free(he);
}
@@ -793,6 +815,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 5f38d92..c9ffa03 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -82,6 +82,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 33ede53..615c752 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -109,6 +109,7 @@ struct symbol_conf {
show_nr_samples,
show_total_period,
use_callchain,
+ cumulate_callchain,
exclude_other,
show_cpu_utilization,
initialized,
--
1.8.3.1
next prev parent reply other threads:[~2014-06-01 13:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-01 13:31 [GIT PULL 00/27] perf/core improvements and fixes Jiri Olsa
2014-06-01 13:31 ` [PATCH 01/27] perf tools: Introduce hists__inc_nr_samples() Jiri Olsa
2014-06-01 13:31 ` [PATCH 02/27] perf tools: Introduce struct hist_entry_iter Jiri Olsa
2014-06-01 13:31 ` Jiri Olsa [this message]
2014-06-01 13:31 ` [PATCH 04/27] perf hists: Check if accumulated when adding a hist entry Jiri Olsa
2014-06-01 13:31 ` [PATCH 05/27] perf hists: Accumulate hist entry stat based on the callchain Jiri Olsa
2014-06-01 13:31 ` [PATCH 06/27] perf tools: Update cpumode for each cumulative entry Jiri Olsa
2014-06-01 13:31 ` [PATCH 07/27] perf report: Cache cumulative callchains Jiri Olsa
2014-06-01 13:31 ` [PATCH 08/27] perf callchain: Add callchain_cursor_snapshot() Jiri Olsa
2014-06-01 13:31 ` [PATCH 09/27] perf tools: Save callchain info for each cumulative entry Jiri Olsa
2014-06-01 13:31 ` [PATCH 10/27] perf ui/hist: Add support to accumulated hist stat Jiri Olsa
2014-06-01 13:31 ` [PATCH 11/27] perf ui/browser: " Jiri Olsa
2014-06-01 13:31 ` [PATCH 12/27] perf ui/gtk: " Jiri Olsa
2014-06-01 13:31 ` [PATCH 13/27] perf tools: Apply percent-limit to cumulative percentage Jiri Olsa
2014-06-01 13:31 ` [PATCH 14/27] perf tools: Add more hpp helper functions Jiri Olsa
2014-06-01 13:31 ` [PATCH 15/27] perf report: Add --children option Jiri Olsa
2014-06-01 13:31 ` [PATCH 16/27] perf report: Add report.children config option Jiri Olsa
2014-06-01 13:31 ` [PATCH 17/27] perf tools: Do not auto-remove Children column if --fields given Jiri Olsa
2014-06-01 13:31 ` [PATCH 18/27] perf tools: Add callback function to hist_entry_iter Jiri Olsa
2014-06-01 13:31 ` [PATCH 19/27] perf top: Convert " Jiri Olsa
2014-06-01 13:31 ` [PATCH 20/27] perf top: Add --children option Jiri Olsa
2014-06-01 13:31 ` [PATCH 21/27] perf top: Add top.children config option Jiri Olsa
2014-06-01 13:31 ` [PATCH 22/27] perf tools: Enable --children option by default Jiri Olsa
2014-06-01 13:31 ` [PATCH 23/27] perf ui/stdio: Fix invalid percentage value of cumulated hist entries Jiri Olsa
2014-06-01 13:31 ` [PATCH 24/27] perf ui/gtk: Fix callchain display Jiri Olsa
2014-06-01 13:31 ` [PATCH 25/27] perf tools: Reset output/sort order to default Jiri Olsa
2014-06-01 13:31 ` [PATCH 26/27] perf tests: Define and use symbolic names for fake symbols Jiri Olsa
2014-06-01 13:31 ` [PATCH 27/27] perf tests: Add a test case for cumulating callchains Jiri Olsa
2014-06-03 18:23 ` [GIT PULL 00/27] perf/core improvements and fixes Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2014-05-29 3:58 [PATCHSET 00/27] perf tools: Add support to accumulate hist periods (v11) Namhyung Kim
2014-05-29 3:58 ` [PATCH 03/27] perf hists: Add support for accumulated stat of hist entry 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=1401629498-8726-4-git-send-email-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.