Arnaldo Carvalho de Melo
9db0e3635f
perf evsel: Fall back to global 'perf_env' in perf_evsel__env()
...
I.e. if evsel->evlist or evsel->evlist->env isn't set, return the
environment for the running machine, as that would be set if reading
from a perf.data file.
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-uqq4grmhbi12rwb0lfpo6lfu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-30 17:29:57 -03:00
Jiri Olsa
80ab2987a0
libperf: Add perf_evlist__poll() function
...
Move perf_evlist__poll() from tools/perf to libperf, it will be used in
the following patches.
And rename the existing perf's function to evlist__poll().
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-39-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:49 -03:00
Jiri Olsa
20f2be1d48
libperf: Move 'page_size' global variable to libperf
...
We need the 'page_size' variable in libperf, so move it there.
Add a libperf_init() as a global libperf init function to obtain this
value via sysconf() at tool start.
Committer notes:
Add internal/lib.h to tools/perf/ files using 'page_size', sometimes
replacing util.h with it if that was the only reason for having util.h
included.
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-33-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:48 -03:00
Jiri Olsa
40cb2d5141
libperf: Move 'pollfd' from 'struct evlist' to 'struct perf_evlist'
...
Moving 'pollfd' from 'struct evlist' to 'struct perf_evlist' it will be
used in following patches.
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-23-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:47 -03:00
Jiri Olsa
c976ee11a0
libperf: Move 'nr_mmaps' from 'struct evlist' to 'struct perf_evlist'
...
Moving 'nr_mmaps' from 'struct evlist' to 'struct perf_evlist', it will
be used in following patches.
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-21-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:47 -03:00
Jiri Olsa
56a94706cd
libperf: Add 'cpu' to struct perf_mmap
...
Move 'cpu' from tools/perf's mmap to libperf's perf_mmap struct.
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-14-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:45 -03:00
Jiri Olsa
470579b021
perf tools: Rename perf_evlist__exit() to evlist__exit()
...
Rename perf_evlist__exit() to evlist__exit(), so we don't have a name
clash when we add perf_evlist__exit() to libperf.
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-8-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:44 -03:00
Jiri Olsa
9521b5f2d9
perf tools: Rename perf_evlist__mmap() to evlist__mmap()
...
Rename perf_evlist__mmap() to evlist__mmap(), so we don't have a name
clash when we add perf_evlist__mmap() in libperf.
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-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:44 -03:00
Jiri Olsa
a583053299
perf tools: Rename 'struct perf_mmap' to 'struct mmap'
...
Rename 'struct perf_evlist' to 'struct evlist', so we don't have a name
clash when we add 'struct perf_mmap' to libperf.
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-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:44 -03:00
Arnaldo Carvalho de Melo
5939cacc60
perf python: Remove debug.h
...
We only need to have the prototype for the eprintf() replacement we use
in the python binding, provide it and avoid dragging debug.h as a
dependency.
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-s0gy4ur3drmhsknsddwjco59@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-20 09:19:21 -03:00
Arnaldo Carvalho de Melo
87ffb6c640
perf env: Remove needless cpumap.h header
...
Only a 'struct perf_cmp_map' forward allocation is necessary, fix the
places that need the header but were getting it indirectly, by luck,
from env.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-3sj3n534zghxhk7ygzeaqlx9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-20 09:19:21 -03:00
Arnaldo Carvalho de Melo
f2a39fe849
perf auxtrace: Uninline functions that touch perf_session
...
So that we don't carry the session.h include directive in auxtrace.h,
which in turn opens a can of worms of files that were getting all sorts
of things via that include, fix them all.
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-d2d83aovpgri2z75wlitquni@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-31 22:24:10 -03:00
Arnaldo Carvalho de Melo
b42090256f
perf tools: Remove debug.h from header files not needing it
...
And fix the fallout, adding it to places that must have it since they
use its definitions.
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-1s3jel4i26chq2g0lydoz7i3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-29 17:38:32 -03:00
Arnaldo Carvalho de Melo
91854f9a07
perf tools: Move everything related to sys_perf_event_open() to perf-sys.h
...
And remove unneeded include directives from perf-sys.h to prune the
header dependency tree.
Fixup the fallout in places where definitions were being used without
the needed include directives that were being satisfied because they
were in perf-sys.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-7b1zvugiwak4ibfa3j6ott7f@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-29 17:38:32 -03:00
Jiri Olsa
72932371e7
libperf: Rename the PERF_RECORD_ structs to have a "perf" prefix
...
Even more, to have a "perf_record_" prefix, so that they match the
PERF_RECORD_ enum they map to.
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 <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190828135717.7245-23-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-29 08:36:12 -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
Jiri Olsa
003c66fec2
libperf: Add PERF_RECORD_THROTTLE 'struct throttle_event' to perf/event.h
...
Move the PERF_RECORD_THROTTLE event definition into libperf's event.h
header include.
In order to keep libperf simple, we switch 'u64/u32/u16/u8' types used
events to their generic '__u*' versions.
Perf added 'u*' types mainly to ease up printing __u64 values as stated
in the linux/types.h comment:
/*
* We define u64 as uint64_t for every architecture
* so that we can print it with "%"PRIx64 without getting warnings.
*
* typedef __u64 u64;
* typedef __s64 s64;
*/
Add and use new PRI_lu64 and PRI_lx64 macros for that. Use extra '_' to
ease up the reading and differentiate them from standard PRI*64 macros.
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 <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190825181752.722-10-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-26 19:39:10 -03:00
Jiri Olsa
5290ed6955
libperf: Add PERF_RECORD_LOST 'struct lost_event' to perf/event.h
...
Move the lost_event event definition to libperf's event.h header
include.
In order to keep libperf simple, we switch 'u64/u32/u16/u8' types used
events to their generic '__u*' versions.
Perf added 'u*' types mainly to ease up printing __u64 values as stated
in the linux/types.h comment:
/*
* We define u64 as uint64_t for every architecture
* so that we can print it with "%"PRIx64 without getting warnings.
*
* typedef __u64 u64;
* typedef __s64 s64;
*/
Add and use new PRI_lu64 and PRI_lx64 macros for that. Use extra '_' to
ease up the reading and differentiate them from standard PRI*64 macros.
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 <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190825181752.722-7-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-26 19:39:09 -03:00
Jiri Olsa
bceb59b1f2
libperf: Add PERF_RECORD_FORK 'struct fork_event' to perf/event.h
...
Move the fork_event event definition into libperf's event.h header
include.
In order to keep libperf simple, we switch 'u64/u32/u16/u8' types used
events to their generic '__u*' versions.
Perf added 'u*' types mainly to ease up printing __u64 values
as stated in the linux/types.h comment:
/*
* We define u64 as uint64_t for every architecture
* so that we can print it with "%"PRIx64 without getting warnings.
*
* typedef __u64 u64;
* typedef __s64 s64;
*/
Add and use new PRI_lu64 and PRI_lx64 macros for that. Using extra '_'
to ease up the reading and differentiate them from standard PRI*64
macros.
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 <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190825181752.722-6-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-26 19:39:09 -03:00
Jiri Olsa
1345e2ee87
libperf: Add PERF_RECORD_MMAP 'struct mmap_event' to perf/event.h
...
Move the mmap_event event definition to libperf's event.h header
include.
In order to keep libperf simple, we switch 'u64/u32/u16/u8' types used
events to their generic '__u*' versions.
Perf added 'u*' types mainly to ease up printing __u64 values as stated
in the linux/types.h comment:
/*
* We define u64 as uint64_t for every architecture
* so that we can print it with "%"PRIx64 without getting warnings.
*
* typedef __u64 u64;
* typedef __s64 s64;
*/
Add and use new PRI_lu64 and PRI_lx64 macros for that. Use extra '_'
to ease up reading and differentiate them from standard PRI*64 macros.
Committer notes:
Fixup the PRI_l[ux]64 macros on 32-bit arches, conditionally defining it
with that extra 'l' modifier only on arches where __u64 is long long,
leaving it aside on 32-bit arches.
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 <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190825181752.722-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-26 19:38:04 -03:00
Jiri Olsa
9c3516d1b8
libperf: Add perf_cpu_map__new()/perf_cpu_map__read() functions
...
Moving the following functions from tools/perf:
cpu_map__new()
cpu_map__read()
to libperf with the following names:
perf_cpu_map__new()
perf_cpu_map__read()
Committer notes:
Fixed up this one:
tools/perf/arch/arm/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-44-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
6484d2f9dc
libperf: Add nr_entries to struct perf_evlist
...
Move nr_entries count from 'struct perf' to into perf_evlist struct.
Committer notes:
Fix tools/perf/arch/s390/util/auxtrace.c case. And also the comment in
tools/perf/util/annotate.h.
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-42-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:45 -03:00
Jiri Olsa
7836e52e51
libperf: Add perf_thread_map__get()/perf_thread_map__put()
...
Move the following functions:
thread_map__get()
thread_map__put()
thread_map__comm()
to libperf with the following names:
perf_thread_map__get()
perf_thread_map__put()
perf_thread_map__comm()
Add the perf_thread_map__comm() function for it to work/compile.
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-34-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:44 -03:00
Jiri Olsa
38f01d8da1
libperf: Add perf_cpu_map__get()/perf_cpu_map__put()
...
Moving the following functions:
cpu_map__get()
cpu_map__put()
to libperf with following names:
perf_cpu_map__get()
perf_cpu_map__put()
Committer notes:
Added fixes for arm/arm64
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-31-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:44 -03:00
Jiri Olsa
474ddc4c46
perf evlist: Rename perf_evlist__open() to evlist__open()
...
Rename perf_evlist__open() to evlist__open(), so we don't have a name
clash when we add perf_evlist__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-20-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
a1cf3a75d3
perf evlist: Rename perf_evlist__add() to evlist__add()
...
Rename perf_evlist__add() to evlist__add(), so we don't have a name
clash when we add perf_evlist__add() 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-13-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
52c86bca94
perf evlist: Rename perf_evlist__init() to evlist__init()
...
Rename perf_evlist__init() to evlist__init(), so we don't have a name
clash when we add perf_evlist__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-8-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:42 -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
1b2fc358dd
perf tools: Add missing util.h to pick up 'page_size' variable
...
Not to depend of getting it indirectly.
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-tirjsmvu4ektw0k7lm8k9lhu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-06-25 18:35:34 -03:00
Tzvetomir Stoyanov
69769ce159
perf tools, tools lib traceevent: Rename "pevent" member of struct tep_event to "tep"
...
The member "pevent" of the struct tep_event is renamed to "tep". This
makes the struct consistent with the chosen naming convention:
tep (trace event parser), instead of the old pevent.
Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-3-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190401164344.627724996@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-04-01 15:18:10 -03:00
Jiri Olsa
a389aece97
perf python: Do not force closing original perf descriptor in evlist.get_pollfd()
...
Ondřej reported that when compiled with python3, the python extension
regresses in evlist.get_pollfd function behaviour.
The evlist.get_pollfd function creates file objects from evlist's fds
and returns them in a list. The python3 version also sets them to 'close
the original descriptor' when the object dies (is closed), by passing
True via the 'closefd' arg in the PyFile_FromFd call.
The python's closefd doc says:
If closefd is False, the underlying file descriptor will be kept open
when the file is closed.
That's why the following line in python3 closes all evlist fds:
evlist.get_pollfd()
the returned list is immediately destroyed and that takes down the
original events fds.
Passing closefd as False to PyFile_FromFd to fix this.
Reported-by: Ondřej Lysoněk <olysonek@redhat.com >
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Jaroslav Škarvada <jskarvad@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Fixes: 66dfdff03d
("perf tools: Add Python 3 support")
Link: http://lkml.kernel.org/r/20181226112121.5285-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-12-28 16:33:02 -03:00
Tzvetomir Stoyanov
97fbf3f0e0
tools lib traceevent, perf tools: Rename 'struct tep_event_format' to 'struct tep_event'
...
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts.
This renames 'struct tep_event_format' to 'struct tep_event', which
describes more closely the purpose of the struct.
Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/r/20181130154647.436403995@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
[ Fixup conflict with 6e33c250a88f ("tools lib traceevent: Fix compile warnings in tools/lib/traceevent/event-parse.c") ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-12-17 14:56:02 -03:00
Tzvetomir Stoyanov (VMware)
bb39ccb204
tools lib traceevent, perf tools: Rename enum format_flags to enum tep_format_flags
...
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_". This renames enum format_flags
to enum tep_format_flags and adds prefix TEP_ to all of its members.
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180919185722.803127871@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-09-19 17:14:13 -03:00
Tzvetomir Stoyanov (VMware)
2c92f9828b
tools lib traceevent, perf tools: Rename struct format{_field} to struct tep_format{_field}
...
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_". This renames struct format to
struct tep_format and struct format_field to struct tep_format_field
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180919185722.661319373@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-09-19 17:13:15 -03:00
Tzvetomir Stoyanov (VMware)
4963b0f88b
tools lib traceevent, perf tools: Rename struct event_format to struct tep_event_format
...
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_". This renames struct event_format
to struct tep_event_format
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180919185722.495820809@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-09-19 17:11:50 -03:00
Jiri Olsa
721f0dfc3c
perf python: Fix pyrf_evlist__read_on_cpu() interface
...
Jaroslav reported errors from valgrind over perf python script:
# echo 0 > /sys/devices/system/cpu/cpu4/online
# valgrind ./test.py
==7524== Memcheck, a memory error detector
...
==7524== Command: ./test.py
==7524==
pid 7526 exited
==7524== Invalid read of size 8
==7524== at 0xCC2C2B3: perf_mmap__read_forward (evlist.c:780)
==7524== by 0xCC2A681: pyrf_evlist__read_on_cpu (python.c:959)
...
==7524== Address 0x65c4868 is 16 bytes after a block of size 459,36..
==7524== at 0x4C2B955: calloc (vg_replace_malloc.c:711)
==7524== by 0xCC2F484: zalloc (util.h:35)
==7524== by 0xCC2F484: perf_evlist__alloc_mmap (evlist.c:978)
...
The reason for this is in the python interface, that allows a script to
pass arbitrary cpu number, which is then used to access struct
perf_evlist::mmap array. That's obviously wrong and works only when if
all cpus are available and fails if some cpu is missing, like in the
example above.
This patch makes pyrf_evlist__read_on_cpu() search the evlist's maps
array for the proper map to access.
It's linear search at the moment. Based on the way how is the
read_on_cpu used, I don't think we need to be fast in here. But we
could add some hash in the middle to make it fast/er.
We don't allow python interface to set write_backward event attribute,
so it's safe to check only evlist's mmaps.
Reported-by: Jaroslav Škarvada <jskarvad@redhat.com >
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Joe Mario <jmario@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20180817114556.28000-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-08-20 08:54:59 -03:00
Tzvetomir Stoyanov (VMware)
59c1baee25
tools lib traceevent, perf tools: Rename pevent_read_number_* APIs
...
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
APIs: pevent_read_number, pevent_read_number_field
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com >
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180700.804271434@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-08-13 15:22:05 -03:00
Tzvetomir Stoyanov (VMware)
af85cd1952
tools lib traceevent, perf tools: Rename pevent find APIs
...
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
APIs: pevent_find_any_field, pevent_find_common_field,
pevent_find_event, pevent_find_field
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com >
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180700.316995920@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-08-13 15:21:51 -03:00
Tzvetomir Stoyanov (VMware)
096177a8b5
tools lib traceevent, perf tools: Rename struct pevent to struct tep_handle
...
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
the struct pevent to struct tep_handle.
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com >
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180659.706175783@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-08-10 15:29:35 -03:00
Petr Machata
83428f2fad
perf python: Reference Py_None before returning it
...
Python None objects are handled just like all the other objects with
respect to their reference counting. Before returning Py_None, its
reference count thus needs to be bumped.
Signed-off-by: Petr Machata <petrm@mellanox.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Petr Machata <petrm@mellanox.com >
Link: http://lkml.kernel.org/r/b1e565ecccf68064d8d54f37db5d028dda8fa522.1521675563.git.petrm@mellanox.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-03-23 16:45:20 -03:00
Kan Liang
b9bae2c841
perf mmap: Simplify perf_mmap__read_init()
...
It isn't necessary to pass the 'start', 'end' and 'overwrite' arguments
to perf_mmap__read_init(). The data is stored in the struct perf_mmap.
Discard the parameters.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com >
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1520350567-80082-8-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-03-08 10:05:53 -03:00
Kan Liang
0019dc87b9
perf mmap: Simplify perf_mmap__read_event()
...
It isn't necessary to pass the 'overwrite', 'start' and 'end' argument
to perf_mmap__read_event(). Discard them.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com >
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1520350567-80082-7-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-03-08 10:05:53 -03:00
Kan Liang
d6ace3df43
perf mmap: Simplify perf_mmap__consume()
...
It isn't necessary to pass the 'overwrite' argument to
perf_mmap__consume(). Discard it.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com >
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1520350567-80082-6-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-03-08 10:05:52 -03:00
Kan Liang
35b7cdc637
perf python: Switch to new perf_mmap__read_event() interface
...
The perf python binding still use the legacy interface.
No functional change.
Committer notes:
Tested before and after with:
[root@jouet perf]# export PYTHONPATH=/tmp/build/perf/python
[root@jouet perf]# tools/perf/python/twatch.py
cpu: 0, pid: 1183, tid: 6293 { type: exit, pid: 1183, ppid: 1183, tid: 6293, ptid: 6293, time: 17886646588257}
cpu: 2, pid: 13820, tid: 13820 { type: fork, pid: 13820, ppid: 13820, tid: 6306, ptid: 13820, time: 17886869099529}
cpu: 1, pid: 13820, tid: 6306 { type: comm, pid: 13820, tid: 6306, comm: TaskSchedulerFo }
^CTraceback (most recent call last):
File "tools/perf/python/twatch.py", line 68, in <module>
main()
File "tools/perf/python/twatch.py", line 40, in main
evlist.poll(timeout = -1)
KeyboardInterrupt
[root@jouet perf]#
No problems found.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1519945751-37786-3-git-send-email-kan.liang@linux.intel.com
[ Changed bool parameters from 0 to 'false', as per Jiri comment ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-03-05 10:47:07 -03:00