Arnaldo Carvalho de Melo
44b58e06e8
perf tools: Do parameter validation earlier on fetch_kernel_version()
...
While trying to reduce util.[ch] I noticed that fetch_kernel_version()
and fetch_ubuntu_kernel_version() do lots of operations only to check if
they are needed, i.e. it checks if the pointer where to return the
kernel version is NULL only after obtaining the kernel version from
/proc/version_signature or by parsing the results from uname().
Do it earlier not to confuse people reading this code in the future :-)
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-06-20 12:19:16 -03:00
Arnaldo Carvalho de Melo
2157f6ee18
perf evsel: Adopt find_process()
...
And make it static, nobody else uses it, if we ever need it in more
places we can carve a new source file for process related methods,
for now lets reduce util.{c,h} a tad more.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-06-20 12:05:38 -03:00
Arnaldo Carvalho de Melo
3caeafce53
perf units: Move parse_tag_value() to units.[ch]
...
Its basically to do units handling, so move to a more appropriately
named object.
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-26 15:40:31 -03:00
Arnaldo Carvalho de Melo
98521b3869
perf memswap: Split the byteswap memory range wrappers from util.[ch]
...
Just one more step into splitting util.[ch] to reduce the includes hell.
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-25 15:45:35 -03:00
Arnaldo Carvalho de Melo
7a8ef4c4b5
perf tools: Remove string.h, unistd.h and sys/stat.h from util.h
...
Not needed in this header, added to the places that need FILE,
putchar(), access() and a few other prototypes.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-24 13:43:33 -03:00
Arnaldo Carvalho de Melo
56e2e05644
perf callchain: Move callchain specific routines from util.[ch]
...
Where they belong, no point in leaving those in the generic "util"
files.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-24 13:43:26 -03:00
Arnaldo Carvalho de Melo
8c2b7cac78
perf debug: Move dump_stack() and sighandler_dump_stack() to debug.h
...
Two more out of util.h.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-24 12:33:31 -03:00
Arnaldo Carvalho de Melo
bb8c16db43
perf kvm: Make function only used by 'perf kvm' static
...
No need to have this polluting util.h, it was polluted enough already.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-24 12:33:26 -03:00
Arnaldo Carvalho de Melo
c5e4027e05
perf tools: Move timestamp routines from util.h to time-utils.h
...
We already have a header for time utilities, so use it.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-20 13:22:44 -03:00
Arnaldo Carvalho de Melo
58db1d6e7d
perf tools: Move units conversion/formatting routines to separate object
...
Out of util.h, to disentangle it a bit more.
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-20 13:22:44 -03:00
Arnaldo Carvalho de Melo
9607ad3a63
perf tools: Add signal.h to places using its definitions
...
And remove it from util.h, disentangling it a bit more.
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-20 13:22:43 -03:00
Arnaldo Carvalho de Melo
76b31a29dd
perf tools: Remove include dirent.h from util.h
...
The files using the dirent.h routines should instead include it,
reducing the includes hell that lead to longer build times.
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:55 -03:00
Arnaldo Carvalho de Melo
9a3993d408
perf tools: Move path related functions to util/path.h
...
Disentangling util.h header mess a bit more.
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:53 -03:00
Arnaldo Carvalho de Melo
fea013928c
perf tools: Move print_binary definitions to separate files
...
Continuing the split of util.[ch] into more manageable bits.
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:50 -03:00
Arnaldo Carvalho de Melo
3d689ed609
perf tools: Move sane ctype stuff from util.h to sane_ctype.h
...
More stuff that came from git, out of the hodge-podge that is util.h
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:48 -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
David Carrillo-Cisneros
570eda0321
perf util: Hint missing file when tool tips fail to load
...
Besides memory allocation failure, tips.txt may fail to load because the
file is not found (a more likely cause).
Communicate that to the user in tips failure warning.
Signed-off-by: David Carrillo-Cisneros <[email protected] >
Acked-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: He Kuang <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Paul Turner <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Simon Que <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-13 11:52:51 -03:00
Joe Stringer
9a9c733d68
tools perf util: Make rm_rf(path) argument const
...
rm_rf() doesn't modify its path argument, and a future caller will pass
a string constant into it to delete.
Signed-off-by: Joe Stringer <[email protected] >
Cc: Alexei Starovoitov <[email protected] >
Cc: Daniel Borkmann <[email protected] >
Cc: Wang Nan <[email protected] >
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-01-31 16:20:07 -03:00
Jiri Olsa
9808143ba2
perf tools: Add unit_number__scnprintf function
...
Add unit_number__scnprintf function to display size units and use it in
-m option info message.
Before:
$ perf record -m 10M ls
rounding mmap pages size to 16777216 bytes (4096 pages)
...
After:
$ perf record -m 10M ls
rounding mmap pages size to 16M (4096 pages)
...
Signed-off-by: Jiri Olsa <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
[ Rename it to unit_number__scnprintf for consistency ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-01-11 16:48:01 -03:00
David Ahern
c284d669a2
perf tools: Move parse_nsec_time to time-utils.c
...
Code move only; no functional change intended.
Committer notes:
Fix the build on Ubuntu 16.04 x86-64 cross-compiling to S/390, with this
set of auto-detected features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ on ]
Where it was failing with:
CC /tmp/build/perf/util/time-utils.o
util/time-utils.c: In function 'parse_nsec_time':
util/time-utils.c:17:13: error: implicit declaration of function 'strtoul' [-Werror=implicit-function-declaration]
time_sec = strtoul(str, &end, 10);
^
util/time-utils.c:17:2: error: nested extern declaration of 'strtoul' [-Werror=nested-externs]
time_sec = strtoul(str, &end, 10);
^
util/time-utils.c: In function 'perf_time__parse_str':
util/time-utils.c:93:2: error: implicit declaration of function 'free' [-Werror=implicit-function-declaration]
free(str);
^
util/time-utils.c:93:2: error: incompatible implicit declaration of built-in function 'free' [-Werror]
util/time-utils.c:93:2: note: include '<stdlib.h>' or provide a declaration of 'free'
Do as suggested and add a '#include <stdlib.h>' to get the free() and strtoul()
declarations and fix the build.
Signed-off-by: David Ahern <[email protected] >
Acked-by: Namhyung Kim <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-12-01 13:02:39 -03:00
Wang Nan
d18acd15c6
perf tools: Fix kernel version error in ubuntu
...
On ubuntu the internal kernel version code is different from what can
be retrived from uname:
$ uname -r
4.4.0-47-generic
$ cat /lib/modules/`uname -r`/build/include/generated/uapi/linux/version.h
#define LINUX_VERSION_CODE 263192
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
$ cat /lib/modules/`uname -r`/build/include/generated/utsrelease.h
#define UTS_RELEASE "4.4.0-47-generic"
#define UTS_UBUNTU_RELEASE_ABI 47
$ cat /proc/version_signature
Ubuntu 4.4.0-47.68-generic 4.4.24
The macro LINUX_VERSION_CODE is set to 4.4.24 (263192 == 0x40418), but
`uname -r` reports 4.4.0.
This mismatch causes LINUX_VERSION_CODE macro passed to BPF script become
an incorrect value, results in magic failure in BPF loading:
$ sudo ./buildperf/perf record -e ./tools/perf/tests/bpf-script-example.c ls
event syntax error: './tools/perf/tests/bpf-script-example.c'
\___ Failed to load program for unknown reason
According to Ubuntu document (https://wiki.ubuntu.com/Kernel/FAQ ), the
correct kernel version can be retrived through /proc/version_signature, which
is ubuntu specific.
This patch checks the existance of /proc/version_signature, and returns
version number through parsing this file instead of uname. Version string
is untouched (value returns from uname) because `uname -r` is required
to be consistence with path of kbuild directory in /lib/module.
Signed-off-by: Wang Nan <[email protected] >
Cc: Alexei Starovoitov <[email protected] >
Cc: He Kuang <[email protected] >
Cc: Zefan Li <[email protected] >
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-11-25 11:00:30 -03:00
Namhyung Kim
99620a5d0c
perf tools: Introduce timestamp__scnprintf_usec()
...
Joonwoo reported that there's a mismatch between timestamps in script
and sched commands. This was because of difference in printing the
timestamp. Factor out the code and share it so that they can be in
sync. Also I found that sched map has similar problem, fix it too.
Committer notes:
Fixed the max_lat_at bug introduced by Namhyung's original patch, as
pointed out by Joonwoo, and made it a function following the scnprintf()
model, i.e. returning the number of bytes formatted, and receiving as
the first parameter the object from where the data to the formatting is
obtained, renaming it from:
char *timestamp_in_usec(char *bf, size_t size, u64 timestamp)
to
int timestamp__scnprintf_usec(u64 timestamp, char *bf, size_t size)
Reported-by: Joonwoo Park <[email protected] >
Signed-off-by: Namhyung Kim <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-10-28 11:29:40 -02:00
Arnaldo Carvalho de Melo
bd48c63eb0
tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros
...
And remove it from tools/perf/{perf,util}.h, making code that needs
these macros to include linux/time64.h instead, to match how this is
used in the kernel sources.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Steven Rostedt <[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-08-23 15:37:33 -03:00
Jiri Olsa
accaed2659
perf tools: Make is_printable_array global
...
It's used from 2 objects in perf, so it's better to keep just one copy.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Pirko <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Steven Rostedt <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-07-18 19:49:47 -03:00
Jiri Olsa
347ca87806
perf tests: Fix hist accumulation test
...
User's values from .perfconfig could overload the default callchain
setup and cause this test to fail. Making sure the test is using
default callchain_param values.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-07-04 19:39:01 -03:00
Masami Hiramatsu
2a1ef032cf
perf tools: Fix rm_rf() to handle non-regular files correctly
...
Fix rm_rf() to handle non-regular files correctly. This fix includes two
changes;
- Fix to use lstat(3) instead of stat(3) since if the target
file is a symbolic link, rm_rf() should unlink the symbolic
link itself, not the file which pointed by the symlink.
- Fix to unlink non-regular files (except for directory),
including symlink.
Even though the first one fixes to stat symlink itself, without second
fix, it still failed because the symlink is not a regular file.
Signed-off-by: Masami Hiramatsu <[email protected] >
Cc: Ananth N Mavinakayanahalli <[email protected] >
Cc: Brendan Gregg <[email protected] >
Cc: Hemant Kumar <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/20160608092911.3116.90929.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-06-14 09:29:54 -03:00
Arnaldo Carvalho de Melo
a29d5c9b81
perf tools: Separate accounting of contexts and real addresses in a stack trace
...
The perf_sample->ip_callchain->nr value includes all the entries in the
ip_callchain->ip[] array, real addresses and PERF_CONTEXT_{KERNEL,USER,etc},
while what the user expects is that what is in the kernel.perf_event_max_stack
sysctl or in the upcoming per event perf_event_attr.sample_max_stack knob be
honoured in terms of IP addresses in the stack trace.
So match the kernel support and validate chain->nr taking into account
both kernel.perf_event_max_stack and kernel.perf_event_max_contexts_per_stack.
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexei Starovoitov <[email protected] >
Cc: Brendan Gregg <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: He Kuang <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Milian Wolff <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Vince Weaver <[email protected] >
Cc: Wang Nan <[email protected] >
Cc: Zefan Li <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-05-16 23:11:54 -03:00
Masami Hiramatsu
357a54f32a
perf tools: Fix lsdir to set errno correctly
...
Fix lsdir() to set correct positive error number (ENOMEM). Since
"errno" must have a positive error number instead of negative number,
fix lsdir to set it correctly.
Signed-off-by: Masami Hiramatsu <[email protected] >
Cc: Ananth N Mavinakayanahalli <[email protected] >
Cc: Brendan Gregg <[email protected] >
Cc: Hemant Kumar <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Fixes: e1ce726e1d ("perf tools: Add lsdir() helper to read a directory")
Link: http://lkml.kernel.org/r/20160511135127.23943.40644.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-05-11 13:06:05 -03:00
He Kuang
841e3558b2
perf callchain: Recording 'dwarf' callchains do not need DWARF unwinding support
...
There is no need to check for DWARF unwinding support when using the
'dwarf' callchain record method, as this will only ask the kernel to
collect stack dumps for later DWARF CFI processing, which can be done in
another machine, where the support for DWARF unwinding need to be
present.
Signed-off-by: He Kuang <[email protected] >
Acked-by: Jiri Olsa <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Ekaterina Tumanova <[email protected] >
Cc: Josh Poimboeuf <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Pekka Enberg <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Sukadev Bhattiprolu <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-05-09 13:29:36 -03:00
Arnaldo Carvalho de Melo
4cb93446c5
perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack
...
There is an upper limit to what tooling considers a valid callchain,
and it was tied to the hardcoded value in the kernel,
PERF_MAX_STACK_DEPTH (127), now that this can be tuned via a sysctl,
make it read it and use that as the upper limit, falling back to
PERF_MAX_STACK_DEPTH for kernels where this sysctl isn't present.
Cc: Adrian Hunter <[email protected] >
Cc: Brendan Gregg <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[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-27 10:29:07 -03:00
Masami Hiramatsu
e1ce726e1d
perf tools: Add lsdir() helper to read a directory
...
As a utility function, add lsdir() which reads given directory and store
entry name into a strlist. lsdir accepts a filter function so that user
can filter out unneeded entries.
Signed-off-by: Masami Hiramatsu <[email protected] >
Signed-off-by: Masami Hiramatsu <[email protected] >
Cc: Ananth N Mavinakayanahalli <[email protected] >
Cc: Hemant Kumar <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/20160426090242.11891.79014.stgit@devbox
[ Do not use the 'dirname' it is used in some distros ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-04-26 13:14:55 -03:00
Wang Nan
c339b1a90e
perf tools: Make binary data printer code in trace_event public available
...
Move code printing binray data from trace_event() to utils.c and allows
passing different printer. Further commits will use this logic to print
bpf output event.
Signed-off-by: Wang Nan <[email protected] >
Cc: Brendan Gregg <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Li Zefan <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-02-24 11:38:01 -03:00
Jiri Olsa
607bfbd7ff
tools lib api fs: Adopt filename__read_str from perf
...
We already moved similar functions in here, also it'll be useful for
sysfs__read_str addition in following patch.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-02-16 17:12:56 -03:00
Wang Nan
37b20151ef
perf tools: Move timestamp creation to util
...
Timestamp generation becomes a public available helper. Which will
be used by 'perf record', help it output to split output file based
on time.
For example:
perf.data.2015122620363710
perf.data.2015122620364092
perf.data.2015122620365423
...
Signed-off-by: Wang Nan <[email protected] >
Cc: Alexei Starovoitov <[email protected] >
Cc: Brendan Gregg <[email protected] >
Cc: Daniel Borkmann <[email protected] >
Cc: He Kuang <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Li Zefan <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Zefan Li <[email protected] >
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: He Kuang <[email protected] >
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-01-29 17:30:06 -03:00
Jiri Olsa
403567217d
perf symbols: Do not read symbols/data from device files
...
With mem sampling we could get data source within mapped device file.
Processing such sample would block during report phase on trying to read
the device file.
Chacking for device files and skip the processing if it's detected.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-01-26 11:52:43 -03:00
Namhyung Kim
34b7b0f95d
perf tools: Fallback to srcdir/Documentation/tips.txt
...
Some people don't install perf, but just use compiled version in the
source. Fallback to lookup the source directory for those poor guys. :)
Signed-off-by: Namhyung Kim <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
[ Make perf_tip() return NULL for ENOENT, making the fallback to really take place ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-01-12 12:42:08 -03:00
Namhyung Kim
14cbfbeb76
perf report: Show random usage tip on the help line
...
Currently perf report only shows a help message "For a higher level
overview, try: perf report --sort comm,dso" unconditionally (even if
the sort keys were used). Add more help tips and show randomly.
Load tips from ${prefix}/share/doc/perf-tip/tips.txt file.
$ perf report | tail
0.10% swapper [kernel.vmlinux] [k] irq_exit
0.09% swapper [kernel.vmlinux] [k] flush_smp_call_function_queue
0.08% swapper [kernel.vmlinux] [k] native_write_msr_safe
0.03% swapper [kernel.vmlinux] [k] group_sched_in
0.01% perf [kernel.vmlinux] [k] native_write_msr_safe
#
# (Tip: Search options using a keyword: perf report -h <keyword>)
#
Signed-off-by: Namhyung Kim <[email protected] >
Acked-by: Ingo Molnar <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
[ Renamed it to perf_tip() and the parameter dirname to dirpath to fix the build on older distros ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-01-08 13:15:46 -03:00
Arnaldo Carvalho de Melo
9daddf66a3
perf tools: Use same signal handling strategy as 'record'
...
I.e. don't exit with the signal number, instead set the signal handler
to the default one and then raise it again.
Noticed while trying to dump the stack at segfaults in the 'perf test'
forked process used to run each test, that inspects signal info at
each test.
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-12-14 12:08:55 -03:00
Josh Poimboeuf
1fe143c5f9
perf tools: Move term functions out of util.c
...
The term functions are needed by help.c which is going to be moved into
a separate library. Move them out of util.c and into their own file.
Signed-off-by: Josh Poimboeuf <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/9a39c854dd156b55ebda57e427594c9a59dcb40f.1449548395.git.jpoimboe@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-12-09 13:42:02 -03:00
Namhyung Kim
f2af008695
perf report: Add callchain value option
...
Now -g/--call-graph option supports how to display callchain values.
Possible values are 'percent', 'period' and 'count'. The percent is
same as before and it's the default behavior. The period displays the
raw period value rather than the percentage. The count displays the
number of occurrences.
$ perf report --no-children --stdio -g percent
...
39.93% swapper [kernel.vmlinux] [k] intel_idel
|
---intel_idle
cpuidle_enter_state
cpuidle_enter
call_cpuidle
cpu_startup_entry
|
|--28.63%-- start_secondary
|
--11.30%-- rest_init
$ perf report --no-children --show-total-period --stdio -g period
...
39.93% 13018705 swapper [kernel.vmlinux] [k] intel_idel
|
---intel_idle
cpuidle_enter_state
cpuidle_enter
call_cpuidle
cpu_startup_entry
|
|--9334403-- start_secondary
|
--3684302-- rest_init
$ perf report --no-children --show-nr-samples --stdio -g count
...
39.93% 80 swapper [kernel.vmlinux] [k] intel_idel
|
---intel_idle
cpuidle_enter_state
cpuidle_enter
call_cpuidle
cpu_startup_entry
|
|--57-- start_secondary
|
--23-- rest_init
Signed-off-by: Namhyung Kim <[email protected] >
Acked-by: Brendan Gregg <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-11-19 13:19:23 -03:00
Wang Nan
07bc5c699a
perf tools: Make fetch_kernel_version() publicly available
...
There are 2 places in llvm-utils.c which find kernel version information
through uname. This patch extracts the uname related code into a
fetch_kernel_version() function and puts it into util.h so it can be
reused.
Signed-off-by: Wang Nan <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Zefan Li <[email protected] >
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-11-06 15:57:18 -03:00
Namhyung Kim
792aeafa8e
perf tools: Defaults to 'caller' callchain order only if --children is enabled
...
The caller callchain order is useful with --children option since it can
show 'overview' style output, but other commands which don't use
--children feature like 'perf script' or even 'perf report/top' without
--children are better to keep callee order.
Signed-off-by: Namhyung Kim <[email protected] >
Acked-by: Brendan Gregg <[email protected] >
Acked-by: Frederic Weisbecker <[email protected] >
Acked-by: Ingo Molnar <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Chandler Carruth <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-10-22 15:40:11 -03:00
Arnaldo Carvalho de Melo
def02db0d6
perf callchain: Switch default to 'graph,0.5,caller'
...
Which is the most common default found in other similar tools.
Requested-by: Ingo Molnar <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Chandler Carruth <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Frederic Weisbecker <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Wang Nan <[email protected] >
Link: https://www.youtube.com/watch?v=nXaxk27zwlk
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-10-05 17:59:43 -03:00
Ingo Molnar
02386c356a
Merge branch 'perf/urgent' into perf/core, to pick up fixes before applying new changes
...
Signed-off-by: Ingo Molnar <[email protected] >
2015-09-18 09:24:01 +02:00
Peter Senna Tschudin
bf6445631c
perf tools: Bool functions shouldn't return -1
...
Returning a negative value for a boolean function seem to have the
undesired effect of returning true. Replace -1 by false in a
bool-returning function.
The diff of the .s file before and after the change (for x86_64):
3907c3907
< movl $1, %ebx
---
> xorl %ebx, %ebx
while if -1 is replaced by true, the diff is empty.
This issue was found by the following Coccinelle semantic patch:
<smpl>
@@
identifier f;
constant C;
typedef bool;
@@
bool f (...){
<+...
* return -C;
...+>
}
</smpl>
Signed-off-by: Peter Senna Tschudin <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Matt Fleming <[email protected] >
Cc: Milos Vyletel <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Steven Rostedt <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-09-17 15:31:52 -03:00
Jiri Olsa
592d5a6ba8
tools lib api fs: Move tracing_path interface into api/fs/tracing_path.c
...
Moving tracing_path interface into api/fs/tracing_path.c out of util.c.
It seems generic enough to be used by others, and I couldn't think of
better place.
Signed-off-by: Jiri Olsa <[email protected] >
Reviewed-by: Matt Fleming <[email protected] >
Reviewed-by: Raphael Beamonte <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Steven Rostedt <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-09-04 12:00:45 -03:00
Jiri Olsa
65d4b26510
perf tools: Move tracing_path stuff under same namespace
...
Renaming all functions touching tracing_path under same namespace. New
interface is:
char tracing_path[];
- tracing mount path
char tracing_events_path[];
- tracing mount/events path
void tracing_path_set(const char *mountpoint);
- setting directly tracing_path(_events), used by --debugfs-dir option
const char *tracing_path_mount(void);
- initial setup of tracing_(events)_path, called from perf.c
mounts debugfs/tracefs if needed and possible
char *get_tracing_file(const char *name);
void put_tracing_file(char *file);
- get/put tracing file path
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Raphael Beamonte <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Matt Fleming <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Steven Rostedt <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-09-02 16:30:47 -03:00
Jiri Olsa
f6a09af7de
perf tools: Remove mountpoint arg from perf_debugfs_mount
...
It's not used by any caller. We either detect the mountpoint or use
hardcoded one.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Raphael Beamonte <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Matt Fleming <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Steven Rostedt <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-09-02 16:30:47 -03:00
Jiri Olsa
9f30fffc78
perf tools: Do not change lib/api/fs/debugfs directly
...
The tracing_events_path is the variable we want to change via
--debugfs-dir option, not the debugfs_mountpoint.
Signed-off-by: Jiri Olsa <[email protected] >
Reviewed-by: Matt Fleming <[email protected] >
Cc: Raphael Beamonte <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-08-28 14:53:53 -03:00
Jiri Olsa
9f44f0cc1c
perf tools: Add tracing_path and remove unneeded functions
...
There's no need for find_tracing_dir, because perf already searches for
debugfs/tracefs mount on start and populate tracing_events_path.
Adding tracing_path to carry tracing dir string to be used in
get_tracing_file instead of calling find_tracing_dir.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Raphael Beamonte <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Matt Fleming <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-08-28 14:53:51 -03:00