Arnaldo Carvalho de Melo
a43783aeec
perf tools: Include errno.h where needed
...
Removing it from util.h, part of an effort to disentangle the includes
hell, that makes changes to util.h or something included by it to cause
a complete rebuild of the tools.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-19 13:01:51 -03:00
Arnaldo Carvalho de Melo
fd20e8111c
perf tools: Including missing inttypes.h header
...
Needed to use the PRI[xu](32,64) formatting macros.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-19 13:01:46 -03:00
Namhyung Kim
bb963e1650
perf utils: Check verbose flag properly
...
It now can have negative value to suppress the message entirely. So it
needs to check it being positive.
Signed-off-by: Namhyung Kim <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
[ Adjust fuzz on tools/perf/util/pmu.c, add > 0 checks in many other places ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-02-20 11:35:54 -03:00
Arnaldo Carvalho de Melo
9ef6839bcc
perf tests record: No need to test an array against NULL
...
It will always evaluate to 'true', as clang warns:
CC /tmp/build/perf/tests/perf-record.o
CC /tmp/build/perf/tests/evsel-roundtrip-name.o
tests/perf-record.c:69:24: error: comparison of array 'argv' equal to a null pointer is always false [-Werror,-Wtautological-pointer-compare]
if (evlist == NULL || argv == NULL) {
^~~~ ~~~~
1 error generated.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-02-13 17:22:34 -03:00
Arnaldo Carvalho de Melo
1fbe7df819
perf tests: Add missing pthread.h include for CPU_*() macros
...
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-07-12 15:19:53 -03:00
Arnaldo Carvalho de Melo
c8b5f2c96d
tools: Introduce str_error_r()
...
The tools so far have been using the strerror_r() GNU variant, that
returns a string, be it the buffer passed or something else.
But that, besides being tricky in cases where we expect that the
function using strerror_r() returns the error formatted in a provided
buffer (we have to check if it returned something else and copy that
instead), breaks the build on systems not using glibc, like Alpine
Linux, where musl libc is used.
So, introduce yet another wrapper, str_error_r(), that has the GNU
interface, but uses the portable XSI variant of strerror_r(), so that
users rest asured that the provided buffer is used and it is what is
returned.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-07-12 15:19:47 -03:00
Arnaldo Carvalho de Melo
e68ae9cf7d
perf evsel: Do not use globals in config()
...
Instead receive a callchain_param pointer to configure callchain
aspects, not doing so if NULL is passed.
This will allow fine grained control over which evsels in an evlist
gets callchains enabled.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Milian Wolff <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-04-11 22:18:20 -03:00
Arnaldo Carvalho de Melo
2e4f81ee90
perf test: No need for setting attr.sample_freq on the RECORD test
...
We're not looking at PERF_RECORD_SAMPLE entries and now by default we
use PERF_COUNT_SW_DUMMY, so just remove that setting.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-01-07 13:20:22 -03:00
Arnaldo Carvalho de Melo
69ef8f4755
perf test: Use "dummy" events in the PERF_RECORD_ test
...
As we're test just the !PERF_RECORD_SAMPLE records.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-01-07 13:17:00 -03:00
Arnaldo Carvalho de Melo
721a1f53df
perf tests: Pass the subtest index to each test routine
...
Some tests have sub-tests we want to run, so allow passing this.
Wang tried to avoid having to touch all tests, but then, having the
test.func in an anonymous union makes the build fail on older compilers,
like the one in RHEL6, where:
test a = {
.func = foo,
};
fails.
To fix it leave the func pointer in the main structure and pass the subtest
index to all tests, end result function is the same, but we have just one
function pointer, not two, with and without the subtest index as an argument.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-11-19 13:19:15 -03:00
Arnaldo Carvalho de Melo
f66a889dbc
perf evlist: Introduce poll method for common code idiom
...
Since we have access two evlist members in all these poll calls, provide
a helper.
This will also help to make the patch introducing the pollfd class more
clear, as the evlist specific uses will be hiden away
perf_evlist__poll().
Acked-by: Jiri Olsa <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Corey Ashford <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jean Pihet <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2014-09-25 16:46:55 -03:00
Masami Hiramatsu
ba3dfff8ad
perf test: Use strerror_r instead of strerror
...
Use strerror_r instead of strerror in error messages for thread-safety.
Signed-off-by: Masami Hiramatsu <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Naohiro Aota <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2014-08-15 13:07:28 -03:00
Arnaldo Carvalho de Melo
509051ea84
perf record: Rename --no-delay to --no-buffering
...
That is how the option summary describes it and so that we can free
--delay to replace --initial-delay and then be consistent with stat's
--delay equivalent option.
Suggested-by: Ingo Molnar <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2014-01-14 17:57:04 -03:00
Arnaldo Carvalho de Melo
983874d173
perf evlist: Auto unmap on destructor
...
Removing further boilerplate after making sure perf_evlist__munmap can
be called multiple times for the same evlist.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2014-01-13 10:06:22 -03:00
Arnaldo Carvalho de Melo
f26e1c7cb2
perf evlist: Close fds on destructor
...
Since it is safe to call perf_evlist__close() multiple times, autoclose
it and remove the calls to the close from existing tools, reducing the
tooling boilerplate.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2014-01-13 10:06:22 -03:00
Arnaldo Carvalho de Melo
03ad9747c5
perf evlist: Move destruction of maps to evlist destructor
...
Instead of requiring tools to do an extra destructor call just before
calling perf_evlist__delete.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2014-01-13 10:06:21 -03:00
Arnaldo Carvalho de Melo
735f7e0bbe
perf evlist: Move the SIGUSR1 error reporting logic to prepare_workload
...
So that we have the boilerplate in the preparation method, instead of
open coded in tools wanting the reporting when the exec fails.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2014-01-13 10:06:21 -03:00
Arnaldo Carvalho de Melo
b40067964f
perf tools: Rename 'perf_record_opts' to 'record_opts
...
Reduce typing, functions use class__method convention, so unlikely to
clash with other libraries.
This actually was discussed in the "Link:" referenced message below.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-12-19 14:43:45 -03:00
Ingo Molnar
aac898548d
Merge branch 'perf/urgent' into perf/core
...
Conflicts:
tools/perf/builtin-record.c
tools/perf/builtin-top.c
tools/perf/util/hist.h
2013-10-29 11:23:32 +01:00
Zhouyi Zhou
8e50d384cc
perf tools: Fixup mmap event consumption
...
The tail position of the event buffer should only be modified after
actually use that event.
If not the event buffer could be invalid before use, and segment fault
occurs when invoking perf top -G.
Signed-off-by: Zhouyi Zhou <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Zhouyi Zhou <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
[ Simplified the logic using exit gotos and renamed write_tail method to mmap_consume ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-10-28 16:06:00 -03:00
Jiri Olsa
b22d54b09a
perf evlist: Introduce perf_evlist__new_default function
...
Adding new common function to create evlist with default event. It
spares some code lines in automated tests.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Corey Ashford <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-10-09 11:24:34 -03:00
Stephane Eranian
5c5e854bc7
perf tools: Add attr->mmap2 support
...
This patch adds support for the new PERF_RECORD_MMAP2 record type
exposed by the kernel. This is an extended PERF_RECORD_MMAP record.
It adds for each file-backed mapping the device major, minor number and
the inode number and generation.
This triplet uniquely identifies the source of a file-backed mapping. It
can be used to detect identical virtual mappings between processes, for
instance.
The patch will prefer MMAP2 over MMAP.
Signed-off-by: Stephane Eranian <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
[ Cope with 314add6 "Change machine__findnew_thread() to set thread pid",
fix 'perf test' regression test entry affected,
use perf_missing_features.mmap2 to fallback to not using .mmap2 in older kernels,
so that new tools can work with kernels where this feature is not present ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-09-11 10:09:32 -03:00
Namhyung Kim
da522c1703
perf tests: Fixup return path of perf record test case
...
Add missing perf_evlist__close() function.
Signed-off-by: Namhyung Kim <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-03-15 13:06:12 -03:00
Namhyung Kim
55e162ea76
perf evlist: Add want_signal parameter to perf_evlist__prepare_workload()
...
In case a caller doesn't want to receive SIGUSR1 when the child failed
to exec().
Signed-off-by: Namhyung Kim <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-03-15 13:06:03 -03:00
Namhyung Kim
119fa3c922
perf evlist: Do not pass struct record_opts to perf_evlist__prepare_workload()
...
Since it's only used for checking ->pipe_output, we can pass the result
directly.
Now the perf_evlist__prepare_workload() don't have a dependency of
struct perf_record_opts, it can be called from other places like perf
stat.
Signed-off-by: Namhyung Kim <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-03-15 13:06:02 -03:00
Namhyung Kim
6ef73ec449
perf evlist: Pass struct perf_target to perf_evlist__prepare_workload()
...
It's a preparation step of removing @opts arg from the function so that
it can be used more widely.
Signed-off-by: Namhyung Kim <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-03-15 13:06:02 -03:00
Namhyung Kim
334fe7a3c6
perf evlist: Remove cpus and threads arguments from perf_evlist__new()
...
It's almost always used with NULL for both arguments. Get rid of the
arguments from the signature and use perf_evlist__set_maps() if needed.
Signed-off-by: Namhyung Kim <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
[ committer note: replaced spaces with tabs in some of the affected lines ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-03-15 13:06:01 -03:00
Arnaldo Carvalho de Melo
ec13abc37f
perf tests: Fix leaks on PERF_RECORD_* test
...
This test:
7: Validate PERF_RECORD_* events & perf_sample fields
needs to call perf_evlist__delete_maps().
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2013-01-30 10:35:02 -03:00
Arnaldo Carvalho de Melo
f77a951826
perf evlist: Set the leader in the perf_evlist__config method
...
Since we need to ensure the leader is set before configuring the
evsel perf_event_attrs.
Reducing the boilerplate needed by tools, helping, for instance,
'perf trace', that wasn't setting the leader.
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2012-12-11 17:19:01 -03:00
Arnaldo Carvalho de Melo
7be5ebe876
perf evsel: Update sample_size when setting sample_type bits
...
We use evsel->sample_size to detect underflows in
perf_evsel__parse_sample, but we were failing to update it after
perf_evsel__init(), i.e. when we decide, after creating an evsel, that
we want some extra field bit set.
Fix it by introducing methods to set a bit that will take care of
correctly adjusting evsel->sample_size.
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mike Galbraith <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2012-12-10 14:53:43 -03:00
Jiri Olsa
16d00fee70
perf tests: Move test__PERF_RECORD into separate object
...
Separating test__PERF_RECORD test from the builtin-test into perf-record
object.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Corey Ashford <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2012-11-14 16:49:43 -03:00