public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] perf fixlet
@ 2010-07-16  2:58 Frederic Weisbecker
  2010-07-16 19:18 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2010-07-16  2:58 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Paul Mackerras

Ingo,

Please pull the perf/urgent branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	perf/urgent

Thanks,
	Frederic
---

Frederic Weisbecker (1):
      perf: Fix various display bugs with parent filtering


 tools/perf/util/hist.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

---
commit 58c3439083f8fde61de842c93d1407f0f881cd92
Author: Frederic Weisbecker <fweisbec@gmail.com>
Date:   Fri Jul 16 04:02:14 2010 +0200

    perf: Fix various display bugs with parent filtering
    
    Hists that have been filtered, because they don't have callchains
    matching the parent filter, won't be printed. As such,
    hist_entry__snprintf() returns 0 for them, but we don't control
    this value and we always print the buffer, which might be
    untouched and then only made of random stack garbage.
    
    Not only does it paint the screen with barf, it also prints
    the callchains for these hists, even though they have been filtered,
    since the hist has been filtered as well.
    
    We need to check the return value of hist_entry__snprintf() and
    ignore the hist if it is 0, which means it didn't get any callchain
    matching the parent filter. This fixes the barf and the undesired
    callchains.
    
    Reported-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Paul Mackerras <paulus@samba.org>

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 07f89b6..699cf81 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -631,9 +631,14 @@ int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
 			u64 session_total)
 {
 	char bf[512];
-	hist_entry__snprintf(self, bf, sizeof(bf), pair_hists,
-			     show_displacement, displacement,
-			     true, session_total);
+	int ret;
+
+	ret = hist_entry__snprintf(self, bf, sizeof(bf), pair_hists,
+				   show_displacement, displacement,
+				   true, session_total);
+	if (!ret)
+		return 0;
+
 	return fprintf(fp, "%s\n", bf);
 }
 
@@ -762,6 +767,7 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
 print_entries:
 	for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
 		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+		int cnt;
 
 		if (show_displacement) {
 			if (h->pair != NULL)
@@ -771,8 +777,13 @@ print_entries:
 				displacement = 0;
 			++position;
 		}
-		ret += hist_entry__fprintf(h, pair, show_displacement,
-					   displacement, fp, self->stats.total_period);
+		cnt = hist_entry__fprintf(h, pair, show_displacement,
+					  displacement, fp, self->stats.total_period);
+		/* Ignore those that didn't match the parent filter */
+		if (!cnt)
+			continue;
+
+		ret += cnt;
 
 		if (symbol_conf.use_callchain)
 			ret += hist_entry__fprintf_callchain(h, fp, self->stats.total_period);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [GIT PULL] perf fixlet
  2010-07-16  2:58 [GIT PULL] perf fixlet Frederic Weisbecker
@ 2010-07-16 19:18 ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2010-07-16 19:18 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, Peter Zijlstra, Arnaldo Carvalho de Melo, Paul Mackerras


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> Ingo,
> 
> Please pull the perf/urgent branch that can be found at:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
> 	perf/urgent
> 
> Thanks,
> 	Frederic
> ---
> 
> Frederic Weisbecker (1):
>       perf: Fix various display bugs with parent filtering
> 
> 
>  tools/perf/util/hist.c |   21 ++++++++++++++++-----
>  1 files changed, 16 insertions(+), 5 deletions(-)

Pulled, thanks Frederic!

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [GIT PULL] perf fixlet
@ 2010-08-22  4:05 Frederic Weisbecker
  0 siblings, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2010-08-22  4:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Christoph Hellwig, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Paul Mackerras,
	2 . 6 . 32 . x-2 . 6 . 35 . y

Ingo,

Please pull the perf/urgent branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	perf/urgent

Thanks,
	Frederic
---

Frederic Weisbecker (1):
      perf: Initialize callchains roots's childen hits


 tools/perf/util/callchain.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

---
commit 944c88c5ebf7bead43a98fc4cb89b195ee8792d1
Author: Frederic Weisbecker <fweisbec@gmail.com>
Date:   Sun Aug 22 04:29:17 2010 +0200

    perf: Initialize callchains roots's childen hits
    
    Each histogram entry has a callchain root that stores the
    callchain samples. However we forgot to initialize the
    tracking of children hits of these roots, which then got
    random values on their creation.
    
    The root children hits is multiplied by the minimum percentage
    of hits provided by the user, and the result becomes the minimum
    hits expected from children branches. If the random value due
    to the uninitialization is big enough, then this minimum number
    of hits can be huge and eventually filter every children branches.
    
    The end result was invisible callchains. All we need to
    fix this is to initialize the children hits of the root.
    
    Reported-by: Christoph Hellwig <hch@infradead.org>
    Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: 2.6.32.x-2.6.35.y <stable@kernel.org>

diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 624a96c..6de4313 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -50,6 +50,7 @@ static inline void callchain_init(struct callchain_node *node)
 	INIT_LIST_HEAD(&node->children);
 	INIT_LIST_HEAD(&node->val);
 
+	node->children_hit = 0;
 	node->parent = NULL;
 	node->hit = 0;
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-22  4:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-16  2:58 [GIT PULL] perf fixlet Frederic Weisbecker
2010-07-16 19:18 ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2010-08-22  4:05 Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox