From: Steven Rostedt <rostedt@goodmis.org>
To: Josef Bacik <jbacik@fb.com>
Cc: <linux-kernel@vger.kernel.org>, <kernel-team@fb.com>
Subject: Re: [PATCH V2] trace-cmd: add option to group like comms for profile
Date: Wed, 24 Jun 2015 23:07:48 -0400 [thread overview]
Message-ID: <20150624230748.70e088f2@grimm.local.home> (raw)
In-Reply-To: <1432229408-1479-1-git-send-email-jbacik@fb.com>
On Thu, 21 May 2015 13:30:08 -0400
Josef Bacik <jbacik@fb.com> wrote:
> V1->V2:
> -renamed the option to --by-comm, added it to trace-cmd report --profile as well
> -fixed up the string hash
Or break it ;-)
> -changed it to merge all events after the fact so it's less error prone
> diff --git a/trace-hash-local.h b/trace-hash-local.h
> index 997b11c..eaeeaaf 100644
> --- a/trace-hash-local.h
> +++ b/trace-hash-local.h
> @@ -48,4 +48,13 @@ static inline unsigned int trace_hash(int val)
> return hash;
> }
>
> +static inline unsigned int trace_hash_str(char *str)
> +{
> + int val = 0;
> + int i;
> +
> + for (i = 0; str[i]; i++)
> + val += ((int)str[i]) << (i & 0xffffff);
> + return trace_hash(val);
> +}
>
I need to clean out my medicine cabinet and remove all the expired
meds. Because I was definitely taking something nasty when I
recommended (i & 0xffffff)!
When i is greater than 32 (which is less than 0xffffff) it will
overflow the addition. What I wanted was that we don't shift more than
24 bits. Where 2 ** 24 - 1 == 0xffffff.
That should be:
val += ((int)str[i]) << (i % 25);
my bad :-/
To avoid the slow '%', I'll just use '& 0xf', as shifting it 16 times is
enough for this algorithm.
No need to send a new patch, I'll fix it, as it was my brain
fart. I'll review the rest of this patch too and apply it if nothing
sticks out.
Thanks!
-- Steve
next prev parent reply other threads:[~2015-06-25 3:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 17:30 Josef Bacik
2015-06-25 3:07 ` Steven Rostedt [this message]
2015-06-25 3:31 ` Steven Rostedt
2015-06-25 3:39 ` Steven Rostedt
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=20150624230748.70e088f2@grimm.local.home \
--to=rostedt@goodmis.org \
--cc=jbacik@fb.com \
--cc=kernel-team@fb.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
all inboxes | Powered by JetHome®