aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-05-06 08:58:02 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-05-06 12:00:57 -0400
commit12199d8e20bb4a2ad164d2600bf199557d55c35c (patch)
tree276c9cc1fb196ac3b734253491a649a0e3487bc9 /tools
parent0b1abbf4a7d273a13065534d718661fc904703b9 (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-trace.c54
-rw-r--r--tools/perf/trace/beauty/signum.c53
2 files changed, 54 insertions, 53 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 9d23edc06698..e7f2697e7ca6 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -621,59 +621,6 @@ static size_t syscall_arg__scnprintf_pipe_flags(char *bf, size_t size,
621 621
622#define SCA_PIPE_FLAGS syscall_arg__scnprintf_pipe_flags 622#define SCA_PIPE_FLAGS syscall_arg__scnprintf_pipe_flags
623 623
624static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscall_arg *arg)
625{
626 int sig = arg->val;
627
628 switch (sig) {
629#define P_SIGNUM(n) case SIG##n: return scnprintf(bf, size, #n)
630 P_SIGNUM(HUP);
631 P_SIGNUM(INT);
632 P_SIGNUM(QUIT);
633 P_SIGNUM(ILL);
634 P_SIGNUM(TRAP);
635 P_SIGNUM(ABRT);
636 P_SIGNUM(BUS);
637 P_SIGNUM(FPE);
638 P_SIGNUM(KILL);
639 P_SIGNUM(USR1);
640 P_SIGNUM(SEGV);
641 P_SIGNUM(USR2);
642 P_SIGNUM(PIPE);
643 P_SIGNUM(ALRM);
644 P_SIGNUM(TERM);
645 P_SIGNUM(CHLD);
646 P_SIGNUM(CONT);
647 P_SIGNUM(STOP);
648 P_SIGNUM(TSTP);
649 P_SIGNUM(TTIN);
650 P_SIGNUM(TTOU);
651 P_SIGNUM(URG);
652 P_SIGNUM(XCPU);
653 P_SIGNUM(XFSZ);
654 P_SIGNUM(VTALRM);
655 P_SIGNUM(PROF);
656 P_SIGNUM(WINCH);
657 P_SIGNUM(IO);
658 P_SIGNUM(PWR);
659 P_SIGNUM(SYS);
660#ifdef SIGEMT
661 P_SIGNUM(EMT);
662#endif
663#ifdef SIGSTKFLT
664 P_SIGNUM(STKFLT);
665#endif
666#ifdef SIGSWI
667 P_SIGNUM(SWI);
668#endif
669 default: break;
670 }
671
672 return scnprintf(bf, size, "%#x", sig);
673}
674
675#define SCA_SIGNUM syscall_arg__scnprintf_signum
676
677#if defined(__i386__) || defined(__x86_64__) 624#if defined(__i386__) || defined(__x86_64__)
678/* 625/*
679 * FIXME: Make this available to all arches. 626 * FIXME: Make this available to all arches.
@@ -793,6 +740,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,
793#include "trace/beauty/msg_flags.c" 740#include "trace/beauty/msg_flags.c"
794#include "trace/beauty/perf_event_open.c" 741#include "trace/beauty/perf_event_open.c"
795#include "trace/beauty/sched_policy.c" 742#include "trace/beauty/sched_policy.c"
743#include "trace/beauty/signum.c"
796#include "trace/beauty/socket_type.c" 744#include "trace/beauty/socket_type.c"
797#include "trace/beauty/waitid_options.c" 745#include "trace/beauty/waitid_options.c"
798 746
diff --git a/tools/perf/trace/beauty/signum.c b/tools/perf/trace/beauty/signum.c
new file mode 100644
index 000000000000..d3b0b1fab077
--- /dev/null
+++ b/tools/perf/trace/beauty/signum.c
@@ -0,0 +1,53 @@
1
2static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscall_arg *arg)
3{
4 int sig = arg->val;
5
6 switch (sig) {
7#define P_SIGNUM(n) case SIG##n: return scnprintf(bf, size, #n)
8 P_SIGNUM(HUP);
9 P_SIGNUM(INT);
10 P_SIGNUM(QUIT);
11 P_SIGNUM(ILL);
12 P_SIGNUM(TRAP);
13 P_SIGNUM(ABRT);
14 P_SIGNUM(BUS);
15 P_SIGNUM(FPE);
16 P_SIGNUM(KILL);
17 P_SIGNUM(USR1);
18 P_SIGNUM(SEGV);
19 P_SIGNUM(USR2);
20 P_SIGNUM(PIPE);
21 P_SIGNUM(ALRM);
22 P_SIGNUM(TERM);
23 P_SIGNUM(CHLD);
24 P_SIGNUM(CONT);
25 P_SIGNUM(STOP);
26 P_SIGNUM(TSTP);
27 P_SIGNUM(TTIN);
28 P_SIGNUM(TTOU);
29 P_SIGNUM(URG);
30 P_SIGNUM(XCPU);
31 P_SIGNUM(XFSZ);
32 P_SIGNUM(VTALRM);
33 P_SIGNUM(PROF);
34 P_SIGNUM(WINCH);
35 P_SIGNUM(IO);
36 P_SIGNUM(PWR);
37 P_SIGNUM(SYS);
38#ifdef SIGEMT
39 P_SIGNUM(EMT);
40#endif
41#ifdef SIGSTKFLT
42 P_SIGNUM(STKFLT);
43#endif
44#ifdef SIGSWI
45 P_SIGNUM(SWI);
46#endif
47 default: break;
48 }
49
50 return scnprintf(bf, size, "%#x", sig);
51}
52
53#define SCA_SIGNUM syscall_arg__scnprintf_signum