diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-13 11:10:19 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-14 07:57:53 -0400 |
commit | ea8dc3cefba0a0decaedc710b218a6ceffe0194a (patch) | |
tree | 7476d9832a5e2218fbb7c1d31585fd12ed07c578 | |
parent | df4cb1678e2ea91eb66665f00c4a43d898a12697 (diff) |
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>
-rw-r--r-- | tools/perf/builtin-trace.c | 41 | ||||
-rw-r--r-- | tools/perf/trace/beauty/eventfd.c | 38 |
2 files changed, 39 insertions, 40 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index abd5a94f5dbe..8e090a785c5e 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -47,20 +47,6 @@ | |||
47 | #include <sys/ptrace.h> | 47 | #include <sys/ptrace.h> |
48 | #include <linux/random.h> | 48 | #include <linux/random.h> |
49 | 49 | ||
50 | /* For older distros: */ | ||
51 | |||
52 | #ifndef EFD_SEMAPHORE | ||
53 | # define EFD_SEMAPHORE 1 | ||
54 | #endif | ||
55 | |||
56 | #ifndef EFD_NONBLOCK | ||
57 | # define EFD_NONBLOCK 00004000 | ||
58 | #endif | ||
59 | |||
60 | #ifndef EFD_CLOEXEC | ||
61 | # define EFD_CLOEXEC 02000000 | ||
62 | #endif | ||
63 | |||
64 | #ifndef O_CLOEXEC | 50 | #ifndef O_CLOEXEC |
65 | # define O_CLOEXEC 02000000 | 51 | # define O_CLOEXEC 02000000 |
66 | #endif | 52 | #endif |
@@ -772,32 +758,6 @@ static size_t syscall_arg__scnprintf_perf_flags(char *bf, size_t size, | |||
772 | 758 | ||
773 | #define SCA_PERF_FLAGS syscall_arg__scnprintf_perf_flags | 759 | #define SCA_PERF_FLAGS syscall_arg__scnprintf_perf_flags |
774 | 760 | ||
775 | static size_t syscall_arg__scnprintf_eventfd_flags(char *bf, size_t size, | ||
776 | struct syscall_arg *arg) | ||
777 | { | ||
778 | int printed = 0, flags = arg->val; | ||
779 | |||
780 | if (flags == 0) | ||
781 | return scnprintf(bf, size, "NONE"); | ||
782 | #define P_FLAG(n) \ | ||
783 | if (flags & EFD_##n) { \ | ||
784 | printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \ | ||
785 | flags &= ~EFD_##n; \ | ||
786 | } | ||
787 | |||
788 | P_FLAG(SEMAPHORE); | ||
789 | P_FLAG(CLOEXEC); | ||
790 | P_FLAG(NONBLOCK); | ||
791 | #undef P_FLAG | ||
792 | |||
793 | if (flags) | ||
794 | printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags); | ||
795 | |||
796 | return printed; | ||
797 | } | ||
798 | |||
799 | #define SCA_EFD_FLAGS syscall_arg__scnprintf_eventfd_flags | ||
800 | |||
801 | static size_t syscall_arg__scnprintf_pipe_flags(char *bf, size_t size, | 761 | static size_t syscall_arg__scnprintf_pipe_flags(char *bf, size_t size, |
802 | struct syscall_arg *arg) | 762 | struct syscall_arg *arg) |
803 | { | 763 | { |
@@ -986,6 +946,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size, | |||
986 | .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \ | 946 | .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \ |
987 | .arg_parm = { [arg] = &strarray__##array, } | 947 | .arg_parm = { [arg] = &strarray__##array, } |
988 | 948 | ||
949 | #include "trace/beauty/eventfd.c" | ||
989 | #include "trace/beauty/pid.c" | 950 | #include "trace/beauty/pid.c" |
990 | #include "trace/beauty/mmap.c" | 951 | #include "trace/beauty/mmap.c" |
991 | #include "trace/beauty/mode_t.c" | 952 | #include "trace/beauty/mode_t.c" |
diff --git a/tools/perf/trace/beauty/eventfd.c b/tools/perf/trace/beauty/eventfd.c new file mode 100644 index 000000000000..d64f4a9128a1 --- /dev/null +++ b/tools/perf/trace/beauty/eventfd.c | |||
@@ -0,0 +1,38 @@ | |||
1 | #include <sys/eventfd.h> | ||
2 | |||
3 | #ifndef EFD_SEMAPHORE | ||
4 | #define EFD_SEMAPHORE 1 | ||
5 | #endif | ||
6 | |||
7 | #ifndef EFD_NONBLOCK | ||
8 | #define EFD_NONBLOCK 00004000 | ||
9 | #endif | ||
10 | |||
11 | #ifndef EFD_CLOEXEC | ||
12 | #define EFD_CLOEXEC 02000000 | ||
13 | #endif | ||
14 | |||
15 | static size_t syscall_arg__scnprintf_eventfd_flags(char *bf, size_t size, struct syscall_arg *arg) | ||
16 | { | ||
17 | int printed = 0, flags = arg->val; | ||
18 | |||
19 | if (flags == 0) | ||
20 | return scnprintf(bf, size, "NONE"); | ||
21 | #define P_FLAG(n) \ | ||
22 | if (flags & EFD_##n) { \ | ||
23 | printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \ | ||
24 | flags &= ~EFD_##n; \ | ||
25 | } | ||
26 | |||
27 | P_FLAG(SEMAPHORE); | ||
28 | P_FLAG(CLOEXEC); | ||
29 | P_FLAG(NONBLOCK); | ||
30 | #undef P_FLAG | ||
31 | |||
32 | if (flags) | ||
33 | printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags); | ||
34 | |||
35 | return printed; | ||
36 | } | ||
37 | |||
38 | #define SCA_EFD_FLAGS syscall_arg__scnprintf_eventfd_flags | ||