From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, lkml <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCHv2 5/5] perf tools: Add perf data cache feature
Date: Tue, 16 Feb 2016 23:22:19 +0900 [thread overview]
Message-ID: <20160216142219.GA6286@danjae.kornet> (raw)
In-Reply-To: <20160216121130.GB27262@krava.brq.redhat.com>
Hi Jiri,
On Tue, Feb 16, 2016 at 01:11:30PM +0100, Jiri Olsa wrote:
> On Sun, Feb 14, 2016 at 05:03:46PM +0100, Jiri Olsa wrote:
> > Storing CPU cache details under perf data. It's stored
> > as new HEADER_CACHE feature and it's displayed under
> > header info with -I option:
> >
> > $ perf report --header-only -I
> > ...
> > # cache info:
> > # L1 Data 32K [0-1]
> > # L1 Instruction 32K [0-1]
> > # L1 Data 32K [2-3]
> > # L1 Instruction 32K [2-3]
> > # L2 Unified 256K [0-1]
> > # L2 Unified 256K [2-3]
> > # L3 Unified 4096K [0-3]
> > ...
> >
>
> changing the output based on Ingo's comment
> v2 attached, the rest of the patchset stays
>
> my perf/cache branch is updated
>
> thanks,
> jirka
>
>
> ---
> Storing CPU cache details under perf data. It's stored
> as new HEADER_CACHE feature and it's displayed under
> header info with -I option:
>
> $ perf report --header-only -I
> ...
> # CPU cache info:
> # L1 Data 32K [0-1]
> # L1 Instruction 32K [0-1]
> # L1 Data 32K [2-3]
> # L1 Instruction 32K [2-3]
> # L2 Unified 256K [0-1]
> # L2 Unified 256K [2-3]
> # L3 Unified 4096K [0-3]
> ...
>
> All distinct caches are stored/displayed.
>
> Link: http://lkml.kernel.org/n/tip-byxl1gwto8z9d5hyozprtaty@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
[SNIP]
> +static int build_caches(struct cache_level caches[], u32 size, u32 *cntp)
> +{
> + u32 i, cnt = 0;
> + long ncpus;
> + u32 nr, cpu;
> + u16 level;
> +
> + ncpus = sysconf(_SC_NPROCESSORS_CONF);
> + if (ncpus < 0)
> + return -1;
> +
> + nr = (u32)(ncpus & UINT_MAX);
> +
> + for (cpu = 0; cpu < nr; cpu++) {
> + for (level = 0; level < 10; level++) {
> + struct cache_level c;
> + int err;
> +
> + err = cache_level__read(&c, cpu, level);
> + if (err < 0)
> + return err;
> +
> + if (err == 1)
> + break;
> +
> + for (i = 0; i < cnt; i++) {
> + if (cache_level__cmp(&c, &caches[i]))
> + break;
> + }
> +
> + if (i == cnt)
> + caches[cnt++] = c;
else
cache_level__free(&c);
???
Thanks,
Namhyung
> +
> + if (WARN_ONCE(cnt == size, "way too many cpu caches.."))
> + goto out;
> + }
> + }
> + out:
> + *cntp = cnt;
> + return 0;
> +}
next prev parent reply other threads:[~2016-02-16 14:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-14 16:03 [PATCH 0/5] perf tools: Store CPU cache details under perf data Jiri Olsa
2016-02-14 16:03 ` [PATCH 1/5] tools lib api: Add debug output support Jiri Olsa
2016-02-17 12:07 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-14 16:03 ` [PATCH 2/5] tools lib api fs: Move filename__read_str into api/fs/fs.c Jiri Olsa
2016-02-17 12:07 ` [tip:perf/core] tools lib api fs: Adopt filename__read_str from perf tip-bot for Jiri Olsa
2016-02-14 16:03 ` [PATCH 3/5] tools lib api fs: Add sysfs__read_str function Jiri Olsa
2016-02-17 12:07 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-14 16:03 ` [PATCH 4/5] perf tools: Initialize libapi debug output Jiri Olsa
2016-02-17 12:08 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-14 16:03 ` [PATCH 5/5] perf tools: Add perf data cache feature Jiri Olsa
2016-02-16 12:11 ` [PATCHv2 " Jiri Olsa
2016-02-16 14:22 ` Namhyung Kim [this message]
2016-02-16 15:01 ` [PATCHv3 " Jiri Olsa
2016-02-16 15:29 ` Arnaldo Carvalho de Melo
2016-02-16 15:48 ` Arnaldo Carvalho de Melo
2016-02-17 12:08 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-16 8:14 ` [PATCH 0/5] perf tools: Store CPU cache details under perf data Ingo Molnar
2016-02-16 11:28 ` 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=20160216142219.GA6286@danjae.kornet \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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;
as well as URLs for NNTP newsgroup(s).