diff options
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 67d2a9003294..fa26865364b6 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "util/llvm-utils.h" | 37 | #include "util/llvm-utils.h" |
38 | #include "util/bpf-loader.h" | 38 | #include "util/bpf-loader.h" |
39 | #include "util/trigger.h" | 39 | #include "util/trigger.h" |
40 | #include "util/perf-hooks.h" | ||
40 | #include "asm/bug.h" | 41 | #include "asm/bug.h" |
41 | 42 | ||
42 | #include <unistd.h> | 43 | #include <unistd.h> |
@@ -206,6 +207,12 @@ static void sig_handler(int sig) | |||
206 | done = 1; | 207 | done = 1; |
207 | } | 208 | } |
208 | 209 | ||
210 | static void sigsegv_handler(int sig) | ||
211 | { | ||
212 | perf_hooks__recover(); | ||
213 | sighandler_dump_stack(sig); | ||
214 | } | ||
215 | |||
209 | static void record__sig_exit(void) | 216 | static void record__sig_exit(void) |
210 | { | 217 | { |
211 | if (signr == -1) | 218 | if (signr == -1) |
@@ -833,6 +840,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
833 | signal(SIGCHLD, sig_handler); | 840 | signal(SIGCHLD, sig_handler); |
834 | signal(SIGINT, sig_handler); | 841 | signal(SIGINT, sig_handler); |
835 | signal(SIGTERM, sig_handler); | 842 | signal(SIGTERM, sig_handler); |
843 | signal(SIGSEGV, sigsegv_handler); | ||
836 | 844 | ||
837 | if (rec->opts.auxtrace_snapshot_mode || rec->switch_output) { | 845 | if (rec->opts.auxtrace_snapshot_mode || rec->switch_output) { |
838 | signal(SIGUSR2, snapshot_sig_handler); | 846 | signal(SIGUSR2, snapshot_sig_handler); |
@@ -970,6 +978,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
970 | 978 | ||
971 | trigger_ready(&auxtrace_snapshot_trigger); | 979 | trigger_ready(&auxtrace_snapshot_trigger); |
972 | trigger_ready(&switch_output_trigger); | 980 | trigger_ready(&switch_output_trigger); |
981 | perf_hooks__invoke_record_start(); | ||
973 | for (;;) { | 982 | for (;;) { |
974 | unsigned long long hits = rec->samples; | 983 | unsigned long long hits = rec->samples; |
975 | 984 | ||
@@ -1114,6 +1123,8 @@ out_child: | |||
1114 | } | 1123 | } |
1115 | } | 1124 | } |
1116 | 1125 | ||
1126 | perf_hooks__invoke_record_end(); | ||
1127 | |||
1117 | if (!err && !quiet) { | 1128 | if (!err && !quiet) { |
1118 | char samples[128]; | 1129 | char samples[128]; |
1119 | const char *postfix = rec->timestamp_filename ? | 1130 | const char *postfix = rec->timestamp_filename ? |