From: Namhyung Kim <namhyung@kernel.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@infradead.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, peterz@infradead.org,
eranian@google.com, jolsa@redhat.com,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] perf, tools: Add script to easily decode addresses
Date: Mon, 17 Mar 2014 09:43:18 +0900 [thread overview]
Message-ID: <87y509u02h.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1394740438-27343-1-git-send-email-andi@firstfloor.org> (Andi Kleen's message of "Thu, 13 Mar 2014 12:53:58 -0700")
Hi Andi,
On Thu, 13 Mar 2014 12:53:58 -0700, Andi Kleen wrote:
> +def MASK(bits):
> + return (1 << bits) - 1
> +
> +def decode_bits(val, names, bits, shift):
> + v = (val >> shift) & MASK(bits)
> + s = ""
> + for name, index in zip(names, range(0, len(names))):
> + if v & (1 << index):
> + s += " " + name
> + return s
> +
> +# __u64 mem_op:5, /* type of opcode */
> +# mem_lvl:14, /* memory hierarchy level */
> +# mem_snoop:5, /* snoop mode */
> +# mem_lock:2, /* lock instr */
> +# mem_dtlb:7, /* tlb access */
> +# mem_rsvd:31;
> +
> +def decode_datasrc(d):
> + s = ""
> + s += decode_bits(d, ['', 'LOAD', 'STORE?', 'PREFETCH', 'EXEC'], 5, 0)
> + s += decode_bits(d, ['', 'HIT', 'MISS', 'L1', 'LFB', 'L2', 'L3',
> + 'LOC_RAM', 'REM-RAM-1', 'REM-RAM-2', 'REM-CACHE-1'
> + 'REM-CACHE-2', 'REM-IO', 'REM-UNCACHED'], 14, 5)
> + s += decode_bits(d, ['', 'NONE', 'MISS', 'HITM'], 19, 5)
> + s += decode_bits(d, ['', 'LOCKED'], 24, 2)
> + s += decode_bits(d, ['', 'L1', 'L2', 'WK', 'OS'], 26, 7)
Shouldn't it be like below (bits and shift exchanged)?
s += decode_bits(d, ['', 'NONE', 'MISS', 'HITM'], 5, 19)
s += decode_bits(d, ['', 'LOCKED'], 2, 24)
s += decode_bits(d, ['', 'L1', 'L2', 'WK', 'OS'], 7, 26)
Thanks,
Namhyung
next prev parent reply other threads:[~2014-03-17 0:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-13 19:53 Andi Kleen
2014-03-17 0:43 ` Namhyung Kim [this message]
2014-11-13 23:47 Andi Kleen
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=87y509u02h.fsf@sejong.aot.lge.com \
--to=namhyung@kernel.org \
--cc=acme@infradead.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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®