From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Omar Awile <omar.awile@cern.ch>
Cc: linux-perf-users@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
Kan Liang <kan.liang@intel.com>, David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: reading PMU counts with perf leader sampling and perf script
Date: Mon, 12 Sep 2016 17:04:11 -0300 [thread overview]
Message-ID: <20160912200411.GH4897@kernel.org> (raw)
In-Reply-To: <etPan.57d2cbe0.548515bd.6188@cern.ch>
Em Fri, Sep 09, 2016 at 02:48:53PM +0000, Omar Awile escreveu:
> Hello,
> I’ve been trying to get periodic readouts of PMU event counts using
> perf record (similar to what perf stat -I does but with a higher
> precision than 10ms).
> For this I thought I could use leader sampling with ref_cycles and the
> events I am targeting.
> For example something like this:
> $ perf record -P -c 2000000 -e '{cycles,instructions,branch-misses}:S' — ./workload
> This seems to read out the sample values for the other events whenever
> the cycle event is sampled.
> The next step would be for me to use perf script and a little python
> script to get the event counts but I can’t seem to find a way to do
> this. Can someone point me in the right direction?
> perf report seems to be able to read these samples but they are shown
> only as aggregates. Also, perf script would allow me to
> process/analyze the data myself. If this is currently not possible,
> how would I go about adding the missing functionality in perf script?
Can you please take a look at tools/perf/scripts/python/stat-cpi.py,
this processes hardware counters, in python, the changeset that
introduces it:
https://git.kernel.org/cgit/linux/kernel/git/acme/linux.git/commit/?id=b8a1962d17b4e3cfdd7b7dc9ebd94affbcb4c1c5
<SNIP>
get CPI systemwide:
$ perf stat -e cycles,instructions -a -I 1000 record sleep 3
# time counts unit events
1.000158618 594,274,711 cycles (100.00%)
1.000158618 441,898,250 instructions
2.000350973 567,649,705 cycles (100.00%)
2.000350973 432,669,206 instructions
3.000559210 561,940,430 cycles (100.00%)
3.000559210 420,403,465 instructions
3.000670798 780,105 cycles (100.00%)
3.000670798 326,516 instructions
$ perf script -s ./scripts/python/stat-cpi.py
1.000159: cpu -1, thread -1 -> cpi 1.344823 (594274711/441898250)
2.000351: cpu -1, thread -1 -> cpi 1.311972 (567649705/432669206)
3.000559: cpu -1, thread -1 -> cpi 1.336669 (561940430/420403465)
3.000671: cpu -1, thread -1 -> cpi 2.389178 (780105/326516)
$ perf stat -e cycles,instructions -a -I 1000 record sleep 3 | perf script -s ./scripts/python/stat-cpi.py
1.000202: cpu -1, thread -1 -> cpi 1.035091 (940778881/908885530)
2.000392: cpu -1, thread -1 -> cpi 1.442600 (627493992/434974455)
3.000545: cpu -1, thread -1 -> cpi 1.353612 (741463930/547766890)
3.000622: cpu -1, thread -1 -> cpi 2.642110 (784083/296764)
<SNIP>
And that -I limitation can be lifted, no?
- Arnaldo
next prev parent reply other threads:[~2016-09-12 20:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-09 14:48 reading PMU counts with perf leader sampling and perf script Omar Awile
2016-09-11 3:21 ` Andi Kleen
2016-09-20 14:33 ` Omar Awile
2016-09-12 20:04 ` Arnaldo Carvalho de Melo [this message]
[not found] ` <etPan.57e15392.6894e226.675c@cern.ch>
2016-09-20 19:19 ` Arnaldo Carvalho de Melo
2016-09-20 20:16 ` 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=20160912200411.GH4897@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=omar.awile@cern.ch \
/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).