linuxppc-dev.lists.ozlabs.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: Mon, 8 May 2017 08:49:44 +0800	[thread overview]
Message-ID: <c1b593af-ab19-c82d-6b7f-5cd930d83254@linux.intel.com> (raw)
In-Reply-To: <f6ede1eb-e015-5821-f00d-bbbc3ff3f317@linux.intel.com>



On 4/24/2017 8:47 AM, Jin, Yao wrote:
>
>
> On 4/23/2017 9:55 PM, Jiri Olsa wrote:
>> On Thu, Apr 20, 2017 at 08:07:50PM +0800, Jin Yao wrote:
>>
>> SNIP
>>
>>>   +#define X86_BR_TYPE_MAP_MAX    16
>>> +
>>> +static int
>>> +common_branch_type(int type)
>>> +{
>>> +    int i, mask;
>>> +    const int branch_map[X86_BR_TYPE_MAP_MAX] = {
>>> +        PERF_BR_CALL,        /* X86_BR_CALL */
>>> +        PERF_BR_RET,        /* X86_BR_RET */
>>> +        PERF_BR_SYSCALL,    /* X86_BR_SYSCALL */
>>> +        PERF_BR_SYSRET,        /* X86_BR_SYSRET */
>>> +        PERF_BR_INT,        /* X86_BR_INT */
>>> +        PERF_BR_IRET,        /* X86_BR_IRET */
>>> +        PERF_BR_JCC,        /* X86_BR_JCC */
>>> +        PERF_BR_JMP,        /* X86_BR_JMP */
>>> +        PERF_BR_IRQ,        /* X86_BR_IRQ */
>>> +        PERF_BR_IND_CALL,    /* X86_BR_IND_CALL */
>>> +        PERF_BR_NONE,        /* X86_BR_ABORT */
>>> +        PERF_BR_NONE,        /* X86_BR_IN_TX */
>>> +        PERF_BR_NONE,        /* X86_BR_NO_TX */
>>> +        PERF_BR_CALL,        /* X86_BR_ZERO_CALL */
>>> +        PERF_BR_NONE,        /* X86_BR_CALL_STACK */
>>> +        PERF_BR_IND_JMP,    /* X86_BR_IND_JMP */
>>> +    };
>>> +
>>> +    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?
>>
>>> +
>>> +    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.
>
> Thanks
> Jin Yao
>

Hi,

Is this explanation OK? Since for tools part, it's Acked-by: Jiri Olsa. 
I just want to know  if the kernel part is OK either?

Thanks
Jin Yao

  reply	other threads:[~2017-05-08  0:49 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 [this message]
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
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=c1b593af-ab19-c82d-6b7f-5cd930d83254@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).