diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-06-25 03:28:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-06-25 03:28:42 -0400 |
commit | 27451700dfa01a05cdb4d9d74501536165158034 (patch) | |
tree | 9f54f33f5488226ed29b7a462fdc1c529f4de8f0 /tools | |
parent | 407a2c720556e8e340e06f6a7174f5d6d80cf9ea (diff) | |
parent | 83b2ea257eb1d43e52f76d756722aeb899a2852c (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
- Move toggling event logic from 'perf top' and into hists browser, allowing
freeze/unfreeze with event lists with more than one entry (Namhyung Kim)
- Add missing newlines when dumping PERF_RECORD_FINISHED_ROUND and
showing the Aggregated stats in 'perf report -D' (Adrian Hunter)
Infrastructure changes:
- Allow auxtrace data alignment (Adrian Hunter)
- Allow events with dot (Andi Kleen)
- Fix failure to 'perf probe' events on arm (He Kuang)
- Add testing for Makefile.perf (Jiri Olsa)
- Add test for make install with prefix (Jiri Olsa)
- Fix single target build dependency check (Jiri Olsa)
- Access thread_map entries via accessors, prep patch to hold more info per
entry, for ongoing 'perf stat --per-thread' work (Jiri Olsa)
- Use __weak definition from compiler.h (Sukadev Bhattiprolu)
- Split perf_pmu__new_alias() (Sukadev Bhattiprolu)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Makefile | 4 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 24 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 4 | ||||
-rw-r--r-- | tools/perf/tests/make | 31 | ||||
-rw-r--r-- | tools/perf/tests/openat-syscall-tp-fields.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 19 | ||||
-rw-r--r-- | tools/perf/util/auxtrace.c | 11 | ||||
-rw-r--r-- | tools/perf/util/auxtrace.h | 1 | ||||
-rw-r--r-- | tools/perf/util/event.c | 6 | ||||
-rw-r--r-- | tools/perf/util/evlist.c | 4 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 2 | ||||
-rw-r--r-- | tools/perf/util/parse-events.l | 5 | ||||
-rw-r--r-- | tools/perf/util/pmu.c | 45 | ||||
-rw-r--r-- | tools/perf/util/probe-event.c | 6 | ||||
-rw-r--r-- | tools/perf/util/session.c | 4 | ||||
-rw-r--r-- | tools/perf/util/thread_map.c | 24 | ||||
-rw-r--r-- | tools/perf/util/thread_map.h | 16 |
17 files changed, 136 insertions, 72 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index d31a7bbd7cee..480546d5f13b 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -83,8 +83,8 @@ build-test: | |||
83 | # | 83 | # |
84 | # All other targets get passed through: | 84 | # All other targets get passed through: |
85 | # | 85 | # |
86 | %: | 86 | %: FORCE |
87 | $(print_msg) | 87 | $(print_msg) |
88 | $(make) | 88 | $(make) |
89 | 89 | ||
90 | .PHONY: tags TAGS | 90 | .PHONY: tags TAGS FORCE Makefile |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 619a8696fda7..ecf319728f25 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -586,27 +586,9 @@ static void *display_thread_tui(void *arg) | |||
586 | hists->uid_filter_str = top->record_opts.target.uid_str; | 586 | hists->uid_filter_str = top->record_opts.target.uid_str; |
587 | } | 587 | } |
588 | 588 | ||
589 | while (true) { | 589 | perf_evlist__tui_browse_hists(top->evlist, help, &hbt, |
590 | int key = perf_evlist__tui_browse_hists(top->evlist, help, &hbt, | 590 | top->min_percent, |
591 | top->min_percent, | 591 | &top->session->header.env); |
592 | &top->session->header.env); | ||
593 | |||
594 | if (key != 'f') | ||
595 | break; | ||
596 | |||
597 | perf_evlist__toggle_enable(top->evlist); | ||
598 | /* | ||
599 | * No need to refresh, resort/decay histogram entries | ||
600 | * if we are not collecting samples: | ||
601 | */ | ||
602 | if (top->evlist->enabled) { | ||
603 | hbt.refresh = top->delay_secs; | ||
604 | help = "Press 'f' to disable the events or 'h' to see other hotkeys"; | ||
605 | } else { | ||
606 | help = "Press 'f' again to re-enable the events"; | ||
607 | hbt.refresh = 0; | ||
608 | } | ||
609 | } | ||
610 | 592 | ||
611 | done = 1; | 593 | done = 1; |
612 | return NULL; | 594 | return NULL; |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index de5d277d1ad7..2bf2ca771ca5 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -2325,7 +2325,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) | |||
2325 | */ | 2325 | */ |
2326 | if (trace->filter_pids.nr > 0) | 2326 | if (trace->filter_pids.nr > 0) |
2327 | err = perf_evlist__set_filter_pids(evlist, trace->filter_pids.nr, trace->filter_pids.entries); | 2327 | err = perf_evlist__set_filter_pids(evlist, trace->filter_pids.nr, trace->filter_pids.entries); |
2328 | else if (evlist->threads->map[0] == -1) | 2328 | else if (thread_map__pid(evlist->threads, 0) == -1) |
2329 | err = perf_evlist__set_filter_pid(evlist, getpid()); | 2329 | err = perf_evlist__set_filter_pid(evlist, getpid()); |
2330 | 2330 | ||
2331 | if (err < 0) { | 2331 | if (err < 0) { |
@@ -2343,7 +2343,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) | |||
2343 | if (forks) | 2343 | if (forks) |
2344 | perf_evlist__start_workload(evlist); | 2344 | perf_evlist__start_workload(evlist); |
2345 | 2345 | ||
2346 | trace->multiple_threads = evlist->threads->map[0] == -1 || | 2346 | trace->multiple_threads = thread_map__pid(evlist->threads, 0) == -1 || |
2347 | evlist->threads->nr > 1 || | 2347 | evlist->threads->nr > 1 || |
2348 | perf_evlist__first(evlist)->attr.inherit; | 2348 | perf_evlist__first(evlist)->attr.inherit; |
2349 | again: | 2349 | again: |
diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 65280d28662e..729112f4cfaa 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make | |||
@@ -1,5 +1,16 @@ | |||
1 | ifndef MK | ||
2 | ifeq ($(MAKECMDGOALS),) | ||
3 | # no target specified, trigger the whole suite | ||
4 | all: | ||
5 | @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile | ||
6 | @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf | ||
7 | else | ||
8 | # run only specific test over 'Makefile' | ||
9 | %: | ||
10 | @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile $@ | ||
11 | endif | ||
12 | else | ||
1 | PERF := . | 13 | PERF := . |
2 | MK := Makefile | ||
3 | 14 | ||
4 | include config/Makefile.arch | 15 | include config/Makefile.arch |
5 | 16 | ||
@@ -47,6 +58,7 @@ make_install_man := install-man | |||
47 | make_install_html := install-html | 58 | make_install_html := install-html |
48 | make_install_info := install-info | 59 | make_install_info := install-info |
49 | make_install_pdf := install-pdf | 60 | make_install_pdf := install-pdf |
61 | make_install_prefix := install prefix=/tmp/krava | ||
50 | make_static := LDFLAGS=-static | 62 | make_static := LDFLAGS=-static |
51 | 63 | ||
52 | # all the NO_* variable combined | 64 | # all the NO_* variable combined |
@@ -57,7 +69,12 @@ make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 | |||
57 | 69 | ||
58 | # $(run) contains all available tests | 70 | # $(run) contains all available tests |
59 | run := make_pure | 71 | run := make_pure |
72 | # Targets 'clean all' can be run together only through top level | ||
73 | # Makefile because we detect clean target in Makefile.perf and | ||
74 | # disable features detection | ||
75 | ifeq ($(MK),Makefile) | ||
60 | run += make_clean_all | 76 | run += make_clean_all |
77 | endif | ||
61 | run += make_python_perf_so | 78 | run += make_python_perf_so |
62 | run += make_debug | 79 | run += make_debug |
63 | run += make_no_libperl | 80 | run += make_no_libperl |
@@ -83,6 +100,7 @@ run += make_util_map_o | |||
83 | run += make_util_pmu_bison_o | 100 | run += make_util_pmu_bison_o |
84 | run += make_install | 101 | run += make_install |
85 | run += make_install_bin | 102 | run += make_install_bin |
103 | run += make_install_prefix | ||
86 | # FIXME 'install-*' commented out till they're fixed | 104 | # FIXME 'install-*' commented out till they're fixed |
87 | # run += make_install_doc | 105 | # run += make_install_doc |
88 | # run += make_install_man | 106 | # run += make_install_man |
@@ -157,6 +175,12 @@ test_make_install_O := $(call test_dest_files,$(installed_files_all)) | |||
157 | test_make_install_bin := $(call test_dest_files,$(installed_files_bin)) | 175 | test_make_install_bin := $(call test_dest_files,$(installed_files_bin)) |
158 | test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin)) | 176 | test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin)) |
159 | 177 | ||
178 | # We prefix all installed files for make_install_prefix | ||
179 | # with '/tmp/krava' to match installed/prefix-ed files. | ||
180 | installed_files_all_prefix := $(addprefix /tmp/krava/,$(installed_files_all)) | ||
181 | test_make_install_prefix := $(call test_dest_files,$(installed_files_all_prefix)) | ||
182 | test_make_install_prefix_O := $(call test_dest_files,$(installed_files_all_prefix)) | ||
183 | |||
160 | # FIXME nothing gets installed | 184 | # FIXME nothing gets installed |
161 | test_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1 | 185 | test_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1 |
162 | test_make_install_man_O := $(test_make_install_man) | 186 | test_make_install_man_O := $(test_make_install_man) |
@@ -226,13 +250,13 @@ tarpkg: | |||
226 | ( eval $$cmd ) >> $@ 2>&1 | 250 | ( eval $$cmd ) >> $@ 2>&1 |
227 | 251 | ||
228 | make_kernelsrc: | 252 | make_kernelsrc: |
229 | @echo " - make -C <kernelsrc> tools/perf" | 253 | @echo "- make -C <kernelsrc> tools/perf" |
230 | $(call clean); \ | 254 | $(call clean); \ |
231 | (make -C ../.. tools/perf) > $@ 2>&1 && \ | 255 | (make -C ../.. tools/perf) > $@ 2>&1 && \ |
232 | test -x perf && rm -f $@ || (cat $@ ; false) | 256 | test -x perf && rm -f $@ || (cat $@ ; false) |
233 | 257 | ||
234 | make_kernelsrc_tools: | 258 | make_kernelsrc_tools: |
235 | @echo " - make -C <kernelsrc>/tools perf" | 259 | @echo "- make -C <kernelsrc>/tools perf" |
236 | $(call clean); \ | 260 | $(call clean); \ |
237 | (make -C ../../tools perf) > $@ 2>&1 && \ | 261 | (make -C ../../tools perf) > $@ 2>&1 && \ |
238 | test -x perf && rm -f $@ || (cat $@ ; false) | 262 | test -x perf && rm -f $@ || (cat $@ ; false) |
@@ -244,3 +268,4 @@ out: $(run_O) | |||
244 | @echo OK | 268 | @echo OK |
245 | 269 | ||
246 | .PHONY: all $(run) $(run_O) tarpkg clean | 270 | .PHONY: all $(run) $(run_O) tarpkg clean |
271 | endif # ifndef MK | ||
diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c index 6245221479d7..01a19626c846 100644 --- a/tools/perf/tests/openat-syscall-tp-fields.c +++ b/tools/perf/tests/openat-syscall-tp-fields.c | |||
@@ -45,7 +45,7 @@ int test__syscall_openat_tp_fields(void) | |||
45 | 45 | ||
46 | perf_evsel__config(evsel, &opts); | 46 | perf_evsel__config(evsel, &opts); |
47 | 47 | ||
48 | evlist->threads->map[0] = getpid(); | 48 | thread_map__set_pid(evlist->threads, 0, getpid()); |
49 | 49 | ||
50 | err = perf_evlist__open(evlist); | 50 | err = perf_evlist__open(evlist); |
51 | if (err < 0) { | 51 | if (err < 0) { |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index c42adb600091..7629bef2fd79 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1902,8 +1902,23 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
1902 | case CTRL('c'): | 1902 | case CTRL('c'): |
1903 | goto out_free_stack; | 1903 | goto out_free_stack; |
1904 | case 'f': | 1904 | case 'f': |
1905 | if (!is_report_browser(hbt)) | 1905 | if (!is_report_browser(hbt)) { |
1906 | goto out_free_stack; | 1906 | struct perf_top *top = hbt->arg; |
1907 | |||
1908 | perf_evlist__toggle_enable(top->evlist); | ||
1909 | /* | ||
1910 | * No need to refresh, resort/decay histogram | ||
1911 | * entries if we are not collecting samples: | ||
1912 | */ | ||
1913 | if (top->evlist->enabled) { | ||
1914 | helpline = "Press 'f' to disable the events or 'h' to see other hotkeys"; | ||
1915 | hbt->refresh = delay_secs; | ||
1916 | } else { | ||
1917 | helpline = "Press 'f' again to re-enable the events"; | ||
1918 | hbt->refresh = 0; | ||
1919 | } | ||
1920 | continue; | ||
1921 | } | ||
1907 | /* Fall thru */ | 1922 | /* Fall thru */ |
1908 | default: | 1923 | default: |
1909 | helpline = "Press '?' for help on key bindings"; | 1924 | helpline = "Press '?' for help on key bindings"; |
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index df66966cfde7..7e7405c9b936 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c | |||
@@ -119,12 +119,12 @@ void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, | |||
119 | if (per_cpu) { | 119 | if (per_cpu) { |
120 | mp->cpu = evlist->cpus->map[idx]; | 120 | mp->cpu = evlist->cpus->map[idx]; |
121 | if (evlist->threads) | 121 | if (evlist->threads) |
122 | mp->tid = evlist->threads->map[0]; | 122 | mp->tid = thread_map__pid(evlist->threads, 0); |
123 | else | 123 | else |
124 | mp->tid = -1; | 124 | mp->tid = -1; |
125 | } else { | 125 | } else { |
126 | mp->cpu = -1; | 126 | mp->cpu = -1; |
127 | mp->tid = evlist->threads->map[idx]; | 127 | mp->tid = thread_map__pid(evlist->threads, idx); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
@@ -1182,6 +1182,13 @@ static int __auxtrace_mmap__read(struct auxtrace_mmap *mm, | |||
1182 | data2 = NULL; | 1182 | data2 = NULL; |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | if (itr->alignment) { | ||
1186 | unsigned int unwanted = len1 % itr->alignment; | ||
1187 | |||
1188 | len1 -= unwanted; | ||
1189 | size -= unwanted; | ||
1190 | } | ||
1191 | |||
1185 | /* padding must be written by fn() e.g. record__process_auxtrace() */ | 1192 | /* padding must be written by fn() e.g. record__process_auxtrace() */ |
1186 | padding = size & 7; | 1193 | padding = size & 7; |
1187 | if (padding) | 1194 | if (padding) |
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index a171abbe7301..471aecbc4d68 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h | |||
@@ -303,6 +303,7 @@ struct auxtrace_record { | |||
303 | const char *str); | 303 | const char *str); |
304 | u64 (*reference)(struct auxtrace_record *itr); | 304 | u64 (*reference)(struct auxtrace_record *itr); |
305 | int (*read_finish)(struct auxtrace_record *itr, int idx); | 305 | int (*read_finish)(struct auxtrace_record *itr, int idx); |
306 | unsigned int alignment; | ||
306 | }; | 307 | }; |
307 | 308 | ||
308 | #ifdef HAVE_AUXTRACE_SUPPORT | 309 | #ifdef HAVE_AUXTRACE_SUPPORT |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index d7d986d8f23e..67a977e5d0ab 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -504,7 +504,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool, | |||
504 | for (thread = 0; thread < threads->nr; ++thread) { | 504 | for (thread = 0; thread < threads->nr; ++thread) { |
505 | if (__event__synthesize_thread(comm_event, mmap_event, | 505 | if (__event__synthesize_thread(comm_event, mmap_event, |
506 | fork_event, | 506 | fork_event, |
507 | threads->map[thread], 0, | 507 | thread_map__pid(threads, thread), 0, |
508 | process, tool, machine, | 508 | process, tool, machine, |
509 | mmap_data, proc_map_timeout)) { | 509 | mmap_data, proc_map_timeout)) { |
510 | err = -1; | 510 | err = -1; |
@@ -515,12 +515,12 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool, | |||
515 | * comm.pid is set to thread group id by | 515 | * comm.pid is set to thread group id by |
516 | * perf_event__synthesize_comm | 516 | * perf_event__synthesize_comm |
517 | */ | 517 | */ |
518 | if ((int) comm_event->comm.pid != threads->map[thread]) { | 518 | if ((int) comm_event->comm.pid != thread_map__pid(threads, thread)) { |
519 | bool need_leader = true; | 519 | bool need_leader = true; |
520 | 520 | ||
521 | /* is thread group leader in thread_map? */ | 521 | /* is thread group leader in thread_map? */ |
522 | for (j = 0; j < threads->nr; ++j) { | 522 | for (j = 0; j < threads->nr; ++j) { |
523 | if ((int) comm_event->comm.pid == threads->map[j]) { | 523 | if ((int) comm_event->comm.pid == thread_map__pid(threads, j)) { |
524 | need_leader = false; | 524 | need_leader = false; |
525 | break; | 525 | break; |
526 | } | 526 | } |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 8366511b45f8..d29df901be3e 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -548,7 +548,7 @@ static void perf_evlist__set_sid_idx(struct perf_evlist *evlist, | |||
548 | else | 548 | else |
549 | sid->cpu = -1; | 549 | sid->cpu = -1; |
550 | if (!evsel->system_wide && evlist->threads && thread >= 0) | 550 | if (!evsel->system_wide && evlist->threads && thread >= 0) |
551 | sid->tid = evlist->threads->map[thread]; | 551 | sid->tid = thread_map__pid(evlist->threads, thread); |
552 | else | 552 | else |
553 | sid->tid = -1; | 553 | sid->tid = -1; |
554 | } | 554 | } |
@@ -1475,7 +1475,7 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist, struct target *tar | |||
1475 | __func__, __LINE__); | 1475 | __func__, __LINE__); |
1476 | goto out_close_pipes; | 1476 | goto out_close_pipes; |
1477 | } | 1477 | } |
1478 | evlist->threads->map[0] = evlist->workload.pid; | 1478 | thread_map__set_pid(evlist->threads, 0, evlist->workload.pid); |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | close(child_ready_pipe[1]); | 1481 | close(child_ready_pipe[1]); |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 33449decf7bd..1b56047af96b 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -1167,7 +1167,7 @@ retry_sample_id: | |||
1167 | int group_fd; | 1167 | int group_fd; |
1168 | 1168 | ||
1169 | if (!evsel->cgrp && !evsel->system_wide) | 1169 | if (!evsel->cgrp && !evsel->system_wide) |
1170 | pid = threads->map[thread]; | 1170 | pid = thread_map__pid(threads, thread); |
1171 | 1171 | ||
1172 | group_fd = get_group_fd(evsel, cpu, thread); | 1172 | group_fd = get_group_fd(evsel, cpu, thread); |
1173 | retry_open: | 1173 | retry_open: |
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 09e738fe9ea2..13cef3c65565 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l | |||
@@ -119,8 +119,8 @@ event [^,{}/]+ | |||
119 | num_dec [0-9]+ | 119 | num_dec [0-9]+ |
120 | num_hex 0x[a-fA-F0-9]+ | 120 | num_hex 0x[a-fA-F0-9]+ |
121 | num_raw_hex [a-fA-F0-9]+ | 121 | num_raw_hex [a-fA-F0-9]+ |
122 | name [a-zA-Z_*?][a-zA-Z0-9_*?]* | 122 | name [a-zA-Z_*?][a-zA-Z0-9_*?.]* |
123 | name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?]* | 123 | name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.]* |
124 | /* If you add a modifier you need to update check_modifier() */ | 124 | /* If you add a modifier you need to update check_modifier() */ |
125 | modifier_event [ukhpGHSDI]+ | 125 | modifier_event [ukhpGHSDI]+ |
126 | modifier_bp [rwx]{1,3} | 126 | modifier_bp [rwx]{1,3} |
@@ -165,7 +165,6 @@ modifier_bp [rwx]{1,3} | |||
165 | return PE_EVENT_NAME; | 165 | return PE_EVENT_NAME; |
166 | } | 166 | } |
167 | 167 | ||
168 | . | | ||
169 | <<EOF>> { | 168 | <<EOF>> { |
170 | BEGIN(INITIAL); | 169 | BEGIN(INITIAL); |
171 | REWIND(0); | 170 | REWIND(0); |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 0fcc624eb767..7bcb8c315615 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <linux/list.h> | 1 | #include <linux/list.h> |
2 | #include <linux/compiler.h> | ||
2 | #include <sys/types.h> | 3 | #include <sys/types.h> |
3 | #include <unistd.h> | 4 | #include <unistd.h> |
4 | #include <stdio.h> | 5 | #include <stdio.h> |
@@ -205,17 +206,12 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, | |||
205 | return 0; | 206 | return 0; |
206 | } | 207 | } |
207 | 208 | ||
208 | static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FILE *file) | 209 | static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, |
210 | char *desc __maybe_unused, char *val) | ||
209 | { | 211 | { |
210 | struct perf_pmu_alias *alias; | 212 | struct perf_pmu_alias *alias; |
211 | char buf[256]; | ||
212 | int ret; | 213 | int ret; |
213 | 214 | ||
214 | ret = fread(buf, 1, sizeof(buf), file); | ||
215 | if (ret == 0) | ||
216 | return -EINVAL; | ||
217 | buf[ret] = 0; | ||
218 | |||
219 | alias = malloc(sizeof(*alias)); | 215 | alias = malloc(sizeof(*alias)); |
220 | if (!alias) | 216 | if (!alias) |
221 | return -ENOMEM; | 217 | return -ENOMEM; |
@@ -225,26 +221,43 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI | |||
225 | alias->unit[0] = '\0'; | 221 | alias->unit[0] = '\0'; |
226 | alias->per_pkg = false; | 222 | alias->per_pkg = false; |
227 | 223 | ||
228 | ret = parse_events_terms(&alias->terms, buf); | 224 | ret = parse_events_terms(&alias->terms, val); |
229 | if (ret) { | 225 | if (ret) { |
226 | pr_err("Cannot parse alias %s: %d\n", val, ret); | ||
230 | free(alias); | 227 | free(alias); |
231 | return ret; | 228 | return ret; |
232 | } | 229 | } |
233 | 230 | ||
234 | alias->name = strdup(name); | 231 | alias->name = strdup(name); |
235 | /* | 232 | if (dir) { |
236 | * load unit name and scale if available | 233 | /* |
237 | */ | 234 | * load unit name and scale if available |
238 | perf_pmu__parse_unit(alias, dir, name); | 235 | */ |
239 | perf_pmu__parse_scale(alias, dir, name); | 236 | perf_pmu__parse_unit(alias, dir, name); |
240 | perf_pmu__parse_per_pkg(alias, dir, name); | 237 | perf_pmu__parse_scale(alias, dir, name); |
241 | perf_pmu__parse_snapshot(alias, dir, name); | 238 | perf_pmu__parse_per_pkg(alias, dir, name); |
239 | perf_pmu__parse_snapshot(alias, dir, name); | ||
240 | } | ||
242 | 241 | ||
243 | list_add_tail(&alias->list, list); | 242 | list_add_tail(&alias->list, list); |
244 | 243 | ||
245 | return 0; | 244 | return 0; |
246 | } | 245 | } |
247 | 246 | ||
247 | static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FILE *file) | ||
248 | { | ||
249 | char buf[256]; | ||
250 | int ret; | ||
251 | |||
252 | ret = fread(buf, 1, sizeof(buf), file); | ||
253 | if (ret == 0) | ||
254 | return -EINVAL; | ||
255 | |||
256 | buf[ret] = 0; | ||
257 | |||
258 | return __perf_pmu__new_alias(list, dir, name, NULL, buf); | ||
259 | } | ||
260 | |||
248 | static inline bool pmu_alias_info_file(char *name) | 261 | static inline bool pmu_alias_info_file(char *name) |
249 | { | 262 | { |
250 | size_t len; | 263 | size_t len; |
@@ -436,7 +449,7 @@ static struct cpu_map *pmu_cpumask(const char *name) | |||
436 | return cpus; | 449 | return cpus; |
437 | } | 450 | } |
438 | 451 | ||
439 | struct perf_event_attr *__attribute__((weak)) | 452 | struct perf_event_attr * __weak |
440 | perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) | 453 | perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) |
441 | { | 454 | { |
442 | return NULL; | 455 | return NULL; |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 076527b639bd..381f23a443c7 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -249,8 +249,12 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs) | |||
249 | static bool kprobe_blacklist__listed(unsigned long address); | 249 | static bool kprobe_blacklist__listed(unsigned long address); |
250 | static bool kprobe_warn_out_range(const char *symbol, unsigned long address) | 250 | static bool kprobe_warn_out_range(const char *symbol, unsigned long address) |
251 | { | 251 | { |
252 | u64 etext_addr; | ||
253 | |||
252 | /* Get the address of _etext for checking non-probable text symbol */ | 254 | /* Get the address of _etext for checking non-probable text symbol */ |
253 | if (kernel_get_symbol_address_by_name("_etext", false) < address) | 255 | etext_addr = kernel_get_symbol_address_by_name("_etext", false); |
256 | |||
257 | if (etext_addr != 0 && etext_addr < address) | ||
254 | pr_warning("%s is out of .text, skip it.\n", symbol); | 258 | pr_warning("%s is out of .text, skip it.\n", symbol); |
255 | else if (kprobe_blacklist__listed(address)) | 259 | else if (kprobe_blacklist__listed(address)) |
256 | pr_warning("%s is blacklisted function, skip it.\n", symbol); | 260 | pr_warning("%s is blacklisted function, skip it.\n", symbol); |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index aa482c10469d..b5549b58bb2b 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -686,6 +686,8 @@ static int process_finished_round(struct perf_tool *tool __maybe_unused, | |||
686 | union perf_event *event __maybe_unused, | 686 | union perf_event *event __maybe_unused, |
687 | struct ordered_events *oe) | 687 | struct ordered_events *oe) |
688 | { | 688 | { |
689 | if (dump_trace) | ||
690 | fprintf(stdout, "\n"); | ||
689 | return ordered_events__flush(oe, OE_FLUSH__ROUND); | 691 | return ordered_events__flush(oe, OE_FLUSH__ROUND); |
690 | } | 692 | } |
691 | 693 | ||
@@ -1726,7 +1728,7 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp) | |||
1726 | if (perf_header__has_feat(&session->header, HEADER_AUXTRACE)) | 1728 | if (perf_header__has_feat(&session->header, HEADER_AUXTRACE)) |
1727 | msg = " (excludes AUX area (e.g. instruction trace) decoded / synthesized events)"; | 1729 | msg = " (excludes AUX area (e.g. instruction trace) decoded / synthesized events)"; |
1728 | 1730 | ||
1729 | ret = fprintf(fp, "Aggregated stats:%s\n", msg); | 1731 | ret = fprintf(fp, "\nAggregated stats:%s\n", msg); |
1730 | 1732 | ||
1731 | ret += events_stats__fprintf(&session->evlist->stats, fp); | 1733 | ret += events_stats__fprintf(&session->evlist->stats, fp); |
1732 | return ret; | 1734 | return ret; |
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index f4822bd03709..8c3c3a0751bd 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c | |||
@@ -45,7 +45,7 @@ struct thread_map *thread_map__new_by_pid(pid_t pid) | |||
45 | threads = thread_map__alloc(items); | 45 | threads = thread_map__alloc(items); |
46 | if (threads != NULL) { | 46 | if (threads != NULL) { |
47 | for (i = 0; i < items; i++) | 47 | for (i = 0; i < items; i++) |
48 | threads->map[i] = atoi(namelist[i]->d_name); | 48 | thread_map__set_pid(threads, i, atoi(namelist[i]->d_name)); |
49 | threads->nr = items; | 49 | threads->nr = items; |
50 | } | 50 | } |
51 | 51 | ||
@@ -61,8 +61,8 @@ struct thread_map *thread_map__new_by_tid(pid_t tid) | |||
61 | struct thread_map *threads = thread_map__alloc(1); | 61 | struct thread_map *threads = thread_map__alloc(1); |
62 | 62 | ||
63 | if (threads != NULL) { | 63 | if (threads != NULL) { |
64 | threads->map[0] = tid; | 64 | thread_map__set_pid(threads, 0, tid); |
65 | threads->nr = 1; | 65 | threads->nr = 1; |
66 | } | 66 | } |
67 | 67 | ||
68 | return threads; | 68 | return threads; |
@@ -123,8 +123,10 @@ struct thread_map *thread_map__new_by_uid(uid_t uid) | |||
123 | threads = tmp; | 123 | threads = tmp; |
124 | } | 124 | } |
125 | 125 | ||
126 | for (i = 0; i < items; i++) | 126 | for (i = 0; i < items; i++) { |
127 | threads->map[threads->nr + i] = atoi(namelist[i]->d_name); | 127 | thread_map__set_pid(threads, threads->nr + i, |
128 | atoi(namelist[i]->d_name)); | ||
129 | } | ||
128 | 130 | ||
129 | for (i = 0; i < items; i++) | 131 | for (i = 0; i < items; i++) |
130 | zfree(&namelist[i]); | 132 | zfree(&namelist[i]); |
@@ -201,7 +203,7 @@ static struct thread_map *thread_map__new_by_pid_str(const char *pid_str) | |||
201 | threads = nt; | 203 | threads = nt; |
202 | 204 | ||
203 | for (i = 0; i < items; i++) { | 205 | for (i = 0; i < items; i++) { |
204 | threads->map[j++] = atoi(namelist[i]->d_name); | 206 | thread_map__set_pid(threads, j++, atoi(namelist[i]->d_name)); |
205 | zfree(&namelist[i]); | 207 | zfree(&namelist[i]); |
206 | } | 208 | } |
207 | threads->nr = total_tasks; | 209 | threads->nr = total_tasks; |
@@ -227,8 +229,8 @@ struct thread_map *thread_map__new_dummy(void) | |||
227 | struct thread_map *threads = thread_map__alloc(1); | 229 | struct thread_map *threads = thread_map__alloc(1); |
228 | 230 | ||
229 | if (threads != NULL) { | 231 | if (threads != NULL) { |
230 | threads->map[0] = -1; | 232 | thread_map__set_pid(threads, 0, -1); |
231 | threads->nr = 1; | 233 | threads->nr = 1; |
232 | } | 234 | } |
233 | return threads; | 235 | return threads; |
234 | } | 236 | } |
@@ -267,8 +269,8 @@ static struct thread_map *thread_map__new_by_tid_str(const char *tid_str) | |||
267 | goto out_free_threads; | 269 | goto out_free_threads; |
268 | 270 | ||
269 | threads = nt; | 271 | threads = nt; |
270 | threads->map[ntasks - 1] = tid; | 272 | thread_map__set_pid(threads, ntasks - 1, tid); |
271 | threads->nr = ntasks; | 273 | threads->nr = ntasks; |
272 | } | 274 | } |
273 | out: | 275 | out: |
274 | return threads; | 276 | return threads; |
@@ -301,7 +303,7 @@ size_t thread_map__fprintf(struct thread_map *threads, FILE *fp) | |||
301 | size_t printed = fprintf(fp, "%d thread%s: ", | 303 | size_t printed = fprintf(fp, "%d thread%s: ", |
302 | threads->nr, threads->nr > 1 ? "s" : ""); | 304 | threads->nr, threads->nr > 1 ? "s" : ""); |
303 | for (i = 0; i < threads->nr; ++i) | 305 | for (i = 0; i < threads->nr; ++i) |
304 | printed += fprintf(fp, "%s%d", i ? ", " : "", threads->map[i]); | 306 | printed += fprintf(fp, "%s%d", i ? ", " : "", thread_map__pid(threads, i)); |
305 | 307 | ||
306 | return printed + fprintf(fp, "\n"); | 308 | return printed + fprintf(fp, "\n"); |
307 | } | 309 | } |
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h index 95313f43cc0f..b9f40679f589 100644 --- a/tools/perf/util/thread_map.h +++ b/tools/perf/util/thread_map.h | |||
@@ -4,9 +4,13 @@ | |||
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | 6 | ||
7 | struct thread_map_data { | ||
8 | pid_t pid; | ||
9 | }; | ||
10 | |||
7 | struct thread_map { | 11 | struct thread_map { |
8 | int nr; | 12 | int nr; |
9 | pid_t map[]; | 13 | struct thread_map_data map[]; |
10 | }; | 14 | }; |
11 | 15 | ||
12 | struct thread_map *thread_map__new_dummy(void); | 16 | struct thread_map *thread_map__new_dummy(void); |
@@ -27,4 +31,14 @@ static inline int thread_map__nr(struct thread_map *threads) | |||
27 | return threads ? threads->nr : 1; | 31 | return threads ? threads->nr : 1; |
28 | } | 32 | } |
29 | 33 | ||
34 | static inline pid_t thread_map__pid(struct thread_map *map, int thread) | ||
35 | { | ||
36 | return map->map[thread].pid; | ||
37 | } | ||
38 | |||
39 | static inline void | ||
40 | thread_map__set_pid(struct thread_map *map, int thread, pid_t pid) | ||
41 | { | ||
42 | map->map[thread].pid = pid; | ||
43 | } | ||
30 | #endif /* __PERF_THREAD_MAP_H */ | 44 | #endif /* __PERF_THREAD_MAP_H */ |