Arnaldo Carvalho de Melo
95be9d197d
perf evsel: Move config terms to a separate header
...
Further reducing the size of util/evsel.h.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-20zr7di9eynm0272mtjfdhfc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 16:26:40 -03:00
Arnaldo Carvalho de Melo
ca1252779f
perf evsel: Introduce evsel_fprintf.h
...
We already had evsel_fprintf.c, add its counterpart, so that we can
reduce evsel.h a bit more.
We needed a new perf_event_attr_fprintf.c file so as to have a separate
object to link with the python binding in tools/perf/util/python-ext-sources
and not drag symbol_conf, etc into the python binding.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-06bdmt1062d9unzgqmxwlv88@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 16:26:34 -03:00
Arnaldo Carvalho de Melo
9620bc361a
perf evsel: Remove need for symbol_conf in evsel_fprintf.c
...
So that we an later link it to the python binding without having to
drag the symbol object files.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-8823tveyasocnuoelq4qopwf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 15:06:59 -03:00
Jiri Olsa
70c20369ee
libperf: Add perf_evsel__alloc_id/perf_evsel__free_id functions
...
Add perf_evsel__alloc_id()/perf_evsel__free_id() functions to libperf as
internal functions.
Move 'struct perf_sample_id' to internal/evsel.h header and change
'struct perf_sample_id::evsel' to 'struct perf_evsel' and the related
code that touches it.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lore.kernel.org/lkml/20190913132355.21634-28-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:48 -03:00
Jiri Olsa
e7eb9002d4
libperf: Move 'ids' from 'struct evsel' to 'struct perf_evsel'
...
Move 'ids' from 'struct evsel' to libperf's 'struct perf_evsel'.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lore.kernel.org/lkml/20190913132355.21634-26-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:47 -03:00
Jiri Olsa
deaf321913
libperf: Move 'id' from 'struct evsel' to 'struct perf_evsel'
...
Move the 'id' array from 'struct evsel' to libperf's 'struct perf_evsel'.
Committer note:
Fix the tools/perf/util/cs-etm.c build, i.e. aarch64's CoreSight.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lore.kernel.org/lkml/20190913132355.21634-25-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:47 -03:00
Jiri Olsa
8cd36f3ef4
libperf: Move 'sample_id' from 'struct evsel' to 'struct perf_evsel'
...
Move 'sample_id' array from 'struct evsel' to libperf's 'struct perf_evsel'.
Committer notes:
Removed the 'struct xyarray' from util/evsel.h, not needed anymore
there.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lore.kernel.org/lkml/20190913132355.21634-24-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:47 -03:00
Jiri Olsa
648b5af3f3
libperf: Move 'system_wide' from 'struct evsel' to 'struct perf_evsel'
...
Move the 'system_wide 'member from perf's evsel to libperf's perf_evsel.
Committer notes:
Added stdbool.h as we now use bool here.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lore.kernel.org/lkml/20190913132355.21634-20-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:46 -03:00
Arnaldo Carvalho de Melo
5cac8ea3e6
perf memswap: Adopt 'struct u64_swap' from evsel.h
...
As it is not used in evsel.h and is a memory swap struct, so fits better
in memswap.h.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-wvzxu7a5l3m868ywwphrnnqo@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-20 09:19:22 -03:00
Jin Yao
f01642e491
perf metricgroup: Support multiple events for metricgroup
...
Some uncore metrics don't work as expected. For example, on
cascadelakex:
root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_BANDWIDTH.TOTAL -a -- sleep 1
Performance counter stats for 'system wide':
1841092 unc_m_pmm_rpq_inserts
3680816 unc_m_pmm_wpq_inserts
1.001775055 seconds time elapsed
root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_READ_LATENCY -a -- sleep 1
Performance counter stats for 'system wide':
860649746 unc_m_pmm_rpq_occupancy.all
1840557 unc_m_pmm_rpq_inserts
12790627455 unc_m_clockticks
1.001773348 seconds time elapsed
No metrics 'UNC_M_PMM_BANDWIDTH.TOTAL' or 'UNC_M_PMM_READ_LATENCY' are
reported.
The issue is, the case of an alias expanding to mulitple events is not
supported, typically the uncore events. (see comments in
find_evsel_group()).
For UNC_M_PMM_BANDWIDTH.TOTAL in above example, the expanded event group
is '{unc_m_pmm_rpq_inserts,unc_m_pmm_wpq_inserts}:W', but the actual
events passed to find_evsel_group are:
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
For this multiple events case, it's not supported well.
This patch introduces a new field 'metric_leader' in struct evsel. The
first event is considered as a metric leader. For the rest of same
events, they point to the first event via it's metric_leader field in
struct evsel.
This design is for adding the counting results of all same events to the
first event in group (the metric_leader).
With this patch,
root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_BANDWIDTH.TOTAL -a -- sleep 1
Performance counter stats for 'system wide':
1842108 unc_m_pmm_rpq_inserts # 337.2 MB/sec UNC_M_PMM_BANDWIDTH.TOTAL
3682209 unc_m_pmm_wpq_inserts
1.001819706 seconds time elapsed
root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_READ_LATENCY -a -- sleep 1
Performance counter stats for 'system wide':
861970685 unc_m_pmm_rpq_occupancy.all # 219.4 ns UNC_M_PMM_READ_LATENCY
1842772 unc_m_pmm_rpq_inserts
12790196356 unc_m_clockticks
1.001749103 seconds time elapsed
Now we can see the correct metrics 'UNC_M_PMM_BANDWIDTH.TOTAL' and
'UNC_M_PMM_READ_LATENCY'.
Signed-off-by: Jin Yao <yao.jin@linux.intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/20190828055932.8269-5-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-31 22:27:52 -03:00
Arnaldo Carvalho de Melo
74a1e863eb
perf evsel: Rename perf_missing_features::bpf_event to ::bpf
...
No need for that _event suffix, do just like all the other meta events
and do away with that.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Song Liu <songliubraving@fb.com >
Link: https://lkml.kernel.org/n/tip-bvc83f380dva83wlg52yd10t@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-26 19:39:11 -03:00
Arnaldo Carvalho de Melo
69d81f09e1
libperf: Rename the PERF_RECORD_ structs to have a "perf" suffix
...
Even more, to have a "perf_record_" prefix, so that they match the
PERF_RECORD_ enum they map to.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-qbabmcz2a0pkzt72liyuz3p8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-26 19:39:11 -03:00
Arnaldo Carvalho de Melo
f7004f5990
perf evsel: Switch to libperf's cpumap.h
...
We don't need what is in perf's util/cpumap.h, just the struct cpu_map
that is in libperf's internal/cpumap.h file to cover this one case:
tools/perf/util/evsel.h:215:27: error: dereferencing pointer to incomplete type ‘struct perf_cpu_map’
215 | return evsel__cpus(evsel)->nr;
So switch to libperf's cpumap.h and add some missing struct foward
declarations and include sys/types.h to get pid_t.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-ufjkpohijti05ggk69s91ktf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-22 17:16:57 -03:00
Arnaldo Carvalho de Melo
43cc5d5ecb
perf evsel: util/evsel.h needs stdio.h as it uses FILE
...
And it was getting it by luck from util/cpumap.h that shouldn't be
included in util/evsel.h as it only needs what is in libperf, i.e.
struct cpu_map, that is in internal/cpumap.h, so add stdio.h before
we fix that.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-2ywx5sl031tj3zske7c7edgv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-22 17:16:57 -03:00
Arnaldo Carvalho de Melo
a06b7f422d
perf evsel: Remove needless stddef.h from util/evsel.h
...
We added it in 07ac002f2f
("perf evsel: Introduce is_group_member
method") but we already ditched that function, and there was nothing
else left that needed NULL nor anything else from stddef.h, ditch it.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-1zy0xfsy61x81f3fpyx5znco@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-22 17:16:57 -03:00
Arnaldo Carvalho de Melo
ddee688a83
perf evsel: Remove needless counts.h header from util/evsel.h
...
We need only a struct forward declaration, so prune the header
dependency tree a bit more.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-oqvgf04w4ku8xasrz79zquim@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-22 17:16:57 -03:00
Arnaldo Carvalho de Melo
69714a4e39
perf evsel: Add missing perf/evsel.h header in util/evsel.h
...
Since util/evsel.h uses perf_evsel__cpus() that has its prototype in
libperf's perf/evsel.h file, we need it explicitely included.
This was working by luck as util/evsel.h includes counts.h, but that is
not necessary, just some forward declarations, so, before we remove
counts.h from util/evsel.h, add what is realli needed.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-nfb9e0t4jm9zhvr0q86hc29d@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-22 17:16:57 -03:00
Arnaldo Carvalho de Melo
7646602401
perf evsel: Move xyarray.h from evsel.c to evsel.h to reduce include dep tree
...
All we need in util/evsel.h is the foward declaration of 'struct
xyarray', not the internal/xyarray.h, that can be moved to util/evsel.c
and then we reduce the header dependency tree.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-wwqce6ixwcyq6yzx3ljrdm80@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-22 17:16:56 -03:00
Adrian Hunter
3c84e65a53
perf evsel: Add comment for 'idx' member in 'struct perf_sample_id
...
The 'idx' member was added as preparation for AUX area sampling. Add a
comment to describe why.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/83ff264f-84c3-5372-8976-dd9293d20c6f@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-20 12:17:45 -03:00
Arnaldo Carvalho de Melo
acb9f2d475
perf evsel: Provide meaningful warning when trying to use 'aux_output' on older kernels
...
Just like we do with the 'write_backwards' feature:
Before:
# perf record -e {intel_pt/branch=0/,cycles/aux-output/ppp} uname
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles/aux-output/ppp).
/bin/dmesg | grep -i perf may provide additional information.
#
After:
# perf record -e {intel_pt/branch=0/,cycles/aux-output/ppp} uname
Error:
The 'aux_output' feature is not supported, update the kernel.
#
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lkml.kernel.org/n/tip-wgjsjroe1e150c0metgwmqwd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-14 10:59:59 -03:00
Adrian Hunter
1b9921546a
perf tools: Add aux-output config term
...
Expose the aux_output attribute flag to the user to configure, by adding a
config term 'aux-output'. For events that support it, selection of
'aux-output' causes the generation of AUX records instead of event records.
This requires that an AUX area event is also provided.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190806084606.4021-7-alexander.shishkin@linux.intel.com
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-14 10:59:59 -03:00
Jiri Olsa
0ff1a0fdf5
libperf: Add perf_evsel__cpus()/threads() functions
...
Add the following functions:
perf_evsel__cpus()
perf_evsel__threads()
to access the evsel's cpus and threads objects.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-68-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:46 -03:00
Jiri Olsa
a00571fda6
libperf: Adopt perf_evsel__enable()/disable()/apply_filter() functions
...
Move the following functions:
evsel__enable()
evsel__disable()
evsel__apply_filter()
to libperf with the following names:
perf_evsel__enable()
perf_evsel__disable()
perf_evsel__apply_filter()
Export only perf_evsel__enable()/disable(), keeping the
perf_evsel__apply_filter() one private for the moment.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-66-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:46 -03:00
Jiri Olsa
5c30af92f2
libperf: Adopt perf_evsel__read() function from tools/perf
...
Move the perf_evsel__read() function to libperf as a public interface
together with struct perf_counts_values for returning counter values.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-65-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:46 -03:00
Jiri Olsa
88761fa1f1
libperf: Adopt simplified perf_evsel__close() function from tools/perf
...
Add perf_evsel__close() function to libperf while keeping a tools/perf
specific evsel__close() to free ids.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-64-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:46 -03:00
Jiri Olsa
5643b1a59e
libperf: Move nr_members from perf's evsel to libperf's perf_evsel
...
Move the nr_members member from perf's evsel to libperf's perf_evsel.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-60-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:46 -03:00
Jiri Olsa
9dfcb75990
libperf: Move fd array from perf's evsel to lobperf's perf_evsel class
...
Move the fd array from perf's evsel to libperf's perf_evsel class.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-59-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:46 -03:00
Jiri Olsa
4b247fa731
libperf: Adopt xyarray class from perf
...
Move the xyarray class from perf to libperf, because it's going to be
used in both.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-58-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:45 -03:00
Jiri Olsa
af663bd01b
libperf: Add threads to struct perf_evsel
...
Move 'threads' from tools/perf's evsel to libperf's perf_evsel struct.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-53-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:45 -03:00
Jiri Olsa
fe1f61b37f
libperf: Add own_cpus to struct perf_evsel
...
Move own_cpus from tools/perf's evsel to libbpf's perf_evsel.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-52-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:45 -03:00
Jiri Olsa
d400bd3abf
libperf: Add cpus to struct perf_evsel
...
Mov the 'cpus' field from tools/perf's evsel to libperf's perf_evsel.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-51-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:45 -03:00
Jiri Olsa
1fc632cef4
libperf: Move perf_event_attr field from perf's evsel to libperf's perf_evsel
...
Move the perf_event_attr struct fron 'struct evsel' to 'struct perf_evsel'.
Committer notes:
Fixed up these:
tools/perf/arch/arm/util/auxtrace.c
tools/perf/arch/arm/util/cs-etm.c
tools/perf/arch/arm64/util/arm-spe.c
tools/perf/arch/s390/util/auxtrace.c
tools/perf/util/cs-etm.c
Also
cc1: warnings being treated as errors
tests/sample-parsing.c: In function 'do_test':
tests/sample-parsing.c:162: error: missing initializer
tests/sample-parsing.c:162: error: (near initialization for 'evsel.core.cpus')
struct evsel evsel = {
.needs_swap = false,
- .core.attr = {
- .sample_type = sample_type,
- .read_format = read_format,
+ .core = {
+ . attr = {
+ .sample_type = sample_type,
+ .read_format = read_format,
+ },
[perfbuilder@a70e4eeb5549 /]$ gcc --version |& head -1
gcc (GCC) 4.4.7
Also we don't need to include perf_event.h in
tools/perf/lib/include/perf/evsel.h, forward declaring 'struct
perf_event_attr' is enough. And this even fixes the build in some
systems where things are used somewhere down the include path from
perf_event.h without defining __always_inline.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-43-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:45 -03:00
Jiri Olsa
b27c4ece72
libperf: Include perf_evsel in evsel object
...
Including perf_evsel in evsel object, will continue to move other
generic things into libperf's perf_evsel struct.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-36-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:44 -03:00
Jiri Olsa
b49aca3e9c
perf evsel: Rename perf_evsel__cpus() to evsel__cpus()
...
Rename perf_evsel__cpus() to evsel__cpus(), so we don't have a name
clash when we add perf_evsel__cpus() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-19-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
24e376b245
perf evsel: Rename perf_evsel__apply_filter() to evsel__apply_filter()
...
Rename perf_evsel__apply_filter() to evsel__apply_filter(), so we don't
have a name clash when we add perf_evsel__apply_filter() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-18-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
9a10bb2289
perf evsel: Rename perf_evsel__disable() to evsel__disable()
...
Renaming perf_evsel__disable() to evsel__disable(), so we don't have a
name clash when we add perf_evsel__disable() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-17-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
ec7f24ef44
perf evsel: Rename perf_evsel__enable() to evsel__enable()
...
Rename perf_evsel__enable() to evsel__enable(), so we don't have a name
clash when we add perf_evsel__enable() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-16-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
5972d1e07b
perf evsel: Rename perf_evsel__open() to evsel__open()
...
Rename perf_evsel__open() to evsel__open(), so we don't have a name
clash when we add perf_evsel__open() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-15-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
365c3ae745
perf evsel: Rename perf_evsel__new() to evsel__new()
...
Rename perf_evsel__new() to evsel__new(), so we don't have a name clash
when we add perf_evsel__new() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-12-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
5eb2dd2ade
perf evsel: Rename perf_evsel__delete() to evsel__delete()
...
Remame perf_evsel__delete() to evsel__delete(), so we don't have a name
clash when we add perf_evsel__delete() in libperf.
Also renaming perf_evsel__delete_priv() to evsel__delete_priv().
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-11-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
b4b62ee688
perf evsel: Rename perf_evsel__init() to evsel__init()
...
Rename perf_evsel__init() to evsel__init(), so we don't have a name
clash when we add perf_evsel__init() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-7-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:42 -03:00
Jiri Olsa
63503dba87
perf evlist: Rename struct perf_evlist to struct evlist
...
Rename struct perf_evlist to struct evlist, so we don't have a name
clash when we add struct perf_evlist in libperf.
Committer notes:
Added fixes to build on arm64, from Jiri and from me
(tools/perf/util/cs-etm.c)
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-6-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:42 -03:00
Jiri Olsa
32dcd021d0
perf evsel: Rename struct perf_evsel to struct evsel
...
Rename struct perf_evsel to struct evsel, so we don't have a name clash
when we add struct perf_evsel in libperf.
Committer notes:
Added fixes for arm64, provided by Jiri.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:42 -03:00
Jiri Olsa
9749b90e56
perf tools: Rename struct thread_map to struct perf_thread_map
...
Rename struct thread_map to struct perf_thread_map, so it could be part
of libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:42 -03:00
Jiri Olsa
f854839ba2
perf cpu_map: Rename struct cpu_map to struct perf_cpu_map
...
Rename struct cpu_map to struct perf_cpu_map, so it could be part of
libperf.
Committer notes:
Added fixes for arm64, provided by Jiri.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:42 -03:00
Arnaldo Carvalho de Melo
af4a0991f4
perf evsel: Store backpointer to attached bpf_object
...
We may want to get to this bpf_object, to search for other BPF programs,
etc.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-3y8hrb6lszjfi23vjlic3cib@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:41 -03:00
Jin Yao
064b4e82aa
perf tools: Add a 'percore' event qualifier
...
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.
v4:
---
1. Add Arnaldo's patch which updates the documentation for
this new qualifier.
2. Rebase to latest perf/core branch
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.
Signed-off-by: Jin Yao <yao.jin@linux.intel.com >
Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Jin Yao <yao.jin@intel.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/1555077590-27664-2-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-05-16 14:17:24 -03:00
Andi Kleen
f0fbb114e3
perf stat: Implement duration_time as a proper event
...
The perf metric expression use 'duration_time' internally to normalize
events. Normal 'perf stat' without -x also prints the duration time.
But when using -x, the interval is not output anywhere, which is
inconvenient for any post processing which often wants to normalize
values to time.
So implement 'duration_time' as a proper perf event that can be
specified explicitely with -e.
The previous implementation of 'duration_time' only worked for metric
processing. This adds the concept of a tool event that is handled by the
tool. On the kernel level it is still mapped to the dummy software
event, but the values are not read anymore, but instead computed by the
tool.
Add proper plumbing to handle this in the event parser, and display it
in 'perf stat'. We don't want 'duration_time' to be added up, so it's
only printed for the first CPU.
% perf stat -e duration_time,cycles true
Performance counter stats for 'true':
555,476 ns duration_time
771,958 cycles
0.000555476 seconds time elapsed
0.000644000 seconds user
0.000000000 seconds sys
Signed-off-by: Andi Kleen <ak@linux.intel.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Link: http://lkml.kernel.org/r/20190326221823.11518-3-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-04-01 14:49:24 -03:00
Song Liu
657ee55319
perf evlist: Introduce side band thread
...
This patch introduces side band thread that captures extended
information for events like PERF_RECORD_BPF_EVENT.
This new thread uses its own evlist that uses ring buffer with very low
watermark for lower latency.
To use side band thread, we need to:
1. add side band event(s) by calling perf_evlist__add_sb_event();
2. calls perf_evlist__start_sb_thread();
3. at the end of perf run, perf_evlist__stop_sb_thread().
In the next patch, we use this thread to handle PERF_RECORD_BPF_EVENT.
Committer notes:
Add fix by Jiri Olsa for when te sb_tread can't get started and then at
the end the stop_sb_thread() segfaults when joining the (non-existing)
thread.
That can happen when running 'perf top' or 'perf record' as a normal
user, for instance.
Further checks need to be done on top of this to more graciously handle
these possible failure scenarios.
Signed-off-by: Song Liu <songliubraving@fb.com >
Reviewed-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Alexei Starovoitov <ast@kernel.org >
Cc: Daniel Borkmann <daniel@iogearbox.net >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stanislav Fomichev <sdf@google.com >
Link: http://lkml.kernel.org/r/20190312053051.2690567-15-songliubraving@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-03-21 11:27:03 -03:00
Arnaldo Carvalho de Melo
9cd997f85e
perf evsel: No need to include symbol.h in evsel.h, symbol_conf.h is enough
...
To reduce the header dependency and avoid unnecessary rebuilds when
things change in symbol.h.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-6duflwliprh2tr47w5x4t260@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-02-06 10:00:38 -03:00