diff options
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 4e75583ddd6d..564491fa18b2 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -197,7 +197,7 @@ static void sig_atexit(void) | |||
197 | if (child_pid > 0) | 197 | if (child_pid > 0) |
198 | kill(child_pid, SIGTERM); | 198 | kill(child_pid, SIGTERM); |
199 | 199 | ||
200 | if (signr == -1) | 200 | if (signr == -1 || signr == SIGUSR1) |
201 | return; | 201 | return; |
202 | 202 | ||
203 | signal(signr, SIG_DFL); | 203 | signal(signr, SIG_DFL); |
@@ -515,6 +515,7 @@ static int __cmd_record(int argc, const char **argv) | |||
515 | atexit(sig_atexit); | 515 | atexit(sig_atexit); |
516 | signal(SIGCHLD, sig_handler); | 516 | signal(SIGCHLD, sig_handler); |
517 | signal(SIGINT, sig_handler); | 517 | signal(SIGINT, sig_handler); |
518 | signal(SIGUSR1, sig_handler); | ||
518 | 519 | ||
519 | if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { | 520 | if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { |
520 | perror("failed to create pipes"); | 521 | perror("failed to create pipes"); |
@@ -606,6 +607,7 @@ static int __cmd_record(int argc, const char **argv) | |||
606 | execvp(argv[0], (char **)argv); | 607 | execvp(argv[0], (char **)argv); |
607 | 608 | ||
608 | perror(argv[0]); | 609 | perror(argv[0]); |
610 | kill(getppid(), SIGUSR1); | ||
609 | exit(-1); | 611 | exit(-1); |
610 | } | 612 | } |
611 | 613 | ||
@@ -697,17 +699,18 @@ static int __cmd_record(int argc, const char **argv) | |||
697 | if (err < 0) | 699 | if (err < 0) |
698 | err = event__synthesize_kernel_mmap(process_synthesized_event, | 700 | err = event__synthesize_kernel_mmap(process_synthesized_event, |
699 | session, machine, "_stext"); | 701 | session, machine, "_stext"); |
700 | if (err < 0) { | 702 | if (err < 0) |
701 | pr_err("Couldn't record kernel reference relocation symbol.\n"); | 703 | pr_err("Couldn't record kernel reference relocation symbol\n" |
702 | return err; | 704 | "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n" |
703 | } | 705 | "Check /proc/kallsyms permission or run as root.\n"); |
704 | 706 | ||
705 | err = event__synthesize_modules(process_synthesized_event, | 707 | err = event__synthesize_modules(process_synthesized_event, |
706 | session, machine); | 708 | session, machine); |
707 | if (err < 0) { | 709 | if (err < 0) |
708 | pr_err("Couldn't record kernel reference relocation symbol.\n"); | 710 | pr_err("Couldn't record kernel module information.\n" |
709 | return err; | 711 | "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n" |
710 | } | 712 | "Check /proc/modules permission or run as root.\n"); |
713 | |||
711 | if (perf_guest) | 714 | if (perf_guest) |
712 | perf_session__process_machines(session, event__synthesize_guest_os); | 715 | perf_session__process_machines(session, event__synthesize_guest_os); |
713 | 716 | ||
@@ -761,7 +764,7 @@ static int __cmd_record(int argc, const char **argv) | |||
761 | } | 764 | } |
762 | } | 765 | } |
763 | 766 | ||
764 | if (quiet) | 767 | if (quiet || signr == SIGUSR1) |
765 | return 0; | 768 | return 0; |
766 | 769 | ||
767 | fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking); | 770 | fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking); |
@@ -790,7 +793,7 @@ static const char * const record_usage[] = { | |||
790 | 793 | ||
791 | static bool force, append_file; | 794 | static bool force, append_file; |
792 | 795 | ||
793 | static const struct option options[] = { | 796 | const struct option record_options[] = { |
794 | OPT_CALLBACK('e', "event", NULL, "event", | 797 | OPT_CALLBACK('e', "event", NULL, "event", |
795 | "event selector. use 'perf list' to list available events", | 798 | "event selector. use 'perf list' to list available events", |
796 | parse_events), | 799 | parse_events), |
@@ -839,16 +842,16 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
839 | { | 842 | { |
840 | int i, j, err = -ENOMEM; | 843 | int i, j, err = -ENOMEM; |
841 | 844 | ||
842 | argc = parse_options(argc, argv, options, record_usage, | 845 | argc = parse_options(argc, argv, record_options, record_usage, |
843 | PARSE_OPT_STOP_AT_NON_OPTION); | 846 | PARSE_OPT_STOP_AT_NON_OPTION); |
844 | if (!argc && target_pid == -1 && target_tid == -1 && | 847 | if (!argc && target_pid == -1 && target_tid == -1 && |
845 | !system_wide && !cpu_list) | 848 | !system_wide && !cpu_list) |
846 | usage_with_options(record_usage, options); | 849 | usage_with_options(record_usage, record_options); |
847 | 850 | ||
848 | if (force && append_file) { | 851 | if (force && append_file) { |
849 | fprintf(stderr, "Can't overwrite and append at the same time." | 852 | fprintf(stderr, "Can't overwrite and append at the same time." |
850 | " You need to choose between -f and -A"); | 853 | " You need to choose between -f and -A"); |
851 | usage_with_options(record_usage, options); | 854 | usage_with_options(record_usage, record_options); |
852 | } else if (append_file) { | 855 | } else if (append_file) { |
853 | write_mode = WRITE_APPEND; | 856 | write_mode = WRITE_APPEND; |
854 | } else { | 857 | } else { |
@@ -871,7 +874,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
871 | if (thread_num <= 0) { | 874 | if (thread_num <= 0) { |
872 | fprintf(stderr, "Can't find all threads of pid %d\n", | 875 | fprintf(stderr, "Can't find all threads of pid %d\n", |
873 | target_pid); | 876 | target_pid); |
874 | usage_with_options(record_usage, options); | 877 | usage_with_options(record_usage, record_options); |
875 | } | 878 | } |
876 | } else { | 879 | } else { |
877 | all_tids=malloc(sizeof(pid_t)); | 880 | all_tids=malloc(sizeof(pid_t)); |