Re: [PATCH v3 1/4] perf: Add a 'percore' event qualifier

From: Jin, Yao
Date: Wed Apr 10 2019 - 10:15:43 EST




On 4/10/2019 8:54 PM, Arnaldo Carvalho de Melo wrote:
Em Wed, Apr 10, 2019 at 09:36:41AM -0300, Arnaldo Carvalho de Melo escreveu:
Em Tue, Mar 19, 2019 at 04:56:53PM +0800, Jin Yao escreveu:
Add a 'percore' event qualifier, like cpu/event=0,umask=0x3,percore=1/,
that sums up the event counts for both hardware threads in a core.

We can already do this with --per-core, but it's often useful to do
this together with other metrics that are collected per hardware thread.
So we need to support this per-core counting on a event level.

This can be implemented in only the user tool, no kernel support needed.

v3:
---
Simplify the code according to Jiri's comments.
Before:
"return term->val.percore ? true : false;"
Now:
"return term->val.percore;"

v2:
---
Change the qualifier name from 'coresum' to 'percore' according to
comments from Jiri and Andi.

I'm applying this, but please, don't forget to, when adding a new
qualifier, to update the documentation... I'm doing this for you this
time.

The first patch didn't apply with 'git am', I did it manually, and added
the patch below

But then the second doesn't apply to my perf/core branch as well, please
refresh and resend a v4, thanks.

- Arnaldo


Thanks Arnaldo! I will rebase the patch to latest perf/core branch and then send v4.

Thanks
Jin Yao

diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
index 138fb6e94b3c..18ed1b0fceb3 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -199,6 +199,18 @@ also be supplied. For example:
perf stat -C 0 -e 'hv_gpci/dtbp_ptitc,phys_processor_idx=0x2/' ...
+EVENT QUALIFIERS:
+
+It is also possible to add extra qualifiers to an event:
+
+percore:
+
+Sums up the event counts for all hardware threads in a core, e.g.:
+
+
+ perf stat -e cpu/event=0,umask=0x3,percore=1/
+
+
EVENT GROUPS
------------