Arnaldo Carvalho de Melo
b239ad28a8
perf beauty open: Detach the syscall_arg agnostic bits from the flags formatter
...
We may want to use this in other contexts, like when formatting the
return of fcntl(fd, F_GETFL).
Make it have the following signature, so that we can set the formatter
for the return argument while processing the arguments of a syscall, as
fcntl, for instance, may return fds, flags, etc, so need different
return value formatters:
size_t formatter(unsigned long value, char *bf, size_t size);
This gets so detached from 'perf trace' internals that we may well get
all these and move to a tools/lib/syscall_beauty/ library at some point
and use it in other tools/ living utilities.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexei Starovoitov <ast@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-9aw8t22ztvnkuv26l6sw1c18@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-07-18 23:13:57 -03:00
Arnaldo Carvalho de Melo
9c47f66748
perf trace beauty fcntl: Basic 'arg' beautifier
...
Sometimes it should be printed as an hex number, like with F_SETLK,
F_SETLKW and F_GETLK, that treat 'arg' as a struct flock pointer, in
other cases it is just an integer.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-2gykg6enk7vos6q0m97hkgsg@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-07-18 23:13:55 -03:00
Arnaldo Carvalho de Melo
5dde91edbf
perf trace beauty: Introduce syscall arg beautifier for long integers
...
Will be used in the fcntl arg beautifier, that nowadays formats as '%ld'
because there is no explicit arg beautifier attached, but as we will
have to first decide what beautifier to use (i.e. it may be a pointer,
etc) then we need to have this exported as a separate beautifier to be
called from there.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-d7bfs3m8m70j3zckeam0kk5d@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-07-18 23:13:54 -03:00
Arnaldo Carvalho de Melo
2c2b1623d4
perf trace beauty: Export the "int" and "hex" syscall arg formatters
...
The most basic ones, for pointers, unaugmented fds, etc, to be used
in the initial fcntl 'arg' beautifier.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-g0lugj4vv6p4jtge32hid6q6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-07-18 23:13:54 -03:00
Arnaldo Carvalho de Melo
f9f83b3344
perf trace beauty: Allow accessing syscall args values in a syscall arg formatter
...
For instance, fcntl's upcoming 'arg' formatter needs to look at the
'cmd' value to decide how to format its value, sometimes it is a file
flags, sometimes an fd, a pointer to a structure, etc.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-2tw2jfaqm48dtw8a4addghze@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-07-18 23:13:53 -03:00
Arnaldo Carvalho de Melo
9cb7cf8644
perf trace beauty: Mask ignored fcntl 'arg' parameter
...
A series of fcntl cmds ignore the third argument, so mask it.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-6vtl3zq1tauamrhm8o380ptn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-07-18 23:13:52 -03:00
Arnaldo Carvalho de Melo
274e86fdd3
perf trace beauty: Export the strarrays scnprintf method
...
As we'll call it from the fcntl cmd scnprintf method, that needs to look
at the cmd to mask the next fcntl argument when it is ignored.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-fzlvkhew5vbxefneuciihgbc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-07-18 23:13:51 -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/tip-2zg9s5nx90yde64j3g4z2uhk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-04-20 13:22:43 -03:00
Arnaldo Carvalho de Melo
fd5cead23f
perf trace: Beautify statx syscall 'flag' and 'mask' arguments
...
To test it, build samples/statx/test_statx, which I did as:
$ make headers_install
$ cc -I ~/git/linux/usr/include samples/statx/test-statx.c -o /tmp/statx
And then use perf trace on it:
# perf trace -e statx /tmp/statx /etc/passwd
statx(/etc/passwd) = 0
results=7ff
Size: 3496 Blocks: 8 IO Block: 4096 regular file
Device: fd:00 Inode: 280156 Links: 1
Access: (0644/-rw-r--r--) Uid: 0 Gid: 0
Access: 2017-03-29 16:01:01.650073438-0300
Modify: 2017-03-10 16:25:14.156479354-0300
Change: 2017-03-10 16:25:14.171479328-0300
0.000 ( 0.007 ms): statx/30648 statx(dfd: CWD, filename: 0x7ef503f4, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff7ef4eb10) = 0
#
Using the test-stat.c options to change the mask:
# perf trace -e statx /tmp/statx -O /etc/passwd > /dev/null
0.000 ( 0.008 ms): statx/30745 statx(dfd: CWD, filename: 0x3a0753f4, flags: SYMLINK_NOFOLLOW, mask: BTIME, buffer: 0x7ffd3a0735c0) = 0
#
# perf trace -e statx /tmp/statx -A /etc/passwd > /dev/null
0.000 ( 0.010 ms): statx/30757 statx(dfd: CWD, filename: 0xa94e63f4, flags: SYMLINK_NOFOLLOW|NO_AUTOMOUNT, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffea94e49d0) = 0
#
# trace --no-inherit -e statx /tmp/statx -F /etc/passwd > /dev/null
0.000 ( 0.011 ms): statx(dfd: CWD, filename: 0x3b02d3f3, flags: SYMLINK_NOFOLLOW|STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffd3b02c850) = 0
#
# trace --no-inherit -e statx /tmp/statx -F -L /etc/passwd > /dev/null
0.000 ( 0.008 ms): statx(dfd: CWD, filename: 0x15cff3f3, flags: STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff15cfdda0) = 0
#
# trace --no-inherit -e statx /tmp/statx -D -O /etc/passwd > /dev/null
0.000 ( 0.009 ms): statx(dfd: CWD, filename: 0xfa37f3f3, flags: SYMLINK_NOFOLLOW|STATX_DONT_SYNC, mask: BTIME, buffer: 0x7ffffa37da20) = 0
#
Adding a probe to get the filename collected as well:
# perf probe 'vfs_getname=getname_flags:72 pathname=result->name:string'
Added new event:
probe:vfs_getname (on getname_flags:72 with pathname=result->name:string)
You can now use it in all perf tools, such as:
perf record -e probe:vfs_getname -aR sleep 1
# trace --no-inherit -e statx /tmp/statx -D -O /etc/passwd > /dev/null
0.169 ( 0.007 ms): statx(dfd: CWD, filename: /etc/passwd, flags: SYMLINK_NOFOLLOW|STATX_DONT_SYNC, mask: BTIME, buffer: 0x7ffda9bf50f0) = 0
#
Same technique could be used to collect and beautify the result put in
the 'buffer' argument.
Finally do a system wide 'perf trace' session looking for any use of statx,
then run the test proggie with various flags:
# trace -e statx
16612.967 ( 0.028 ms): statx/4562 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffef195d660) = 0
33064.447 ( 0.011 ms): statx/4569 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW|STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffc5484c790) = 0
36050.891 ( 0.023 ms): statx/4576 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: BTIME, buffer: 0x7ffeb18b66e0) = 0
38039.889 ( 0.023 ms): statx/4584 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff1db0ea90) = 0
^C#
This one also starts moving the beautifiers from files directly included
in builtin-trace.c to separate objects + a beauty.h header with
prototypes, so that we can add test cases in tools/perf/tests/ to fire
syscalls with various arguments and then get them intercepted as
syscalls:sys_enter_foo or raw_syscalls:sys_enter + sys_exit to then
format and check that the formatted output is the one we expect.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: David Ahern <dsahern@gmail.com >
Cc: David Howells <dhowells@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-xvzw8eynffvez5czyzidhrno@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-03-31 14:42:31 -03:00
Jiri Olsa
2bd42f3aaa
perf trace: Check if MAP_32BIT is defined (again)
...
There might be systems where MAP_32BIT is not defined, like some some
RHEL7 powerpc versions.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Kyle McMartin <kyle@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Fixes: 256763b017
("perf trace beauty mmap: Add more conditional defines")
Link: http://lkml.kernel.org/r/1481831814-23683-1-git-send-email-jolsa@kernel.org
[ Changed the Fixme cset to the one removing the conditional switch case for MAP_32BIT ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-12-20 09:37:40 -03:00
Wang Nan
f752e90e9c
perf trace beauty mmap: Add missing MADV_FREE
...
tools/perf/trace/beauty/mmap.c forgets to check MADV_FREE.
This patch fixes it.
Signed-off-by: Wang Nan <wangnan0@huawei.com >
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com >
Cc: Zefan Li <lizefan@huawei.com >
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1473850649-83389-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-19 11:25:07 -03:00
Arnaldo Carvalho de Melo
277cf08f3f
perf trace beauty mmap: Fix defines for non !x86_64
...
Several defines have different values in different arches, so we can't
just define it to the x86_64 value, use uapi/linux/mmap.h that was
recently introduced to reliably find those, not using possibly outdated
libc headers.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Cc: Zefan Li <lizefan@huawei.com >
Link: http://lkml.kernel.org/n/tip-4eajp5yp8i2fuw44n7jmcg5t@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-13 15:26:29 -03:00
Arnaldo Carvalho de Melo
6e6fec966d
perf trace beauty seccomp: Remove seccomp.h include
...
All we need from it is already conditionally defined, and this header
file is not present in older systems, so ditch it.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-3jxpz9gwahk4e7ltqtnr1rjg@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 15:20:38 -03:00
Arnaldo Carvalho de Melo
e53e6bb8eb
perf trace beauty futex_op: Add missing defines for older systems
...
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-6qkuhv2mrcxmpy5sasc3c9tf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 15:20:37 -03:00
Arnaldo Carvalho de Melo
ffe3a28a8b
perf trace beauty open_flags: Add more conditional defines
...
Don't handle some flags only if they have its defines in headers at
time of building, define what is missing.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-wgjxeidwpowrvqgrxr080k6u@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 00:00:39 -03:00
Arnaldo Carvalho de Melo
4c7c224ac4
perf trace beauty flock: Add more conditional defines
...
Don't handle some flags only if they have its defines in headers at
time of building, define what is missing.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-pgoxanv1y6hfcnryxawzuskl@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 00:00:39 -03:00
Arnaldo Carvalho de Melo
256763b017
perf trace beauty mmap: Add more conditional defines
...
Don't handle some flags only if they have its defines in headers at
time of building, define what is missing.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-czbmxb01xzcl3h2qxuzoqkj5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 00:00:39 -03:00
Arnaldo Carvalho de Melo
9d4a94cabc
perf trace beauty open_flags: Add missing headers
...
Those beautifiers need to make sure they include what they reference,
as changes in builtin-trace.c may end up removing needed stuff, like
when undefining _GNU_SOURCE.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-a9cz8za6lqutfapn5e7uum09@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 00:00:39 -03:00
Arnaldo Carvalho de Melo
f8e018704c
perf trace beauty flock: Add missing fcntl.h include
...
Those beautifiers need to make sure they include what they reference,
as changes in builtin-trace.c may end up removing needed stuff, like
when undefining _GNU_SOURCE.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-2etqhfmgv5jcnfwnkbwadns2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 00:00:39 -03:00
Arnaldo Carvalho de Melo
0e91e6bfd3
perf trace beauty msg_flags: Remove MSG_TRYHARD
...
It is the same as MSG_DONTROUTE and is only defined together with
_GNU_SOURCE.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-q4vbov6jl0e0152y01kv2htw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 00:00:39 -03:00
Arnaldo Carvalho de Melo
3be28870c0
perf trace beauty eventfd: No need to include eventfd.h
...
Old systems such as RHEL5 lack this file, and what we need is
already under ifdefs, so just ditch this #include.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-dzbjfllw6znuoy37skwnwa4r@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-30 18:27:43 -03:00
Arnaldo Carvalho de Melo
a41af25b3c
perf trace beauty sched_policy: Define SCHED_RESET_ON_FORK for older systems
...
RHEL5 for instance doesn't have this one, help it.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-3adewnii78zi110eovfciopy@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-06-30 18:27:43 -03:00
Arnaldo Carvalho de Melo
f5cd95ea60
perf trace: Move seccomp args beautifiers to tools/perf/trace/beauty/
...
To reduce the size of builtin-trace.c.
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/n/tip-ovxifncj34ynrjjseg33lil3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-11 13:06:00 -03:00
Arnaldo Carvalho de Melo
8bf382ce0a
perf trace: Move flock op beautifier to tools/perf/trace/beauty/
...
To reduce the size of builtin-trace.c.
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/n/tip-c4c47w2a2jx13terl2p2hros@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-11 12:24:59 -03:00
Arnaldo Carvalho de Melo
d5d71e86d2
perf trace: Move futex_op beautifier to tools/perf/trace/beauty/
...
To reduce the size of builtin-trace.c.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-vb8dpy7bptkf219q5c25ulfp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-06 13:00:59 -03:00
Arnaldo Carvalho de Melo
8f48df69b4
perf trace: Move open_flags beautifier to tools/perf/trace/beauty/
...
To reduce the size of builtin-trace.c.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-jt293541hv9od7gqw6lilioh@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-06 13:00:58 -03:00
Arnaldo Carvalho de Melo
12199d8e20
perf trace: Move signum beautifier to tools/perf/trace/beauty/
...
To reduce the size of builtin-trace.c.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-qecqxwwtreio6eaatfv58yq5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-05-06 13:00:57 -03:00
Arnaldo Carvalho de Melo
a30e6259b5
perf trace: Move msg_flags beautifier to tools/perf/trace/beauty/
...
To reduce the size of builtin-trace.c.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-11zxg3qitk6bw2x30135k9z4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-28 09:58:59 -03:00
Arnaldo Carvalho de Melo
073e5fca53
perf trace: Read thread's COMM from /proc when not set
...
We get notifications for threads that gets created while we're tracing,
but for preexisting threads we may end not having synthesized them, like
when tracing a 'perf trace' session that will use '--pid' to trace some
other thread.
And besides we should probably stop synthesizing those records and
instead read thread information in a lazy way, i.e. just when we need,
like done in this patch:
Now the 'pid_t' argument in 'perf_event_open' gets translated to a COMM:
# perf trace -e perf_event_open perf stat -e cycles -p 31601
0.027 ( 0.027 ms): perf/23393 perf_event_open(attr_uptr: 0x2fdd0d8, pid: 31601 (abrt-dump-journ), cpu: -1, group_fd: -1, flags: FD_CLOEXEC)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 3
^C
And in other syscalls containing pid_t without thread->comm_set at the
time of the formatting.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Milian Wolff <milian.wolff@kdab.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-ioeps6dlwst17d6oozc9shtk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-26 13:15:00 -03:00
Arnaldo Carvalho de Melo
62de344e4f
perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/
...
To reduce the size of builtin-trace.c.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-8r3gmymyn3r0ynt4yuzspp9g@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-26 13:14:59 -03:00
Arnaldo Carvalho de Melo
bbf86c43ea
perf trace: Move socket_type beautifier to tools/perf/trace/beauty/
...
To reduce the size of builtin-trace.c.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-ao91htwxdqwlwxr47gbluou1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-14 13:53:10 -03:00
Arnaldo Carvalho de Melo
ea8dc3cefb
perf trace: Move eventfd beautifiers to trace/beauty/ directory
...
To better organize all these beautifiers.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Milian Wolff <milian.wolff@kdab.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-zrw5zz7cnrs44o5osouyutvt@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-14 08:57:53 -03:00
Arnaldo Carvalho de Melo
df4cb1678e
perf trace: Move mmap beautifiers to trace/beauty/ directory
...
To better organize all these beautifiers.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Milian Wolff <milian.wolff@kdab.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-zbr27mdy9ssdhux3ib2nfa7j@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-14 08:57:53 -03:00
Arnaldo Carvalho de Melo
ba2f22cf99
perf trace: Beautify mode_t arguments
...
When reading the syscall tracepoint /format file, look for arguments of type
"mode_t" and attach a beautifier:
[root@jouet ~]# cat ~/bin/tp_with_fields_of_type
#!/bin/bash
grep -w $1 /sys/kernel/tracing/events/syscalls/*/format | sed -r 's%.*sys_enter_(.*)/format.*%\1%g' | paste -d, -s
# tp_with_fields_of_type umode_t
chmod,creat,fchmodat,fchmod,mkdirat,mkdir,mknodat,mknod,mq_open,openat,open
#
Testing it:
#define S_ISUID 0004000
#define S_ISGID 0002000
#define S_ISVTX 0001000
#define S_IRWXU 0000700
#define S_IRUSR 0000400
#define S_IWUSR 0000200
#define S_IXUSR 0000100
#define S_IRWXG 0000070
#define S_IRGRP 0000040
#define S_IWGRP 0000020
#define S_IXGRP 0000010
#define S_IRWXO 0000007
#define S_IROTH 0000004
#define S_IWOTH 0000002
#define S_IXOTH 0000001
# for mode in 4000 2000 1000 700 400 200 100 70 40 20 10 7 4 2 1 ; do \
echo -n $mode '->' ; trace --no-inherit -e chmod,fchmodat,fchmod chmod $mode x; \
done
4000 -> 0.338 ( 0.012 ms): fchmodat(dfd: CWD, filename: x, mode: ISUID) = 0
2000 -> 0.438 ( 0.015 ms): fchmodat(dfd: CWD, filename: x, mode: ISGID) = 0
1000 -> 0.677 ( 0.040 ms): fchmodat(dfd: CWD, filename: x, mode: ISVTX) = 0
700 -> 0.394 ( 0.013 ms): fchmodat(dfd: CWD, filename: x, mode: IRWXU) = 0
400 -> 0.337 ( 0.010 ms): fchmodat(dfd: CWD, filename: x, mode: IRUSR) = 0
200 -> 0.259 ( 0.008 ms): fchmodat(dfd: CWD, filename: x, mode: IWUSR) = 0
100 -> 0.249 ( 0.008 ms): fchmodat(dfd: CWD, filename: x, mode: IXUSR) = 0
70 -> 0.266 ( 0.008 ms): fchmodat(dfd: CWD, filename: x, mode: IRWXG) = 0
40 -> 0.329 ( 0.009 ms): fchmodat(dfd: CWD, filename: x, mode: IRGRP) = 0
20 -> 0.250 ( 0.009 ms): fchmodat(dfd: CWD, filename: x, mode: IWGRP) = 0
10 -> 0.259 ( 0.008 ms): fchmodat(dfd: CWD, filename: x, mode: IXGRP) = 0
7 -> 0.249 ( 0.009 ms): fchmodat(dfd: CWD, filename: x, mode: IRWXO) = 0
4 -> 0.278 ( 0.011 ms): fchmodat(dfd: CWD, filename: x, mode: IROTH) = 0
2 -> 0.276 ( 0.009 ms): fchmodat(dfd: CWD, filename: x, mode: IWOTH) = 0
1 -> 0.250 ( 0.008 ms): fchmodat(dfd: CWD, filename: x, mode: IXOTH) = 0
#
# trace --no-inherit -e chmod,fchmodat,fchmod chmod 7777 x
0.258 ( 0.011 ms): fchmodat(dfd: CWD, filename: x, mode: IALLUGO) = 0
# trace --no-inherit -e chmod,fchmodat,fchmod chmod 7770 x
0.258 ( 0.008 ms): fchmodat(dfd: CWD, filename: x, mode: ISUID|ISGID|ISVTX|IRWXU|IRWXG) = 0
# trace --no-inherit -e chmod,fchmodat,fchmod chmod 777 x
0.293 ( 0.012 ms): fchmodat(dfd: CWD, filename: x, mode: IRWXUGO
#
Now lets see if check by using the tracepoint for that specific syscall,
instead of raw_syscalls:sys_enter as 'trace' does for its strace fu:
# trace --no-inherit --ev syscalls:sys_enter_fchmodat -e fchmodat chmod 666 x
0.255 ( ): syscalls:sys_enter_fchmodat:dfd: 0xffffffffffffff9c, filename: 0x55db32a3f0f0, mode: 0x000001b6)
0.268 ( 0.012 ms): fchmodat(dfd: CWD, filename: x, mode: IRUGO|IWUGO ) = 0
#
Perfect, 0x1bc == 0666.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-18e8zfgbkj83xo87yoom43kd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-08 09:58:13 -03:00
Arnaldo Carvalho de Melo
d1d438a3b1
perf trace: Beautify pid_t arguments
...
When reading the syscall tracepoint /format file, look for arguments
of type "pid_t" and attach the PID beautifier, that will do a lookup
on the threads it knows, i.e. the ones that came from PERF_RECORD_COMM
events and add the COMM after the pid in such args:
Excerpt of a system wide trace for syscalls with pid_t args:
55602.977 ( 0.006 ms): bash/12122 setpgid(pid: 24347 (bash), pgid: 24347 (bash)) = 0
55603.024 ( 0.004 ms): bash/24347 setpgid(pid: 24347 (bash), pgid: 24347 (bash)) = 0
55691.527 (88.397 ms): bash/12122 wait4(upid: -1, stat_addr: 0x7ffe0cee1720, options: UNTRACED|CONTINUED) ...
55692.479 ( 0.952 ms): git/24347 wait4(upid: 24368, stat_addr: 0x7ffe030d5724) ...
55694.549 ( 2.070 ms): pre-commit/24368 wait4(upid: -1, stat_addr: 0x7ffc94f4fc10) = 24369 (pre-commit)
55694.575 ( 0.002 ms): pre-commit/24368 wait4(upid: -1, stat_addr: 0x7ffc94f4f650, options: NOHANG) = -1 ECHILD No child processes
55695.934 ( 0.010 ms): pre-commit/24368 wait4(upid: -1, stat_addr: 0x7ffc94f4f2d0, options: NOHANG) = 24370 (git)
55695.937 ( 0.001 ms): pre-commit/24368 wait4(upid: -1, stat_addr: 0x7ffc94f4f2d0, options: NOHANG) = -1 ECHILD No child processes
55717.963 ( 0.000 ms): pre-commit/24371 ... [continued]: wait4()) = 24372
55717.978 (21.468 ms): :24371/24371 wait4(upid: -1, stat_addr: 0x7ffc94f4f230) ...
55718.087 ( 0.109 ms): pre-commit/24371 wait4(upid: -1, stat_addr: 0x7ffc94f4f230) = 24373 (tr)
55718.187 ( 0.096 ms): pre-commit/24371 wait4(upid: -1, stat_addr: 0x7ffc94f4f230) = 24374 (wc)
55718.218 ( 0.002 ms): pre-commit/24371 wait4(upid: -1, stat_addr: 0x7ffc94f4eed0, options: NOHANG) = -1 ECHILD No child processes
55718.367 ( 0.005 ms): pre-commit/24368 wait4(upid: -1, stat_addr: 0x7ffc94f4f1d0, options: NOHANG) = 24371 (pre-commit)
55718.369 ( 0.001 ms): pre-commit/24368 wait4(upid: -1, stat_addr: 0x7ffc94f4f1d0, options: NOHANG) = -1 ECHILD No child processes
55741.021 (49.494 ms): git/24347 ... [continued]: wait4()) = 24368 (pre-commit)
74146.427 (18319.601 ms): git/24347 wait4(upid: 24375 (git), stat_addr: 0x7ffe030d6824) ...
74149.036 ( 0.891 ms): bash/24391 wait4(upid: -1, stat_addr: 0x7ffe0cee0560) = 24393 (sed)
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-75yl9hzjhb020iadc81gdj8t@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-06 19:36:30 -03:00
Arnaldo Carvalho de Melo
7206b900e6
perf trace: Beautify wait4/waitid 'options' argument
...
# trace -e waitid,wait4
0.557 ( 0.557 ms): bash/27335 wait4(upid: -1, stat_addr: 0x7ffd02f449f0) = 27336
1.250 ( 0.685 ms): bash/27335 wait4(upid: -1, stat_addr: 0x7ffd02f449f0) = 27337
1.312 ( 0.002 ms): bash/27335 wait4(upid: -1, stat_addr: 0x7ffd02f44690, options: NOHANG) = -1 ECHILD No child processes
1.550 ( 0.015 ms): bash/3856 wait4(upid: -1, stat_addr: 0x7ffd02f44990, options: NOHANG|UNTRACED|CONTINUED) = 27335
1.552 ( 0.001 ms): bash/3856 wait4(upid: -1, stat_addr: 0x7ffd02f44990, options: NOHANG|UNTRACED|CONTINUED) = 0
#
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-i5vlo5n5jv0amt8bkyicmdxh@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-06 14:13:43 -03:00
Arnaldo Carvalho de Melo
a3bca91f2f
perf trace: Beautify sched_setscheduler 'policy' argument
...
$ trace -e sched_setscheduler chrt -f 1 usleep 1
chrt: failed to set pid 0's policy: Operation not permitted
0.005 ( 0.005 ms): chrt/19189 sched_setscheduler(policy: FIFO, param: 0x7ffec5273d70) = -1 EPERM Operation not permitted
$
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-i5vlo5n5jv0amt8bkyicmdxh@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-06 14:13:40 -03:00
Arnaldo Carvalho de Melo
cf2f33a4e5
perf trace: Add read/write to the file group
...
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Stephane Eranian <eranian@google.com >
Link: http://lkml.kernel.org/n/tip-l6812iuai3g486z3mn8ufan8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 13:22:06 -03:00
Arnaldo Carvalho de Melo
005438a8ee
perf trace: Support 'strace' syscall event groups
...
I.e.:
$ cat ~/share/perf-core/strace/groups/file
access
chmod
creat
execve
faccessat
getcwd
lstat
mkdir
open
openat
quotactl
readlink
rename
rmdir
stat
statfs
symlink
unlink
$
Then, on a quiet desktop, try running this and then moving your mouse to
see the deluge of mouse related activity:
# perf probe 'vfs_getname=getname_flags:72 pathname=filename:string'
Added new event:
probe:vfs_getname (on getname_flags:72 with pathname=filename:string)
You can now use it in all perf tools, such as:
perf record -e probe:vfs_getname -aR sleep 1
#
# trace --ev probe:vfs_getname --filter-pids 2232 -e file
0.042 (0.042 ms): mousetweaks/2235 open(filename: 0x14e3910, mode: 438 ) ...
0.042 ( ): probe:vfs_getname:(ffffffff812230bc) pathname="/home/acme/.icons/Adwaita/cursors/xterm")
0.100 (0.100 ms): mousetweaks/2235 ... [continued]: open()) = -1 ENOENT No such file or directory
0.142 (0.018 ms): mousetweaks/2235 open(filename: 0x14c3c10, mode: 438 ) ...
0.142 ( ): probe:vfs_getname:(ffffffff812230bc) pathname="/home/acme/.icons/Adwaita/index.theme")
0.192 (0.069 ms): mousetweaks/2235 ... [continued]: open()) = -1 ENOENT No such file or directory
0.230 (0.017 ms): mousetweaks/2235 open(filename: 0x14c3c10, mode: 438 ) ...
0.230 ( ): probe:vfs_getname:(ffffffff812230bc) pathname="/usr/share/icons/Adwaita/cursors/xterm")
0.253 (0.041 ms): mousetweaks/2235 ... [continued]: open()) = 14
0.459 (0.008 ms): mousetweaks/2235 open(filename: 0x14e3910, mode: 438 ) ...
0.459 ( ): probe:vfs_getname:(ffffffff812230bc) pathname="/home/acme/.icons/Adwaita/cursors/left_side")
0.468 (0.017 ms): mousetweaks/2235 ... [continued]: open()) = -1 ENOENT No such file or directory
Need to combine that raw_syscalls:sys_enter(open) + probe:vfs_getname +
raw_syscalls:sys_exit(open) sequence...
Now, if you're bored, please write some more syscall groups, like the ones
in 'strace' and send it our way :-)
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Milian Wolff <mail@milianw.de >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Stephane Eranian <eranian@google.com >
Link: http://lkml.kernel.org/n/tip-a42xklu59lcbxp7bbnic74a8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-07-20 15:16:32 -03:00