H A D | metricgroup.c | diff b85a4d61d30226080ff6fec9ea4096d369fd6852 Fri Oct 15 19:21:32 CEST 2021 Ian Rogers <irogers@google.com> perf metric: Allow modifiers on metrics
By allowing modifiers on metrics we can, for example, gather the same metric for kernel and user mode. On a SkylakeX with TopDownL1 this gives:
$ perf stat -M TopDownL1:u,TopDownL1:k -a sleep 2
Performance counter stats for 'system wide':
849,855,577 uops_issued.any:k # 0.06 Bad_Speculation:k # 0.51 Backend_Bound:k (16.71%) 1,995,257,996 cycles:k # 7981031984.00 SLOTS:k # 0.35 Frontend_Bound:k # 0.08 Retiring:k (16.71%) 2,791,940,753 idq_uops_not_delivered.core:k (16.71%) 641,961,928 uops_retired.retire_slots:k (16.71%) 72,239,337 int_misc.recovery_cycles:k (16.71%) 2,294,413,647 uops_issued.any:u # 0.04 Bad_Speculation:u # 0.39 Backend_Bound:u (16.78%) 1,333,248,940 cycles:u # 5332995760.00 SLOTS:u # 0.16 Frontend_Bound:u # 0.40 Retiring:u (16.78%) 858,517,081 idq_uops_not_delivered.core:u (16.78%) 2,153,789,582 uops_retired.retire_slots:u (16.78%) 19,373,627 int_misc.recovery_cycles:u (16.78%) 31,503,661 cpu_clk_unhalted.one_thread_active:k # 0.18 CoreIPC_SMT:k (16.73%) 315,454,104 inst_retired.any:k # 315454104.00 Instructions:k (16.73%) 42,533,729 cpu_clk_unhalted.ref_xclk:k (16.73%) 2,043,119,037 cpu_clk_unhalted.thread:k (16.73%) 28,843,803 cpu_clk_unhalted.one_thread_active:u # 1.55 CoreIPC_SMT:u (16.60%) 2,153,353,869 inst_retired.any:u # 2153353869.00 Instructions:u (16.60%) 28,844,743 cpu_clk_unhalted.ref_xclk:u (16.60%) 1,387,544,378 cpu_clk_unhalted.thread:u (16.60%) 308,031,603 inst_retired.any:k # 0.15 CoreIPC:k (33.19%) 2,036,774,753 cycles:k (33.19%) 1,994,344,281 inst_retired.any:u # 1.59 CoreIPC:u (33.18%) 1,251,538,227 cycles:u (33.18%)
2.000342948 seconds time elapsed
Modifiers are naively copy and pasted on to events, this can yield errors like:
$ perf stat -M Kernel_Utilization:k -a sleep 2 event syntax error: '..d.thread:k/kk,cpu_clk_unhalted.thread/metric-id=cpu_clk_unhalted.thread/k..' \___ Bad modifier
Usage: perf stat [<options>] [<command>]
-M, --metrics <metric/metric group list> monitor specified metrics or metric groups (separated by ,)
When modifiers are present with constraints, from --metric-no-group or the NMI watchdog, they are no longer placed in the same set - which may miss deduplicating events.
Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Andi Kleen <ak@linux.intel.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Antonov <alexander.antonov@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andrew Kilroy <andrew.kilroy@arm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Changbin Du <changbin.du@intel.com> Cc: Denys Zagorui <dzagorui@cisco.com> Cc: Fabian Hemmer <copy@copy.sh> Cc: Felix Fietkau <nbd@nbd.name> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jacob Keller <jacob.e.keller@intel.com> Cc: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Joakim Zhang <qiangqing.zhang@nxp.com> Cc: John Garry <john.garry@huawei.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Kees Kook <keescook@chromium.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nicholas Fraser <nfraser@codeweavers.com> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Paul Clarke <pc@us.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Riccardo Mancini <rickyman7@gmail.com> Cc: Sami Tolvanen <samitolvanen@google.com> Cc: ShihCheng Tu <mrtoastcheng@gmail.com> Cc: Song Liu <songliubraving@fb.com> Cc: Stephane Eranian <eranian@google.com> Cc: Sumanth Korikkar <sumanthk@linux.ibm.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Wan Jiabing <wanjiabing@vivo.com> Cc: Zhen Lei <thunder.leizhen@huawei.com> Link: https://lore.kernel.org/r/20211015172132.1162559-22-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|