* [PATCH] perf top: Decay periods in callchains
@ 2016-01-05 3:06 Namhyung Kim
2016-01-08 15:38 ` Arnaldo Carvalho de Melo
2016-01-09 16:36 ` [tip:perf/core] " tip-bot for Namhyung Kim
0 siblings, 2 replies; 3+ messages in thread
From: Namhyung Kim @ 2016-01-05 3:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
Andi Kleen, Frederic Weisbecker
It missed to decay periods in callchains when decaying hist entries.
This resulted in more than 100 percent overhead in callchains in the
fractal style output.
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/callchain.c | 28 ++++++++++++++++++++++++++++
tools/perf/util/callchain.h | 1 +
tools/perf/util/hist.c | 1 +
3 files changed, 30 insertions(+)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 564377d2bebf..53c43eb9489e 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -925,6 +925,34 @@ void free_callchain(struct callchain_root *root)
free_callchain_node(&root->node);
}
+static u64 decay_callchain_node(struct callchain_node *node)
+{
+ struct callchain_node *child;
+ struct rb_node *n;
+ u64 child_hits = 0;
+
+ n = rb_first(&node->rb_root_in);
+ while (n) {
+ child = container_of(n, struct callchain_node, rb_node_in);
+
+ child_hits += decay_callchain_node(child);
+ n = rb_next(n);
+ }
+
+ node->hit = (node->hit * 7) / 8;
+ node->children_hit = child_hits;
+
+ return node->hit;
+}
+
+void decay_callchain(struct callchain_root *root)
+{
+ if (!symbol_conf.use_callchain)
+ return;
+
+ decay_callchain_node(&root->node);
+}
+
int callchain_node__make_parent_list(struct callchain_node *node)
{
struct callchain_node *parent = node->parent;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 8ac8f043004c..18dd22269764 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -253,6 +253,7 @@ int callchain_node__fprintf_value(struct callchain_node *node,
FILE *fp, u64 total);
void free_callchain(struct callchain_root *root);
+void decay_callchain(struct callchain_root *root);
int callchain_node__make_parent_list(struct callchain_node *node);
#endif /* __PERF_CALLCHAIN_H */
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index afc9b8f1b36c..888776b43cb0 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -254,6 +254,7 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
he_stat__decay(&he->stat);
if (symbol_conf.cumulate_callchain)
he_stat__decay(he->stat_acc);
+ decay_callchain(he->callchain);
diff = prev_period - he->stat.period;
--
2.6.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf top: Decay periods in callchains
2016-01-05 3:06 [PATCH] perf top: Decay periods in callchains Namhyung Kim
@ 2016-01-08 15:38 ` Arnaldo Carvalho de Melo
2016-01-09 16:36 ` [tip:perf/core] " tip-bot for Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-08 15:38 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
Andi Kleen, Frederic Weisbecker
Em Tue, Jan 05, 2016 at 12:06:00PM +0900, Namhyung Kim escreveu:
> It missed to decay periods in callchains when decaying hist entries.
> This resulted in more than 100 percent overhead in callchains in the
> fractal style output.
Thanks, applied!
> Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/callchain.c | 28 ++++++++++++++++++++++++++++
> tools/perf/util/callchain.h | 1 +
> tools/perf/util/hist.c | 1 +
> 3 files changed, 30 insertions(+)
>
> diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
> index 564377d2bebf..53c43eb9489e 100644
> --- a/tools/perf/util/callchain.c
> +++ b/tools/perf/util/callchain.c
> @@ -925,6 +925,34 @@ void free_callchain(struct callchain_root *root)
> free_callchain_node(&root->node);
> }
>
> +static u64 decay_callchain_node(struct callchain_node *node)
> +{
> + struct callchain_node *child;
> + struct rb_node *n;
> + u64 child_hits = 0;
> +
> + n = rb_first(&node->rb_root_in);
> + while (n) {
> + child = container_of(n, struct callchain_node, rb_node_in);
> +
> + child_hits += decay_callchain_node(child);
> + n = rb_next(n);
> + }
> +
> + node->hit = (node->hit * 7) / 8;
> + node->children_hit = child_hits;
> +
> + return node->hit;
> +}
> +
> +void decay_callchain(struct callchain_root *root)
> +{
> + if (!symbol_conf.use_callchain)
> + return;
> +
> + decay_callchain_node(&root->node);
> +}
> +
> int callchain_node__make_parent_list(struct callchain_node *node)
> {
> struct callchain_node *parent = node->parent;
> diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
> index 8ac8f043004c..18dd22269764 100644
> --- a/tools/perf/util/callchain.h
> +++ b/tools/perf/util/callchain.h
> @@ -253,6 +253,7 @@ int callchain_node__fprintf_value(struct callchain_node *node,
> FILE *fp, u64 total);
>
> void free_callchain(struct callchain_root *root);
> +void decay_callchain(struct callchain_root *root);
> int callchain_node__make_parent_list(struct callchain_node *node);
>
> #endif /* __PERF_CALLCHAIN_H */
> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index afc9b8f1b36c..888776b43cb0 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -254,6 +254,7 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
> he_stat__decay(&he->stat);
> if (symbol_conf.cumulate_callchain)
> he_stat__decay(he->stat_acc);
> + decay_callchain(he->callchain);
>
> diff = prev_period - he->stat.period;
>
> --
> 2.6.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] perf top: Decay periods in callchains
2016-01-05 3:06 [PATCH] perf top: Decay periods in callchains Namhyung Kim
2016-01-08 15:38 ` Arnaldo Carvalho de Melo
@ 2016-01-09 16:36 ` tip-bot for Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-01-09 16:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, mingo, hpa, acme, andi, fweisbec,
a.p.zijlstra, namhyung, jolsa, dsahern, tglx
Commit-ID: 42b276a2351517409d55b1202a1fa8b05c0cdc99
Gitweb: http://git.kernel.org/tip/42b276a2351517409d55b1202a1fa8b05c0cdc99
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 5 Jan 2016 12:06:00 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 8 Jan 2016 12:37:51 -0300
perf top: Decay periods in callchains
It missed to decay periods in callchains when decaying hist entries.
This resulted in more than 100 percent overhead in callchains in the
fractal style output.
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1451963160-17196-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/callchain.c | 28 ++++++++++++++++++++++++++++
tools/perf/util/callchain.h | 1 +
tools/perf/util/hist.c | 1 +
3 files changed, 30 insertions(+)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 564377d..53c43eb 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -925,6 +925,34 @@ void free_callchain(struct callchain_root *root)
free_callchain_node(&root->node);
}
+static u64 decay_callchain_node(struct callchain_node *node)
+{
+ struct callchain_node *child;
+ struct rb_node *n;
+ u64 child_hits = 0;
+
+ n = rb_first(&node->rb_root_in);
+ while (n) {
+ child = container_of(n, struct callchain_node, rb_node_in);
+
+ child_hits += decay_callchain_node(child);
+ n = rb_next(n);
+ }
+
+ node->hit = (node->hit * 7) / 8;
+ node->children_hit = child_hits;
+
+ return node->hit;
+}
+
+void decay_callchain(struct callchain_root *root)
+{
+ if (!symbol_conf.use_callchain)
+ return;
+
+ decay_callchain_node(&root->node);
+}
+
int callchain_node__make_parent_list(struct callchain_node *node)
{
struct callchain_node *parent = node->parent;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 8ac8f043..18dd222 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -253,6 +253,7 @@ int callchain_node__fprintf_value(struct callchain_node *node,
FILE *fp, u64 total);
void free_callchain(struct callchain_root *root);
+void decay_callchain(struct callchain_root *root);
int callchain_node__make_parent_list(struct callchain_node *node);
#endif /* __PERF_CALLCHAIN_H */
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index afc9b8f..888776b 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -254,6 +254,7 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
he_stat__decay(&he->stat);
if (symbol_conf.cumulate_callchain)
he_stat__decay(he->stat_acc);
+ decay_callchain(he->callchain);
diff = prev_period - he->stat.period;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-09 16:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-05 3:06 [PATCH] perf top: Decay periods in callchains Namhyung Kim
2016-01-08 15:38 ` Arnaldo Carvalho de Melo
2016-01-09 16:36 ` [tip:perf/core] " tip-bot for Namhyung Kim
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.