linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jin, Yao" <yao.jin@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v6 2/7] perf/x86/intel: Record branch type
Date: Wed, 10 May 2017 08:18:37 +0800	[thread overview]
Message-ID: <29d920f3-3491-2be2-f9f7-795e23217621@linux.intel.com> (raw)
In-Reply-To: <20170509123913.GC9983@krava>



On 5/9/2017 8:39 PM, Jiri Olsa wrote:
> On Tue, May 09, 2017 at 07:57:11PM +0800, Jin, Yao wrote:
>
> SNIP
>
>>>>>> +
>>>>>> +	type >>= 2; /* skip X86_BR_USER and X86_BR_KERNEL */
>>>>>> +	mask = ~(~0 << 1);
>>>>> is that a fancy way to get 1 into the mask? what do I miss?
>>> you did not comment on this one
>> Sorry, I misunderstood that this comment and the next comment had the same
>> meaning.
>>
>> In the previous version, I used the switch/case to convert from X86_BR to
>> PERF_BR. I got a comment from community that it'd better use a lookup table
>> for conversion.
>>
>> Since each bit in type represents a X86_BR type so I use a mask (0x1) to
>> filter the bit. Yes, it looks I can also directly set 0x1 to mask.
>>
>> I write the code "mask = ~(~0 << 1)" according to my coding habits. If you
>> think I should change the code to "mask = 0x1", that's OK  :)
> im ok with that.. was just wondering for the reason
> I guess compiler will make it single constant assignment anyway

I think so.  The compiler should be clever enough for this optimization.
>>>>>> +
>>>>>> +	for (i = 0; i < X86_BR_TYPE_MAP_MAX; i++) {
>>>>>> +		if (type & mask)
>>>>>> +			return branch_map[i];
>>>>> I wonder some bit search would be faster in here, but maybe not big deal
>>>>>
>>>>> jirka
>>>> I just think the branch_map[] doesn't contain many entries (16 entries
>>>> here), so maybe checking 1 bit one time should be acceptable. I just want to
>>>> keep the code simple.
>>>>
>>>> But if the number of entries is more (e.g. 64), maybe it'd better check 2 or
>>>> 4 bits one time.
>>> ook
>>>
>>> jirka
>> Sorry, what's the meaning of ook? Does it mean "OK"?
> just means ok ;-)
>
> thanks,
> jirka

Thanks so much!

Jin Yao

  reply	other threads:[~2017-05-10  0:18 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 12:07 [PATCH v6 0/7] perf report: Show branch type Jin Yao
2017-04-20  9:36 ` Jiri Olsa
2017-04-23  8:36   ` Jin, Yao
2017-06-02  8:02   ` Jin, Yao
2017-06-26  6:24     ` Jin, Yao
2017-07-06  1:47       ` Jin, Yao
2017-04-20 12:07 ` [PATCH v6 1/7] perf/core: Define the common branch type classification Jin Yao
2017-07-07  8:42   ` Peter Zijlstra
2017-07-10  5:19     ` Michael Ellerman
2017-07-10  6:05   ` Michael Ellerman
2017-07-10  8:16     ` Jin, Yao
2017-07-10 10:32       ` Michael Ellerman
2017-07-10 11:46         ` Jin, Yao
2017-07-10 13:10           ` Segher Boessenkool
2017-07-10 13:28             ` Jin, Yao
2017-07-10 13:46             ` Peter Zijlstra
2017-07-10 14:06               ` Jin, Yao
2017-07-11  2:28                 ` Michael Ellerman
2017-07-11  3:00                   ` Jin, Yao
2017-07-10 14:37               ` Segher Boessenkool
2017-07-11  2:13             ` Michael Ellerman
2017-04-20 12:07 ` [PATCH v6 2/7] perf/x86/intel: Record branch type Jin Yao
2017-04-23 13:55   ` Jiri Olsa
2017-04-24  0:47     ` Jin, Yao
2017-05-08  0:49       ` Jin, Yao
2017-05-09  8:26       ` Jiri Olsa
2017-05-09 11:57         ` Jin, Yao
2017-05-09 12:39           ` Jiri Olsa
2017-05-10  0:18             ` Jin, Yao [this message]
2017-04-20 12:07 ` [PATCH v6 3/7] perf record: Create a new option save_type in --branch-filter Jin Yao
2017-04-20 12:07 ` [PATCH v6 4/7] perf report: Refactor the branch info printing code Jin Yao
2017-04-20 12:07 ` [PATCH v6 5/7] perf util: Create branch.c/.h for common branch functions Jin Yao
2017-04-20 12:07 ` [PATCH v6 6/7] perf report: Show branch type statistics for stdio mode Jin Yao
2017-04-20 12:07 ` [PATCH v6 7/7] perf report: Show branch type in callchain entry Jin Yao
2017-07-07  8:09 ` [PATCH v6 0/7] perf report: Show branch type Jiri Olsa

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=29d920f3-3491-2be2-f9f7-795e23217621@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).