Re: buggy perf callgraph output

From: Ingo Molnar
Date: Thu Dec 23 2010 - 08:08:47 EST



* Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:

> On Fri, Dec 17, 2010 at 04:32:58PM +1100, Nick Piggin wrote:
> > That would be great, thanks! It's a really awesome tool, I appreciate
> > your effort on it.
>
> Thanks :)
>
> So the below patch should fix the issue. Tell me if you encounter it
> again, or anything else.
>
> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index d503670..c749ba6 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -356,7 +356,7 @@ static size_t ipchain__fprintf_graph_line(FILE *fp, int depth, int depth_mask,
>
> static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain,
> int depth, int depth_mask, int period,
> - u64 total_samples, int hits,
> + u64 total_samples, u64 hits,
> int left_margin)

Hmm ... nice fix but why didnt GCC warn about the loss of half of the 'cumul' bits
in this call:

ret += ipchain__fprintf_graph(fp, chain, depth,
new_depth_mask, i++,
new_total,
cumul,
left_margin);

We really, really want GCC to warn about this - it's such a common mistake. What
disabled that warning? Very weird.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/