diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-10-29 06:23:32 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-29 06:23:32 -0400 |
commit | aac898548d04c7bff179b79f805874b0d6f87571 (patch) | |
tree | e8de975fd5de6c95bf4329861a872dbcfe0c7ead /tools | |
parent | 2f5e98802350627ad6f2e3cee4d177059fc0c2f2 (diff) | |
parent | cd65718712469ad844467250e8fad20a5838baae (diff) |
Merge branch 'perf/urgent' into perf/core
Conflicts:
tools/perf/builtin-record.c
tools/perf/builtin-top.c
tools/perf/util/hist.h
Diffstat (limited to 'tools')
25 files changed, 191 insertions, 101 deletions
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index f10ab63576d7..052f7c4dc00c 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -92,8 +92,20 @@ OPTIONS | |||
92 | size is rounded up to have nearest pages power of two value. | 92 | size is rounded up to have nearest pages power of two value. |
93 | 93 | ||
94 | -g:: | 94 | -g:: |
95 | Enables call-graph (stack chain/backtrace) recording. | ||
96 | |||
95 | --call-graph:: | 97 | --call-graph:: |
96 | Do call-graph (stack chain/backtrace) recording. | 98 | Setup and enable call-graph (stack chain/backtrace) recording, |
99 | implies -g. | ||
100 | |||
101 | Allows specifying "fp" (frame pointer) or "dwarf" | ||
102 | (DWARF's CFI - Call Frame Information) as the method to collect | ||
103 | the information used to show the call graphs. | ||
104 | |||
105 | In some systems, where binaries are build with gcc | ||
106 | --fomit-frame-pointer, using the "fp" method will produce bogus | ||
107 | call graphs, using "dwarf", if available (perf tools linked to | ||
108 | the libunwind library) should be used instead. | ||
97 | 109 | ||
98 | -q:: | 110 | -q:: |
99 | --quiet:: | 111 | --quiet:: |
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index c16a09e2f182..7de01dd79688 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt | |||
@@ -143,20 +143,12 @@ Default is to monitor all CPUS. | |||
143 | --asm-raw:: | 143 | --asm-raw:: |
144 | Show raw instruction encoding of assembly instructions. | 144 | Show raw instruction encoding of assembly instructions. |
145 | 145 | ||
146 | -G [type,min,order]:: | 146 | -G:: |
147 | Enables call-graph (stack chain/backtrace) recording. | ||
148 | |||
147 | --call-graph:: | 149 | --call-graph:: |
148 | Display call chains using type, min percent threshold and order. | 150 | Setup and enable call-graph (stack chain/backtrace) recording, |
149 | type can be either: | 151 | implies -G. |
150 | - flat: single column, linear exposure of call chains. | ||
151 | - graph: use a graph tree, displaying absolute overhead rates. | ||
152 | - fractal: like graph, but displays relative rates. Each branch of | ||
153 | the tree is considered as a new profiled object. | ||
154 | |||
155 | order can be either: | ||
156 | - callee: callee based call graph. | ||
157 | - caller: inverted caller based call graph. | ||
158 | |||
159 | Default: fractal,0.5,callee. | ||
160 | 152 | ||
161 | --max-stack:: | 153 | --max-stack:: |
162 | Set the stack depth limit when parsing the callchain, anything | 154 | Set the stack depth limit when parsing the callchain, anything |
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 188bb29b373f..cb05f39d8a77 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -889,11 +889,18 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx, | |||
889 | while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) { | 889 | while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) { |
890 | err = perf_evlist__parse_sample(kvm->evlist, event, &sample); | 890 | err = perf_evlist__parse_sample(kvm->evlist, event, &sample); |
891 | if (err) { | 891 | if (err) { |
892 | perf_evlist__mmap_consume(kvm->evlist, idx); | ||
892 | pr_err("Failed to parse sample\n"); | 893 | pr_err("Failed to parse sample\n"); |
893 | return -1; | 894 | return -1; |
894 | } | 895 | } |
895 | 896 | ||
896 | err = perf_session_queue_event(kvm->session, event, &sample, 0); | 897 | err = perf_session_queue_event(kvm->session, event, &sample, 0); |
898 | /* | ||
899 | * FIXME: Here we can't consume the event, as perf_session_queue_event will | ||
900 | * point to it, and it'll get possibly overwritten by the kernel. | ||
901 | */ | ||
902 | perf_evlist__mmap_consume(kvm->evlist, idx); | ||
903 | |||
897 | if (err) { | 904 | if (err) { |
898 | pr_err("Failed to enqueue sample: %d\n", err); | 905 | pr_err("Failed to enqueue sample: %d\n", err); |
899 | return -1; | 906 | return -1; |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index ab8d15e6e8cc..8b45fcead5f6 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -678,21 +678,12 @@ static int get_stack_size(char *str, unsigned long *_size) | |||
678 | } | 678 | } |
679 | #endif /* HAVE_LIBUNWIND_SUPPORT */ | 679 | #endif /* HAVE_LIBUNWIND_SUPPORT */ |
680 | 680 | ||
681 | int record_parse_callchain_opt(const struct option *opt, | 681 | int record_parse_callchain(const char *arg, struct perf_record_opts *opts) |
682 | const char *arg, int unset) | ||
683 | { | 682 | { |
684 | struct perf_record_opts *opts = opt->value; | ||
685 | char *tok, *name, *saveptr = NULL; | 683 | char *tok, *name, *saveptr = NULL; |
686 | char *buf; | 684 | char *buf; |
687 | int ret = -1; | 685 | int ret = -1; |
688 | 686 | ||
689 | /* --no-call-graph */ | ||
690 | if (unset) | ||
691 | return 0; | ||
692 | |||
693 | /* We specified default option if none is provided. */ | ||
694 | BUG_ON(!arg); | ||
695 | |||
696 | /* We need buffer that we know we can write to. */ | 687 | /* We need buffer that we know we can write to. */ |
697 | buf = malloc(strlen(arg) + 1); | 688 | buf = malloc(strlen(arg) + 1); |
698 | if (!buf) | 689 | if (!buf) |
@@ -730,13 +721,9 @@ int record_parse_callchain_opt(const struct option *opt, | |||
730 | ret = get_stack_size(tok, &size); | 721 | ret = get_stack_size(tok, &size); |
731 | opts->stack_dump_size = size; | 722 | opts->stack_dump_size = size; |
732 | } | 723 | } |
733 | |||
734 | if (!ret) | ||
735 | pr_debug("callchain: stack dump size %d\n", | ||
736 | opts->stack_dump_size); | ||
737 | #endif /* HAVE_LIBUNWIND_SUPPORT */ | 724 | #endif /* HAVE_LIBUNWIND_SUPPORT */ |
738 | } else { | 725 | } else { |
739 | pr_err("callchain: Unknown -g option " | 726 | pr_err("callchain: Unknown --call-graph option " |
740 | "value: %s\n", arg); | 727 | "value: %s\n", arg); |
741 | break; | 728 | break; |
742 | } | 729 | } |
@@ -744,13 +731,52 @@ int record_parse_callchain_opt(const struct option *opt, | |||
744 | } while (0); | 731 | } while (0); |
745 | 732 | ||
746 | free(buf); | 733 | free(buf); |
734 | return ret; | ||
735 | } | ||
736 | |||
737 | static void callchain_debug(struct perf_record_opts *opts) | ||
738 | { | ||
739 | pr_debug("callchain: type %d\n", opts->call_graph); | ||
747 | 740 | ||
741 | if (opts->call_graph == CALLCHAIN_DWARF) | ||
742 | pr_debug("callchain: stack dump size %d\n", | ||
743 | opts->stack_dump_size); | ||
744 | } | ||
745 | |||
746 | int record_parse_callchain_opt(const struct option *opt, | ||
747 | const char *arg, | ||
748 | int unset) | ||
749 | { | ||
750 | struct perf_record_opts *opts = opt->value; | ||
751 | int ret; | ||
752 | |||
753 | /* --no-call-graph */ | ||
754 | if (unset) { | ||
755 | opts->call_graph = CALLCHAIN_NONE; | ||
756 | pr_debug("callchain: disabled\n"); | ||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | ret = record_parse_callchain(arg, opts); | ||
748 | if (!ret) | 761 | if (!ret) |
749 | pr_debug("callchain: type %d\n", opts->call_graph); | 762 | callchain_debug(opts); |
750 | 763 | ||
751 | return ret; | 764 | return ret; |
752 | } | 765 | } |
753 | 766 | ||
767 | int record_callchain_opt(const struct option *opt, | ||
768 | const char *arg __maybe_unused, | ||
769 | int unset __maybe_unused) | ||
770 | { | ||
771 | struct perf_record_opts *opts = opt->value; | ||
772 | |||
773 | if (opts->call_graph == CALLCHAIN_NONE) | ||
774 | opts->call_graph = CALLCHAIN_FP; | ||
775 | |||
776 | callchain_debug(opts); | ||
777 | return 0; | ||
778 | } | ||
779 | |||
754 | static const char * const record_usage[] = { | 780 | static const char * const record_usage[] = { |
755 | "perf record [<options>] [<command>]", | 781 | "perf record [<options>] [<command>]", |
756 | "perf record [<options>] -- <command> [<options>]", | 782 | "perf record [<options>] -- <command> [<options>]", |
@@ -779,12 +805,12 @@ static struct perf_record record = { | |||
779 | }, | 805 | }, |
780 | }; | 806 | }; |
781 | 807 | ||
782 | #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " | 808 | #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: " |
783 | 809 | ||
784 | #ifdef HAVE_LIBUNWIND_SUPPORT | 810 | #ifdef HAVE_LIBUNWIND_SUPPORT |
785 | const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; | 811 | const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf"; |
786 | #else | 812 | #else |
787 | const char record_callchain_help[] = CALLCHAIN_HELP "[fp]"; | 813 | const char record_callchain_help[] = CALLCHAIN_HELP "fp"; |
788 | #endif | 814 | #endif |
789 | 815 | ||
790 | /* | 816 | /* |
@@ -825,9 +851,12 @@ const struct option record_options[] = { | |||
825 | perf_evlist__parse_mmap_pages), | 851 | perf_evlist__parse_mmap_pages), |
826 | OPT_BOOLEAN(0, "group", &record.opts.group, | 852 | OPT_BOOLEAN(0, "group", &record.opts.group, |
827 | "put the counters into a counter group"), | 853 | "put the counters into a counter group"), |
828 | OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts, | 854 | OPT_CALLBACK_NOOPT('g', NULL, &record.opts, |
829 | "mode[,dump_size]", record_callchain_help, | 855 | NULL, "enables call-graph recording" , |
830 | &record_parse_callchain_opt, "fp"), | 856 | &record_callchain_opt), |
857 | OPT_CALLBACK(0, "call-graph", &record.opts, | ||
858 | "mode[,dump_size]", record_callchain_help, | ||
859 | &record_parse_callchain_opt), | ||
831 | OPT_INCR('v', "verbose", &verbose, | 860 | OPT_INCR('v', "verbose", &verbose, |
832 | "be more verbose (show counter open errors, etc)"), | 861 | "be more verbose (show counter open errors, etc)"), |
833 | OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"), | 862 | OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"), |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 76c9264ed070..a6ea956a533e 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -810,7 +810,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
810 | ret = perf_evlist__parse_sample(top->evlist, event, &sample); | 810 | ret = perf_evlist__parse_sample(top->evlist, event, &sample); |
811 | if (ret) { | 811 | if (ret) { |
812 | pr_err("Can't parse sample, err = %d\n", ret); | 812 | pr_err("Can't parse sample, err = %d\n", ret); |
813 | continue; | 813 | goto next_event; |
814 | } | 814 | } |
815 | 815 | ||
816 | evsel = perf_evlist__id2evsel(session->evlist, sample.id); | 816 | evsel = perf_evlist__id2evsel(session->evlist, sample.id); |
@@ -825,13 +825,13 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
825 | case PERF_RECORD_MISC_USER: | 825 | case PERF_RECORD_MISC_USER: |
826 | ++top->us_samples; | 826 | ++top->us_samples; |
827 | if (top->hide_user_symbols) | 827 | if (top->hide_user_symbols) |
828 | continue; | 828 | goto next_event; |
829 | machine = &session->machines.host; | 829 | machine = &session->machines.host; |
830 | break; | 830 | break; |
831 | case PERF_RECORD_MISC_KERNEL: | 831 | case PERF_RECORD_MISC_KERNEL: |
832 | ++top->kernel_samples; | 832 | ++top->kernel_samples; |
833 | if (top->hide_kernel_symbols) | 833 | if (top->hide_kernel_symbols) |
834 | continue; | 834 | goto next_event; |
835 | machine = &session->machines.host; | 835 | machine = &session->machines.host; |
836 | break; | 836 | break; |
837 | case PERF_RECORD_MISC_GUEST_KERNEL: | 837 | case PERF_RECORD_MISC_GUEST_KERNEL: |
@@ -847,7 +847,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
847 | */ | 847 | */ |
848 | /* Fall thru */ | 848 | /* Fall thru */ |
849 | default: | 849 | default: |
850 | continue; | 850 | goto next_event; |
851 | } | 851 | } |
852 | 852 | ||
853 | 853 | ||
@@ -859,6 +859,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
859 | machine__process_event(machine, event); | 859 | machine__process_event(machine, event); |
860 | } else | 860 | } else |
861 | ++session->stats.nr_unknown_events; | 861 | ++session->stats.nr_unknown_events; |
862 | next_event: | ||
863 | perf_evlist__mmap_consume(top->evlist, idx); | ||
862 | } | 864 | } |
863 | } | 865 | } |
864 | 866 | ||
@@ -1013,16 +1015,16 @@ out_delete: | |||
1013 | } | 1015 | } |
1014 | 1016 | ||
1015 | static int | 1017 | static int |
1016 | parse_callchain_opt(const struct option *opt, const char *arg, int unset) | 1018 | callchain_opt(const struct option *opt, const char *arg, int unset) |
1017 | { | 1019 | { |
1018 | /* | ||
1019 | * --no-call-graph | ||
1020 | */ | ||
1021 | if (unset) | ||
1022 | return 0; | ||
1023 | |||
1024 | symbol_conf.use_callchain = true; | 1020 | symbol_conf.use_callchain = true; |
1021 | return record_callchain_opt(opt, arg, unset); | ||
1022 | } | ||
1025 | 1023 | ||
1024 | static int | ||
1025 | parse_callchain_opt(const struct option *opt, const char *arg, int unset) | ||
1026 | { | ||
1027 | symbol_conf.use_callchain = true; | ||
1026 | return record_parse_callchain_opt(opt, arg, unset); | 1028 | return record_parse_callchain_opt(opt, arg, unset); |
1027 | } | 1029 | } |
1028 | 1030 | ||
@@ -1108,9 +1110,12 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1108 | " abort, in_tx, transaction"), | 1110 | " abort, in_tx, transaction"), |
1109 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, | 1111 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, |
1110 | "Show a column with the number of samples"), | 1112 | "Show a column with the number of samples"), |
1111 | OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts, | 1113 | OPT_CALLBACK_NOOPT('G', NULL, &top.record_opts, |
1112 | "mode[,dump_size]", record_callchain_help, | 1114 | NULL, "enables call-graph recording", |
1113 | &parse_callchain_opt, "fp"), | 1115 | &callchain_opt), |
1116 | OPT_CALLBACK(0, "call-graph", &top.record_opts, | ||
1117 | "mode[,dump_size]", record_callchain_help, | ||
1118 | &parse_callchain_opt), | ||
1114 | OPT_INTEGER(0, "max-stack", &top.max_stack, | 1119 | OPT_INTEGER(0, "max-stack", &top.max_stack, |
1115 | "Set the maximum stack depth when parsing the callchain. " | 1120 | "Set the maximum stack depth when parsing the callchain. " |
1116 | "Default: " __stringify(PERF_MAX_STACK_DEPTH)), | 1121 | "Default: " __stringify(PERF_MAX_STACK_DEPTH)), |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index fa620bc1db69..dc3da654ff12 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1744,7 +1744,7 @@ again: | |||
1744 | err = perf_evlist__parse_sample(evlist, event, &sample); | 1744 | err = perf_evlist__parse_sample(evlist, event, &sample); |
1745 | if (err) { | 1745 | if (err) { |
1746 | fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); | 1746 | fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); |
1747 | continue; | 1747 | goto next_event; |
1748 | } | 1748 | } |
1749 | 1749 | ||
1750 | if (!trace->full_time && trace->base_time == 0) | 1750 | if (!trace->full_time && trace->base_time == 0) |
@@ -1758,18 +1758,20 @@ again: | |||
1758 | evsel = perf_evlist__id2evsel(evlist, sample.id); | 1758 | evsel = perf_evlist__id2evsel(evlist, sample.id); |
1759 | if (evsel == NULL) { | 1759 | if (evsel == NULL) { |
1760 | fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); | 1760 | fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); |
1761 | continue; | 1761 | goto next_event; |
1762 | } | 1762 | } |
1763 | 1763 | ||
1764 | if (sample.raw_data == NULL) { | 1764 | if (sample.raw_data == NULL) { |
1765 | fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", | 1765 | fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", |
1766 | perf_evsel__name(evsel), sample.tid, | 1766 | perf_evsel__name(evsel), sample.tid, |
1767 | sample.cpu, sample.raw_size); | 1767 | sample.cpu, sample.raw_size); |
1768 | continue; | 1768 | goto next_event; |
1769 | } | 1769 | } |
1770 | 1770 | ||
1771 | handler = evsel->handler.func; | 1771 | handler = evsel->handler.func; |
1772 | handler(trace, evsel, &sample); | 1772 | handler(trace, evsel, &sample); |
1773 | next_event: | ||
1774 | perf_evlist__mmap_consume(evlist, i); | ||
1773 | 1775 | ||
1774 | if (interrupted) | 1776 | if (interrupted) |
1775 | goto out_disable; | 1777 | goto out_disable; |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 6fb781d5586c..e3fedfa2906e 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -290,6 +290,7 @@ static int process_events(struct machine *machine, struct perf_evlist *evlist, | |||
290 | for (i = 0; i < evlist->nr_mmaps; i++) { | 290 | for (i = 0; i < evlist->nr_mmaps; i++) { |
291 | while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) { | 291 | while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) { |
292 | ret = process_event(machine, evlist, event, state); | 292 | ret = process_event(machine, evlist, event, state); |
293 | perf_evlist__mmap_consume(evlist, i); | ||
293 | if (ret < 0) | 294 | if (ret < 0) |
294 | return ret; | 295 | return ret; |
295 | } | 296 | } |
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index d444ea2c47d9..376c35608534 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c | |||
@@ -36,6 +36,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm) | |||
36 | (pid_t)event->comm.tid == getpid() && | 36 | (pid_t)event->comm.tid == getpid() && |
37 | strcmp(event->comm.comm, comm) == 0) | 37 | strcmp(event->comm.comm, comm) == 0) |
38 | found += 1; | 38 | found += 1; |
39 | perf_evlist__mmap_consume(evlist, i); | ||
39 | } | 40 | } |
40 | } | 41 | } |
41 | return found; | 42 | return found; |
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index c4185b9aeb80..a7232c204eb9 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
@@ -122,6 +122,7 @@ int test__basic_mmap(void) | |||
122 | goto out_munmap; | 122 | goto out_munmap; |
123 | } | 123 | } |
124 | nr_events[evsel->idx]++; | 124 | nr_events[evsel->idx]++; |
125 | perf_evlist__mmap_consume(evlist, 0); | ||
125 | } | 126 | } |
126 | 127 | ||
127 | err = 0; | 128 | err = 0; |
diff --git a/tools/perf/tests/open-syscall-tp-fields.c b/tools/perf/tests/open-syscall-tp-fields.c index fc5b9fca8b47..524b221b829b 100644 --- a/tools/perf/tests/open-syscall-tp-fields.c +++ b/tools/perf/tests/open-syscall-tp-fields.c | |||
@@ -77,8 +77,10 @@ int test__syscall_open_tp_fields(void) | |||
77 | 77 | ||
78 | ++nr_events; | 78 | ++nr_events; |
79 | 79 | ||
80 | if (type != PERF_RECORD_SAMPLE) | 80 | if (type != PERF_RECORD_SAMPLE) { |
81 | perf_evlist__mmap_consume(evlist, i); | ||
81 | continue; | 82 | continue; |
83 | } | ||
82 | 84 | ||
83 | err = perf_evsel__parse_sample(evsel, event, &sample); | 85 | err = perf_evsel__parse_sample(evsel, event, &sample); |
84 | if (err) { | 86 | if (err) { |
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index 82ac71550091..93a62b06c3af 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c | |||
@@ -253,6 +253,8 @@ int test__PERF_RECORD(void) | |||
253 | type); | 253 | type); |
254 | ++errs; | 254 | ++errs; |
255 | } | 255 | } |
256 | |||
257 | perf_evlist__mmap_consume(evlist, i); | ||
256 | } | 258 | } |
257 | } | 259 | } |
258 | 260 | ||
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c index 0ab61b1f408e..4ca1b938f6a6 100644 --- a/tools/perf/tests/perf-time-to-tsc.c +++ b/tools/perf/tests/perf-time-to-tsc.c | |||
@@ -122,7 +122,7 @@ int test__perf_time_to_tsc(void) | |||
122 | if (event->header.type != PERF_RECORD_COMM || | 122 | if (event->header.type != PERF_RECORD_COMM || |
123 | (pid_t)event->comm.pid != getpid() || | 123 | (pid_t)event->comm.pid != getpid() || |
124 | (pid_t)event->comm.tid != getpid()) | 124 | (pid_t)event->comm.tid != getpid()) |
125 | continue; | 125 | goto next_event; |
126 | 126 | ||
127 | if (strcmp(event->comm.comm, comm1) == 0) { | 127 | if (strcmp(event->comm.comm, comm1) == 0) { |
128 | CHECK__(perf_evsel__parse_sample(evsel, event, | 128 | CHECK__(perf_evsel__parse_sample(evsel, event, |
@@ -134,6 +134,8 @@ int test__perf_time_to_tsc(void) | |||
134 | &sample)); | 134 | &sample)); |
135 | comm2_time = sample.time; | 135 | comm2_time = sample.time; |
136 | } | 136 | } |
137 | next_event: | ||
138 | perf_evlist__mmap_consume(evlist, i); | ||
137 | } | 139 | } |
138 | } | 140 | } |
139 | 141 | ||
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index 2e41e2d32ccc..6e2b44ec0749 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c | |||
@@ -78,7 +78,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
78 | struct perf_sample sample; | 78 | struct perf_sample sample; |
79 | 79 | ||
80 | if (event->header.type != PERF_RECORD_SAMPLE) | 80 | if (event->header.type != PERF_RECORD_SAMPLE) |
81 | continue; | 81 | goto next_event; |
82 | 82 | ||
83 | err = perf_evlist__parse_sample(evlist, event, &sample); | 83 | err = perf_evlist__parse_sample(evlist, event, &sample); |
84 | if (err < 0) { | 84 | if (err < 0) { |
@@ -88,6 +88,8 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
88 | 88 | ||
89 | total_periods += sample.period; | 89 | total_periods += sample.period; |
90 | nr_samples++; | 90 | nr_samples++; |
91 | next_event: | ||
92 | perf_evlist__mmap_consume(evlist, 0); | ||
91 | } | 93 | } |
92 | 94 | ||
93 | if ((u64) nr_samples == total_periods) { | 95 | if ((u64) nr_samples == total_periods) { |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index b07f8a14e15d..c33d95f9559a 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -87,10 +87,10 @@ int test__task_exit(void) | |||
87 | 87 | ||
88 | retry: | 88 | retry: |
89 | while ((event = perf_evlist__mmap_read(evlist, 0)) != NULL) { | 89 | while ((event = perf_evlist__mmap_read(evlist, 0)) != NULL) { |
90 | if (event->header.type != PERF_RECORD_EXIT) | 90 | if (event->header.type == PERF_RECORD_EXIT) |
91 | continue; | 91 | nr_exit++; |
92 | 92 | ||
93 | nr_exit++; | 93 | perf_evlist__mmap_consume(evlist, 0); |
94 | } | 94 | } |
95 | 95 | ||
96 | if (!exited || !nr_exit) { | 96 | if (!exited || !nr_exit) { |
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 194e2f42ff5d..6c152686e837 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -315,8 +315,7 @@ static inline void advance_hpp(struct perf_hpp *hpp, int inc) | |||
315 | } | 315 | } |
316 | 316 | ||
317 | static int hist_entry__period_snprintf(struct perf_hpp *hpp, | 317 | static int hist_entry__period_snprintf(struct perf_hpp *hpp, |
318 | struct hist_entry *he, | 318 | struct hist_entry *he) |
319 | bool color) | ||
320 | { | 319 | { |
321 | const char *sep = symbol_conf.field_sep; | 320 | const char *sep = symbol_conf.field_sep; |
322 | struct perf_hpp_fmt *fmt; | 321 | struct perf_hpp_fmt *fmt; |
@@ -338,7 +337,7 @@ static int hist_entry__period_snprintf(struct perf_hpp *hpp, | |||
338 | } else | 337 | } else |
339 | first = false; | 338 | first = false; |
340 | 339 | ||
341 | if (color && fmt->color) | 340 | if (perf_hpp__use_color() && fmt->color) |
342 | ret = fmt->color(fmt, hpp, he); | 341 | ret = fmt->color(fmt, hpp, he); |
343 | else | 342 | else |
344 | ret = fmt->entry(fmt, hpp, he); | 343 | ret = fmt->entry(fmt, hpp, he); |
@@ -358,12 +357,11 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, | |||
358 | .buf = bf, | 357 | .buf = bf, |
359 | .size = size, | 358 | .size = size, |
360 | }; | 359 | }; |
361 | bool color = !symbol_conf.field_sep; | ||
362 | 360 | ||
363 | if (size == 0 || size > bfsz) | 361 | if (size == 0 || size > bfsz) |
364 | size = hpp.size = bfsz; | 362 | size = hpp.size = bfsz; |
365 | 363 | ||
366 | ret = hist_entry__period_snprintf(&hpp, he, color); | 364 | ret = hist_entry__period_snprintf(&hpp, he); |
367 | hist_entry__sort_snprintf(he, bf + ret, size - ret, hists); | 365 | hist_entry__sort_snprintf(he, bf + ret, size - ret, hists); |
368 | 366 | ||
369 | ret = fprintf(fp, "%s\n", bf); | 367 | ret = fprintf(fp, "%s\n", bf); |
@@ -482,6 +480,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | |||
482 | 480 | ||
483 | print_entries: | 481 | print_entries: |
484 | linesz = hists__sort_list_width(hists) + 3 + 1; | 482 | linesz = hists__sort_list_width(hists) + 3 + 1; |
483 | linesz += perf_hpp__color_overhead(); | ||
485 | line = malloc(linesz); | 484 | line = malloc(linesz); |
486 | if (line == NULL) { | 485 | if (line == NULL) { |
487 | ret = -1; | 486 | ret = -1; |
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 7bb36022377f..4f7f989876ec 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
@@ -146,6 +146,9 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor) | |||
146 | 146 | ||
147 | struct option; | 147 | struct option; |
148 | 148 | ||
149 | int record_parse_callchain(const char *arg, struct perf_record_opts *opts); | ||
149 | int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); | 150 | int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); |
151 | int record_callchain_opt(const struct option *opt, const char *arg, int unset); | ||
152 | |||
150 | extern const char record_callchain_help[]; | 153 | extern const char record_callchain_help[]; |
151 | #endif /* __PERF_CALLCHAIN_H */ | 154 | #endif /* __PERF_CALLCHAIN_H */ |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 9b393e7dca6f..49096ea58a15 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -187,7 +187,7 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
187 | return -1; | 187 | return -1; |
188 | } | 188 | } |
189 | 189 | ||
190 | event->header.type = PERF_RECORD_MMAP2; | 190 | event->header.type = PERF_RECORD_MMAP; |
191 | /* | 191 | /* |
192 | * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c | 192 | * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c |
193 | */ | 193 | */ |
@@ -198,7 +198,6 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
198 | char prot[5]; | 198 | char prot[5]; |
199 | char execname[PATH_MAX]; | 199 | char execname[PATH_MAX]; |
200 | char anonstr[] = "//anon"; | 200 | char anonstr[] = "//anon"; |
201 | unsigned int ino; | ||
202 | size_t size; | 201 | size_t size; |
203 | ssize_t n; | 202 | ssize_t n; |
204 | 203 | ||
@@ -209,15 +208,12 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
209 | strcpy(execname, ""); | 208 | strcpy(execname, ""); |
210 | 209 | ||
211 | /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ | 210 | /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ |
212 | n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %s\n", | 211 | n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %*x:%*x %*u %s\n", |
213 | &event->mmap2.start, &event->mmap2.len, prot, | 212 | &event->mmap.start, &event->mmap.len, prot, |
214 | &event->mmap2.pgoff, &event->mmap2.maj, | 213 | &event->mmap.pgoff, |
215 | &event->mmap2.min, | 214 | execname); |
216 | &ino, execname); | ||
217 | |||
218 | event->mmap2.ino = (u64)ino; | ||
219 | 215 | ||
220 | if (n != 8) | 216 | if (n != 5) |
221 | continue; | 217 | continue; |
222 | 218 | ||
223 | if (prot[2] != 'x') | 219 | if (prot[2] != 'x') |
@@ -227,15 +223,15 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
227 | strcpy(execname, anonstr); | 223 | strcpy(execname, anonstr); |
228 | 224 | ||
229 | size = strlen(execname) + 1; | 225 | size = strlen(execname) + 1; |
230 | memcpy(event->mmap2.filename, execname, size); | 226 | memcpy(event->mmap.filename, execname, size); |
231 | size = PERF_ALIGN(size, sizeof(u64)); | 227 | size = PERF_ALIGN(size, sizeof(u64)); |
232 | event->mmap2.len -= event->mmap.start; | 228 | event->mmap.len -= event->mmap.start; |
233 | event->mmap2.header.size = (sizeof(event->mmap2) - | 229 | event->mmap.header.size = (sizeof(event->mmap) - |
234 | (sizeof(event->mmap2.filename) - size)); | 230 | (sizeof(event->mmap.filename) - size)); |
235 | memset(event->mmap2.filename + size, 0, machine->id_hdr_size); | 231 | memset(event->mmap.filename + size, 0, machine->id_hdr_size); |
236 | event->mmap2.header.size += machine->id_hdr_size; | 232 | event->mmap.header.size += machine->id_hdr_size; |
237 | event->mmap2.pid = tgid; | 233 | event->mmap.pid = tgid; |
238 | event->mmap2.tid = pid; | 234 | event->mmap.tid = pid; |
239 | 235 | ||
240 | if (process(tool, event, &synth_sample, machine) != 0) { | 236 | if (process(tool, event, &synth_sample, machine) != 0) { |
241 | rc = -1; | 237 | rc = -1; |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 2ce92eceb424..0582f67fbefc 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -558,12 +558,19 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) | |||
558 | 558 | ||
559 | md->prev = old; | 559 | md->prev = old; |
560 | 560 | ||
561 | if (!evlist->overwrite) | ||
562 | perf_mmap__write_tail(md, old); | ||
563 | |||
564 | return event; | 561 | return event; |
565 | } | 562 | } |
566 | 563 | ||
564 | void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx) | ||
565 | { | ||
566 | if (!evlist->overwrite) { | ||
567 | struct perf_mmap *md = &evlist->mmap[idx]; | ||
568 | unsigned int old = md->prev; | ||
569 | |||
570 | perf_mmap__write_tail(md, old); | ||
571 | } | ||
572 | } | ||
573 | |||
567 | static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx) | 574 | static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx) |
568 | { | 575 | { |
569 | if (evlist->mmap[idx].base != NULL) { | 576 | if (evlist->mmap[idx].base != NULL) { |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 7f8f1aeb9cfe..6e8acc9abe38 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -90,6 +90,8 @@ struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id); | |||
90 | 90 | ||
91 | union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); | 91 | union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); |
92 | 92 | ||
93 | void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx); | ||
94 | |||
93 | int perf_evlist__open(struct perf_evlist *evlist); | 95 | int perf_evlist__open(struct perf_evlist *evlist); |
94 | void perf_evlist__close(struct perf_evlist *evlist); | 96 | void perf_evlist__close(struct perf_evlist *evlist); |
95 | 97 | ||
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index ec0cc1e21c62..3a334f001997 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -678,7 +678,6 @@ void perf_evsel__config(struct perf_evsel *evsel, | |||
678 | attr->sample_type |= PERF_SAMPLE_WEIGHT; | 678 | attr->sample_type |= PERF_SAMPLE_WEIGHT; |
679 | 679 | ||
680 | attr->mmap = track; | 680 | attr->mmap = track; |
681 | attr->mmap2 = track && !perf_missing_features.mmap2; | ||
682 | attr->comm = track; | 681 | attr->comm = track; |
683 | 682 | ||
684 | if (opts->sample_transaction) | 683 | if (opts->sample_transaction) |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 0c7ce8bb8eba..9d2d022cdb79 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <pthread.h> | 5 | #include <pthread.h> |
6 | #include "callchain.h" | 6 | #include "callchain.h" |
7 | #include "header.h" | 7 | #include "header.h" |
8 | #include "color.h" | ||
8 | #include "ui/progress.h" | 9 | #include "ui/progress.h" |
9 | 10 | ||
10 | extern struct callchain_param callchain_param; | 11 | extern struct callchain_param callchain_param; |
@@ -180,6 +181,18 @@ void perf_hpp__init(void); | |||
180 | void perf_hpp__column_register(struct perf_hpp_fmt *format); | 181 | void perf_hpp__column_register(struct perf_hpp_fmt *format); |
181 | void perf_hpp__column_enable(unsigned col); | 182 | void perf_hpp__column_enable(unsigned col); |
182 | 183 | ||
184 | static inline size_t perf_hpp__use_color(void) | ||
185 | { | ||
186 | return !symbol_conf.field_sep; | ||
187 | } | ||
188 | |||
189 | static inline size_t perf_hpp__color_overhead(void) | ||
190 | { | ||
191 | return perf_hpp__use_color() ? | ||
192 | (COLOR_MAXLEN + sizeof(PERF_COLOR_RESET)) * PERF_HPP__MAX_INDEX | ||
193 | : 0; | ||
194 | } | ||
195 | |||
183 | struct perf_evlist; | 196 | struct perf_evlist; |
184 | 197 | ||
185 | struct hist_browser_timer { | 198 | struct hist_browser_timer { |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index c04405296e5b..e41b0941e18f 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -1460,10 +1460,10 @@ int debuginfo__find_probe_point(struct debuginfo *self, unsigned long addr, | |||
1460 | goto post; | 1460 | goto post; |
1461 | } | 1461 | } |
1462 | 1462 | ||
1463 | fname = dwarf_decl_file(&spdie); | ||
1463 | if (addr == (unsigned long)baseaddr) { | 1464 | if (addr == (unsigned long)baseaddr) { |
1464 | /* Function entry - Relative line number is 0 */ | 1465 | /* Function entry - Relative line number is 0 */ |
1465 | lineno = baseline; | 1466 | lineno = baseline; |
1466 | fname = dwarf_decl_file(&spdie); | ||
1467 | goto post; | 1467 | goto post; |
1468 | } | 1468 | } |
1469 | 1469 | ||
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 06efd027b1db..4bf8ace7f511 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -815,6 +815,8 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, | |||
815 | PyObject *pyevent = pyrf_event__new(event); | 815 | PyObject *pyevent = pyrf_event__new(event); |
816 | struct pyrf_event *pevent = (struct pyrf_event *)pyevent; | 816 | struct pyrf_event *pevent = (struct pyrf_event *)pyevent; |
817 | 817 | ||
818 | perf_evlist__mmap_consume(evlist, cpu); | ||
819 | |||
818 | if (pyevent == NULL) | 820 | if (pyevent == NULL) |
819 | return PyErr_NoMemory(); | 821 | return PyErr_NoMemory(); |
820 | 822 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index cc75a3cef388..95d91a0b23af 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -56,6 +56,17 @@ static void handler_call_die(const char *handler_name) | |||
56 | Py_FatalError("problem in Python trace event handler"); | 56 | Py_FatalError("problem in Python trace event handler"); |
57 | } | 57 | } |
58 | 58 | ||
59 | /* | ||
60 | * Insert val into into the dictionary and decrement the reference counter. | ||
61 | * This is necessary for dictionaries since PyDict_SetItemString() does not | ||
62 | * steal a reference, as opposed to PyTuple_SetItem(). | ||
63 | */ | ||
64 | static void pydict_set_item_string_decref(PyObject *dict, const char *key, PyObject *val) | ||
65 | { | ||
66 | PyDict_SetItemString(dict, key, val); | ||
67 | Py_DECREF(val); | ||
68 | } | ||
69 | |||
59 | static void define_value(enum print_arg_type field_type, | 70 | static void define_value(enum print_arg_type field_type, |
60 | const char *ev_name, | 71 | const char *ev_name, |
61 | const char *field_name, | 72 | const char *field_name, |
@@ -279,11 +290,11 @@ static void python_process_tracepoint(union perf_event *perf_event | |||
279 | PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); | 290 | PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); |
280 | PyTuple_SetItem(t, n++, PyString_FromString(comm)); | 291 | PyTuple_SetItem(t, n++, PyString_FromString(comm)); |
281 | } else { | 292 | } else { |
282 | PyDict_SetItemString(dict, "common_cpu", PyInt_FromLong(cpu)); | 293 | pydict_set_item_string_decref(dict, "common_cpu", PyInt_FromLong(cpu)); |
283 | PyDict_SetItemString(dict, "common_s", PyInt_FromLong(s)); | 294 | pydict_set_item_string_decref(dict, "common_s", PyInt_FromLong(s)); |
284 | PyDict_SetItemString(dict, "common_ns", PyInt_FromLong(ns)); | 295 | pydict_set_item_string_decref(dict, "common_ns", PyInt_FromLong(ns)); |
285 | PyDict_SetItemString(dict, "common_pid", PyInt_FromLong(pid)); | 296 | pydict_set_item_string_decref(dict, "common_pid", PyInt_FromLong(pid)); |
286 | PyDict_SetItemString(dict, "common_comm", PyString_FromString(comm)); | 297 | pydict_set_item_string_decref(dict, "common_comm", PyString_FromString(comm)); |
287 | } | 298 | } |
288 | for (field = event->format.fields; field; field = field->next) { | 299 | for (field = event->format.fields; field; field = field->next) { |
289 | if (field->flags & FIELD_IS_STRING) { | 300 | if (field->flags & FIELD_IS_STRING) { |
@@ -313,7 +324,7 @@ static void python_process_tracepoint(union perf_event *perf_event | |||
313 | if (handler) | 324 | if (handler) |
314 | PyTuple_SetItem(t, n++, obj); | 325 | PyTuple_SetItem(t, n++, obj); |
315 | else | 326 | else |
316 | PyDict_SetItemString(dict, field->name, obj); | 327 | pydict_set_item_string_decref(dict, field->name, obj); |
317 | 328 | ||
318 | } | 329 | } |
319 | if (!handler) | 330 | if (!handler) |
@@ -370,21 +381,21 @@ static void python_process_general_event(union perf_event *perf_event | |||
370 | if (!handler || !PyCallable_Check(handler)) | 381 | if (!handler || !PyCallable_Check(handler)) |
371 | goto exit; | 382 | goto exit; |
372 | 383 | ||
373 | PyDict_SetItemString(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); | 384 | pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); |
374 | PyDict_SetItemString(dict, "attr", PyString_FromStringAndSize( | 385 | pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize( |
375 | (const char *)&evsel->attr, sizeof(evsel->attr))); | 386 | (const char *)&evsel->attr, sizeof(evsel->attr))); |
376 | PyDict_SetItemString(dict, "sample", PyString_FromStringAndSize( | 387 | pydict_set_item_string_decref(dict, "sample", PyString_FromStringAndSize( |
377 | (const char *)sample, sizeof(*sample))); | 388 | (const char *)sample, sizeof(*sample))); |
378 | PyDict_SetItemString(dict, "raw_buf", PyString_FromStringAndSize( | 389 | pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( |
379 | (const char *)sample->raw_data, sample->raw_size)); | 390 | (const char *)sample->raw_data, sample->raw_size)); |
380 | PyDict_SetItemString(dict, "comm", | 391 | pydict_set_item_string_decref(dict, "comm", |
381 | PyString_FromString(thread->comm)); | 392 | PyString_FromString(thread->comm)); |
382 | if (al->map) { | 393 | if (al->map) { |
383 | PyDict_SetItemString(dict, "dso", | 394 | pydict_set_item_string_decref(dict, "dso", |
384 | PyString_FromString(al->map->dso->name)); | 395 | PyString_FromString(al->map->dso->name)); |
385 | } | 396 | } |
386 | if (al->sym) { | 397 | if (al->sym) { |
387 | PyDict_SetItemString(dict, "symbol", | 398 | pydict_set_item_string_decref(dict, "symbol", |
388 | PyString_FromString(al->sym->name)); | 399 | PyString_FromString(al->sym->name)); |
389 | } | 400 | } |
390 | 401 | ||
diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index 4fa655d68a81..41bd85559d4b 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c | |||
@@ -151,7 +151,7 @@ static int check_timer_create(int which) | |||
151 | fflush(stdout); | 151 | fflush(stdout); |
152 | 152 | ||
153 | done = 0; | 153 | done = 0; |
154 | timer_create(which, NULL, &id); | 154 | err = timer_create(which, NULL, &id); |
155 | if (err < 0) { | 155 | if (err < 0) { |
156 | perror("Can't create timer\n"); | 156 | perror("Can't create timer\n"); |
157 | return -1; | 157 | return -1; |