Skip to content

Commit 2745170

Browse files
author
Ingo Molnar
committed
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>
2 parents 407a2c7 + 83b2ea2 commit 2745170

File tree

17 files changed

+136
-72
lines changed

17 files changed

+136
-72
lines changed

tools/perf/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ build-test:
8383
#
8484
# All other targets get passed through:
8585
#
86-
%:
86+
%: FORCE
8787
$(print_msg)
8888
$(make)
8989

90-
.PHONY: tags TAGS
90+
.PHONY: tags TAGS FORCE Makefile

tools/perf/builtin-top.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -586,27 +586,9 @@ static void *display_thread_tui(void *arg)
586586
hists->uid_filter_str = top->record_opts.target.uid_str;
587587
}
588588

589-
while (true) {
590-
int key = perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
591-
top->min_percent,
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-
}
589+
perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
590+
top->min_percent,
591+
&top->session->header.env);
610592

611593
done = 1;
612594
return NULL;

tools/perf/builtin-trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,7 +2325,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
23252325
*/
23262326
if (trace->filter_pids.nr > 0)
23272327
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)
23292329
err = perf_evlist__set_filter_pid(evlist, getpid());
23302330

23312331
if (err < 0) {
@@ -2343,7 +2343,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
23432343
if (forks)
23442344
perf_evlist__start_workload(evlist);
23452345

2346-
trace->multiple_threads = evlist->threads->map[0] == -1 ||
2346+
trace->multiple_threads = thread_map__pid(evlist->threads, 0) == -1 ||
23472347
evlist->threads->nr > 1 ||
23482348
perf_evlist__first(evlist)->attr.inherit;
23492349
again:

tools/perf/tests/make

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
113
PERF := .
2-
MK := Makefile
314

415
include config/Makefile.arch
516

@@ -47,6 +58,7 @@ make_install_man := install-man
4758
make_install_html := install-html
4859
make_install_info := install-info
4960
make_install_pdf := install-pdf
61+
make_install_prefix := install prefix=/tmp/krava
5062
make_static := LDFLAGS=-static
5163

5264
# all the NO_* variable combined
@@ -57,7 +69,12 @@ make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1
5769

5870
# $(run) contains all available tests
5971
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)
6076
run += make_clean_all
77+
endif
6178
run += make_python_perf_so
6279
run += make_debug
6380
run += make_no_libperl
@@ -83,6 +100,7 @@ run += make_util_map_o
83100
run += make_util_pmu_bison_o
84101
run += make_install
85102
run += make_install_bin
103+
run += make_install_prefix
86104
# FIXME 'install-*' commented out till they're fixed
87105
# run += make_install_doc
88106
# run += make_install_man
@@ -157,6 +175,12 @@ test_make_install_O := $(call test_dest_files,$(installed_files_all))
157175
test_make_install_bin := $(call test_dest_files,$(installed_files_bin))
158176
test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin))
159177

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+
160184
# FIXME nothing gets installed
161185
test_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1
162186
test_make_install_man_O := $(test_make_install_man)
@@ -226,13 +250,13 @@ tarpkg:
226250
( eval $$cmd ) >> $@ 2>&1
227251

228252
make_kernelsrc:
229-
@echo " - make -C <kernelsrc> tools/perf"
253+
@echo "- make -C <kernelsrc> tools/perf"
230254
$(call clean); \
231255
(make -C ../.. tools/perf) > $@ 2>&1 && \
232256
test -x perf && rm -f $@ || (cat $@ ; false)
233257

234258
make_kernelsrc_tools:
235-
@echo " - make -C <kernelsrc>/tools perf"
259+
@echo "- make -C <kernelsrc>/tools perf"
236260
$(call clean); \
237261
(make -C ../../tools perf) > $@ 2>&1 && \
238262
test -x perf && rm -f $@ || (cat $@ ; false)
@@ -244,3 +268,4 @@ out: $(run_O)
244268
@echo OK
245269

246270
.PHONY: all $(run) $(run_O) tarpkg clean
271+
endif # ifndef MK

tools/perf/tests/openat-syscall-tp-fields.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int test__syscall_openat_tp_fields(void)
4545

4646
perf_evsel__config(evsel, &opts);
4747

48-
evlist->threads->map[0] = getpid();
48+
thread_map__set_pid(evlist->threads, 0, getpid());
4949

5050
err = perf_evlist__open(evlist);
5151
if (err < 0) {

tools/perf/ui/browsers/hists.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,8 +1902,23 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
19021902
case CTRL('c'):
19031903
goto out_free_stack;
19041904
case 'f':
1905-
if (!is_report_browser(hbt))
1906-
goto out_free_stack;
1905+
if (!is_report_browser(hbt)) {
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+
}
19071922
/* Fall thru */
19081923
default:
19091924
helpline = "Press '?' for help on key bindings";

tools/perf/util/auxtrace.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
119119
if (per_cpu) {
120120
mp->cpu = evlist->cpus->map[idx];
121121
if (evlist->threads)
122-
mp->tid = evlist->threads->map[0];
122+
mp->tid = thread_map__pid(evlist->threads, 0);
123123
else
124124
mp->tid = -1;
125125
} else {
126126
mp->cpu = -1;
127-
mp->tid = evlist->threads->map[idx];
127+
mp->tid = thread_map__pid(evlist->threads, idx);
128128
}
129129
}
130130

@@ -1182,6 +1182,13 @@ static int __auxtrace_mmap__read(struct auxtrace_mmap *mm,
11821182
data2 = NULL;
11831183
}
11841184

1185+
if (itr->alignment) {
1186+
unsigned int unwanted = len1 % itr->alignment;
1187+
1188+
len1 -= unwanted;
1189+
size -= unwanted;
1190+
}
1191+
11851192
/* padding must be written by fn() e.g. record__process_auxtrace() */
11861193
padding = size & 7;
11871194
if (padding)

tools/perf/util/auxtrace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ struct auxtrace_record {
303303
const char *str);
304304
u64 (*reference)(struct auxtrace_record *itr);
305305
int (*read_finish)(struct auxtrace_record *itr, int idx);
306+
unsigned int alignment;
306307
};
307308

308309
#ifdef HAVE_AUXTRACE_SUPPORT

tools/perf/util/event.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
504504
for (thread = 0; thread < threads->nr; ++thread) {
505505
if (__event__synthesize_thread(comm_event, mmap_event,
506506
fork_event,
507-
threads->map[thread], 0,
507+
thread_map__pid(threads, thread), 0,
508508
process, tool, machine,
509509
mmap_data, proc_map_timeout)) {
510510
err = -1;
@@ -515,12 +515,12 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
515515
* comm.pid is set to thread group id by
516516
* perf_event__synthesize_comm
517517
*/
518-
if ((int) comm_event->comm.pid != threads->map[thread]) {
518+
if ((int) comm_event->comm.pid != thread_map__pid(threads, thread)) {
519519
bool need_leader = true;
520520

521521
/* is thread group leader in thread_map? */
522522
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)) {
524524
need_leader = false;
525525
break;
526526
}

tools/perf/util/evlist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ static void perf_evlist__set_sid_idx(struct perf_evlist *evlist,
548548
else
549549
sid->cpu = -1;
550550
if (!evsel->system_wide && evlist->threads && thread >= 0)
551-
sid->tid = evlist->threads->map[thread];
551+
sid->tid = thread_map__pid(evlist->threads, thread);
552552
else
553553
sid->tid = -1;
554554
}
@@ -1475,7 +1475,7 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist, struct target *tar
14751475
__func__, __LINE__);
14761476
goto out_close_pipes;
14771477
}
1478-
evlist->threads->map[0] = evlist->workload.pid;
1478+
thread_map__set_pid(evlist->threads, 0, evlist->workload.pid);
14791479
}
14801480

14811481
close(child_ready_pipe[1]);

0 commit comments

Comments
 (0)