linux/tools/perf/tests
Kajol Jain 1e1a873dc6 perf metricgroups: Enhance JSON/metric infrastructure to handle "?"
Patch enhances current metric infrastructure to handle "?" in the metric
expression. The "?" can be use for parameters whose value not known
while creating metric events and which can be replace later at runtime
to the proper value. It also add flexibility to create multiple events
out of single metric event added in JSON file.

Patch adds function 'arch_get_runtimeparam' which is a arch specific
function, returns the count of metric events need to be created.  By
default it return 1.

This infrastructure needed for hv_24x7 socket/chip level events.
"hv_24x7" chip level events needs specific chip-id to which the data is
requested. Function 'arch_get_runtimeparam' implemented in header.c
which extract number of sockets from sysfs file "sockets" under
"/sys/devices/hv_24x7/interface/".

With this patch basically we are trying to create as many metric events
as define by runtime_param.

For that one loop is added in function 'metricgroup__add_metric', which
create multiple events at run time depend on return value of
'arch_get_runtimeparam' and merge that event in 'group_list'.

To achieve that we are actually passing this parameter value as part of
`expr__find_other` function and changing "?" present in metric
expression with this value.

As in our JSON file, there gonna be single metric event, and out of
which we are creating multiple events.

To understand which data count belongs to which parameter value,
we also printing param value in generic_metric function.

For example,

  command:# ./perf stat  -M PowerBUS_Frequency -C 0 -I 1000
    1.000101867  9,356,933  hv_24x7/pm_pb_cyc,chip=0/ #  2.3 GHz  PowerBUS_Frequency_0
    1.000101867  9,366,134  hv_24x7/pm_pb_cyc,chip=1/ #  2.3 GHz  PowerBUS_Frequency_1
    2.000314878  9,365,868  hv_24x7/pm_pb_cyc,chip=0/ #  2.3 GHz  PowerBUS_Frequency_0
    2.000314878  9,366,092  hv_24x7/pm_pb_cyc,chip=1/ #  2.3 GHz  PowerBUS_Frequency_1

So, here _0 and _1 after PowerBUS_Frequency specify parameter value.

Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lore.kernel.org/lkml/20200401203340.31402-5-kjain@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-04-30 10:48:33 -03:00
..
attr perf tools: Add kernel AUX area sampling definitions 2019-11-21 10:54:20 -03:00
shell perf test: Fix test trace+probe_vfs_getname.sh on s390 2020-02-18 10:13:28 -03:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
api-io.c tools api: Add a lightweight buffered reading api 2020-04-30 10:48:28 -03:00
attr.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
attr.py perf script python: Add Python3 support to tests/attr.py 2019-02-05 10:31:08 -03:00
backward-ring-buffer.c perf tests: Fix out of bounds memory access 2019-11-07 09:04:22 -03:00
bitmap.c perf env: Remove needless cpumap.h header 2019-09-20 09:19:21 -03:00
bp_account.c perf tests bp_account: Make global variable static 2020-03-02 11:15:07 -03:00
bp_signal.c perf tests bp_signal: Show expected versus obtained values 2020-01-06 11:46:09 -03:00
bp_signal_overflow.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
bpf-script-example.c perf tests: Add missing SPDX headers 2019-06-17 15:57:19 -03:00
bpf-script-test-kbuild.c perf tests: Add missing SPDX headers 2019-06-17 15:57:19 -03:00
bpf-script-test-prologue.c perf tests: Add missing SPDX headers 2019-06-17 15:57:19 -03:00
bpf-script-test-relocation.c perf tests: Add missing SPDX headers 2019-06-17 15:57:19 -03:00
bpf.c libperf: Adopt perf_mmap__read_event() from tools/perf 2019-10-10 11:49:46 -03:00
Build tools api: Add a lightweight buffered reading api 2020-04-30 10:48:28 -03:00
builtin-test.c tools api: Add a lightweight buffered reading api 2020-04-30 10:48:28 -03:00
clang.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
code-reading.c perf thread: Rename thread->mg to thread->maps 2019-11-26 11:07:46 -03:00
cpumap.c perf test: Fix test case Merge cpu map 2020-01-30 11:55:02 +01:00
dso-data.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
dwarf-unwind.c perf unwind: Use 'struct map_symbol' in 'struct unwind_entry' 2019-11-12 08:20:53 -03:00
event-times.c perf stat: Use affinity for opening events 2019-11-29 12:20:45 -03:00
event_update.c libperf: Add perf_evlist__id_add() function 2019-09-25 09:51:48 -03:00
evsel-roundtrip-name.c libperf: Add perf_evlist__first()/last() functions 2019-09-25 09:51:48 -03:00
evsel-tp-sched.c perf evsel: Rename perf_evsel__delete() to evsel__delete() 2019-07-29 18:34:43 -03:00
expr.c perf metricgroups: Enhance JSON/metric infrastructure to handle "?" 2020-04-30 10:48:33 -03:00
fdarray.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
genelf.c perf jit: Move test functionality in to a test 2019-11-29 12:20:45 -03:00
hists_common.c perf tools: Move event synthesizing routines to separate header 2019-09-20 09:19:22 -03:00
hists_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_cumulate.c libperf: Add perf_evlist__first()/last() functions 2019-09-25 09:51:48 -03:00
hists_filter.c perf tools: Remove needless thread.h include directives 2019-08-31 22:24:10 -03:00
hists_link.c libperf: Add perf_evlist__first()/last() functions 2019-09-25 09:51:48 -03:00
hists_output.c libperf: Add perf_evlist__first()/last() functions 2019-09-25 09:51:48 -03:00
is_printable_array.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
keep-tracking.c libperf: Adopt perf_mmap__read_event() from tools/perf 2019-10-10 11:49:46 -03:00
kmod-path.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
llvm.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
llvm.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
make perf build-test: Honour JOBS to override detection of number of cores 2020-04-03 09:37:55 -03:00
maps.c perf tests: Rename tests/map_groups.c to tests/maps.c 2019-11-26 11:07:46 -03:00
mem.c perf symbols: Move mem_info and branch_info out of symbol.h 2019-08-31 22:27:48 -03:00
mem2node.c perf env: Remove needless cpumap.h header 2019-09-20 09:19:21 -03:00
mmap-basic.c libperf: Adopt perf_mmap__read_event() from tools/perf 2019-10-10 11:49:46 -03:00
mmap-thread-lookup.c libperf: Move 'page_size' global variable to libperf 2019-09-25 09:51:48 -03:00
openat-syscall-all-cpus.c perf env: Remove needless cpumap.h header 2019-09-20 09:19:21 -03:00
openat-syscall-tp-fields.c libperf: Adopt perf_mmap__read_event() from tools/perf 2019-10-10 11:49:46 -03:00
openat-syscall.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
parse-events.c perf parser: Add support to specify rXXX event with pmu 2020-04-18 09:05:00 -03:00
parse-no-sample-id-all.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
perf-hooks.c perf tests: Avoid raising SEGV using an obvious NULL dereference 2019-09-27 09:26:14 -03:00
perf-record.c libperf: Adopt perf_mmap__read_event() from tools/perf 2019-10-10 11:49:46 -03:00
perf-targz-src-pkg License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pmu-events.c perf test: Test pmu-events aliases 2020-03-24 10:36:00 -03:00
pmu.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
python-use.c perf test: Use header file util/debug.h 2018-06-04 10:28:53 -03:00
sample-parsing.c perf tools: Basic support for CGROUP event 2020-04-03 09:37:55 -03:00
sdt.c perf tools: No need to include internal/lib.h from util/util.h 2019-09-25 09:51:48 -03:00
stat.c perf tools: Move event synthesizing routines to separate header 2019-09-20 09:19:22 -03:00
sw-clock.c libperf: Adopt perf_mmap__read_event() from tools/perf 2019-10-10 11:49:46 -03:00
switch-tracking.c libperf: Adopt perf_mmap__read_event() from tools/perf 2019-10-10 11:49:46 -03:00
task-exit.c perf test: Avoid infinite loop for task exit case 2019-10-15 08:36:22 -03:00
tests.h tools api: Add a lightweight buffered reading api 2020-04-30 10:48:28 -03:00
thread-map.c perf tools: Move event synthesizing routines to separate header 2019-09-20 09:19:22 -03:00
thread-maps-share.c perf tests: Rename thread-mg-share to thread-maps-share 2019-11-26 11:07:46 -03:00
time-utils-test.c perf evlist: Rename struct perf_evlist to struct evlist 2019-07-29 18:34:42 -03:00
topology.c perf test session topology: Fix data path 2020-04-23 11:08:24 -03:00
unit_number__scnprintf.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
vmlinux-kallsyms.c perf maps: Merge 'struct maps' with 'struct map_groups' 2019-11-26 11:07:46 -03:00
wp.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00