[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190930192800.GA13904@kernel.org>
Date: Mon, 30 Sep 2019 16:28:00 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Andi Kleen <ak@...ux.intel.com>
Cc: Jiri Olsa <jolsa@...hat.com>, Jin Yao <yao.jin@...ux.intel.com>,
jolsa@...nel.org, peterz@...radead.org, mingo@...hat.com,
alexander.shishkin@...ux.intel.com, Linux-kernel@...r.kernel.org,
kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v1 0/2] perf stat: Support --all-kernel and --all-user
Em Mon, Sep 30, 2019 at 11:21:36AM -0700, Andi Kleen escreveu:
> On Sun, Sep 29, 2019 at 05:29:13PM +0200, Jiri Olsa wrote:
> > On Wed, Sep 25, 2019 at 10:02:16AM +0800, Jin Yao wrote:
> > > This patch series supports the new options "--all-kernel" and "--all-user"
> > > in perf-stat.
> > > For example,
> > > root@kbl:~# perf stat -e cycles,instructions --all-kernel --all-user -a -- sleep 1
> > > Performance counter stats for 'system wide':
> > > 19,156,665 cycles:k
> > > 7,265,342 instructions:k # 0.38 insn per cycle
> > > 4,511,186,293 cycles:u
> > > 121,881,436 instructions:u # 0.03 insn per cycle
> > I think we should follow --all-kernel/--all-user behaviour from record
> > command, adding extra events seems like unnecesary complexity to me
> I think it's useful. Makes it easy to do kernel/user break downs.
> perf record should support the same.
Don't we have this already with:
[root@...co ~]# perf stat -e cycles:u,instructions:u,cycles:k,instructions:k -a -- sleep 1
Performance counter stats for 'system wide':
69,937,445 cycles:u
23,459,595 instructions:u # 0.34 insn per cycle
51,040,704 cycles:k
11,368,152 instructions:k # 0.22 insn per cycle
1.002887417 seconds time elapsed
[root@...co ~]# perf record -e cycles:u,instructions:u,cycles:k,instructions:k -a -- sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.340 MB perf.data (927 samples) ]
[root@...co ~]# perf evlist
cycles:u
instructions:u
cycles:k
instructions:k
[root@...co ~]#
To make it shorter we could have:
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 7469497cd28e..7df28b0e9682 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -313,11 +313,11 @@ aux-output { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); }
<<EOF>> { BEGIN(INITIAL); }
}
-cpu-cycles|cycles { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); }
+cpu-cycles|cycles|cyc { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); }
stalled-cycles-frontend|idle-cycles-frontend { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); }
stalled-cycles-backend|idle-cycles-backend { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); }
-instructions { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); }
+instructions|insn|ins { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); }
cache-misses { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); }
branch-instructions|branches { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); }
branch-misses { return sym(yyscanner, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); }
And another thing that comes to mind is to make -M metrics be accepted
as -e arg, as someone suggested recently (Andi?), and also make it set
its events honouring the :k or :u modifiers:
[root@...co ~]# perf stat -M ipc
^C
Performance counter stats for 'system wide':
15,030,011 inst_retired.any # 0.3 IPC
54,449,797 cpu_clk_unhalted.thread
1.186531715 seconds time elapsed
[root@...co ~]# perf stat -M ipc:k,ipc:u
Cannot find metric or group `ipc:k'
Usage: perf stat [<options>] [<command>]
-M, --metrics <metric/metric group list>
monitor specified metrics or metric groups (separated by ,)
[root@...co ~]#
- Arnaldo
Powered by blists - more mailing lists