From: Ingo Molnar <mingo@elte.hu>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 1/2] perf tools: Fix sample size bit operations
Date: Mon, 23 May 2011 13:28:15 +0200 [thread overview]
Message-ID: <20110523112815.GA4042@elte.hu> (raw)
In-Reply-To: <1306148788-6179-2-git-send-email-fweisbec@gmail.com>
* Frederic Weisbecker <fweisbec@gmail.com> wrote:
> What we want is to count the number of bits in the mask,
> not some other random operation written in the middle
> of the night.
>
> 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: Stephane Eranian <eranian@google.com>
> ---
> tools/perf/util/event.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index 17c1c3c..d3fa7e4 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -42,7 +42,7 @@ int perf_sample_size(u64 sample_type)
> int i;
>
> for (i = 0; i < 64; i++) {
> - if ((mask << i) & 1)
> + if (mask & (1 << i))
> size++;
> }
I fixed this to be 1UL and applied your fixes out of email - perf top and perf
report works fine now, so this was a 64-bitness bug (you probably used a 32-bit
system for testing?).
Btw., shouldnt this use hweight() or such?
Thanks,
Ingo
next prev parent reply other threads:[~2011-05-23 11:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-23 11:06 [GIT PULL] perf tools fixes Frederic Weisbecker
2011-05-23 11:06 ` [PATCH 1/2] perf tools: Fix sample size bit operations Frederic Weisbecker
2011-05-23 11:28 ` Ingo Molnar [this message]
2011-05-23 12:39 ` Frederic Weisbecker
2011-05-23 11:31 ` [tip:perf/urgent] " tip-bot for Frederic Weisbecker
2011-05-23 11:06 ` [PATCH 2/2] perf tools: Fix ommitted mmap data update on remap Frederic Weisbecker
2011-05-23 11:30 ` [tip:perf/urgent] " tip-bot for Frederic Weisbecker
2011-05-23 11:13 ` [GIT PULL] perf tools fixes Ingo Molnar
2011-05-23 11:18 ` Ingo Molnar
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=20110523112815.GA4042@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox