mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
Add build-system mechanisms for running benchmarks under 'perf'.
This commit is contained in:
parent
c84b8e90b8
commit
d5b2d62b20
@ -271,11 +271,17 @@ endif
|
||||
|
||||
ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
|
||||
$(findstring test,$(MAKECMDGOALS)) \
|
||||
$(findstring perf,$(MAKECMDGOALS)) \
|
||||
$(findstring tidy,$(MAKECMDGOALS))),)
|
||||
CFG_INFO := $(info cfg: including test rules)
|
||||
include $(CFG_SRC_DIR)/mk/tests.mk
|
||||
endif
|
||||
|
||||
ifneq ($(findstring perf,$(MAKECMDGOALS)),)
|
||||
CFG_INFO := $(info cfg: including perf rules)
|
||||
include $(CFG_SRC_DIR)/mk/perf.mk
|
||||
endif
|
||||
|
||||
ifneq ($(findstring clean,$(MAKECMDGOALS)),)
|
||||
CFG_INFO := $(info cfg: including clean rules)
|
||||
include $(CFG_SRC_DIR)/mk/clean.mk
|
||||
|
4
configure
vendored
4
configure
vendored
@ -183,7 +183,8 @@ for i in \
|
||||
rustllvm \
|
||||
dl stage0 stage1 stage2 stage3 \
|
||||
stage0/lib stage1/lib stage2/lib stage3/lib \
|
||||
test/run-pass test/run-fail test/compile-fail test/bench test/pretty
|
||||
test/run-pass test/run-fail test/compile-fail \
|
||||
test/bench test/perf test/pretty
|
||||
do
|
||||
make_dir $i
|
||||
done
|
||||
@ -205,6 +206,7 @@ probe CFG_CLANG clang++
|
||||
probe CFG_GCC gcc
|
||||
probe CFG_LLVM_CONFIG llvm-config
|
||||
probe CFG_VALGRIND valgrind
|
||||
probe CFG_PERF perf
|
||||
probe CFG_MAKEINFO makeinfo
|
||||
probe CFG_TEXI2PDF texi2pdf
|
||||
probe CFG_TEX tex
|
||||
|
1
mk/perf.mk
Normal file
1
mk/perf.mk
Normal file
@ -0,0 +1 @@
|
||||
perf: check-stage2-perf
|
@ -34,6 +34,35 @@ ifeq ($(CFG_OSTYPE), Linux)
|
||||
CFG_UNIXY := 1
|
||||
CFG_LDENV := LD_LIBRARY_PATH
|
||||
CFG_DEF_SUFFIX := .linux.def
|
||||
ifdef CFG_PERF
|
||||
CFG_PERF_TOOL :=\
|
||||
$(CFG_PERF) \
|
||||
stat \
|
||||
-e cycles \
|
||||
-e instructions \
|
||||
-e cache-references \
|
||||
-e cache-misses \
|
||||
-e branches \
|
||||
-e branch-misses \
|
||||
-e bus-cycles \
|
||||
-e task-clock \
|
||||
-e page-faults \
|
||||
-e context-switches \
|
||||
-e cpu-migrations \
|
||||
-e kmem:mm_page_alloc \
|
||||
-e syscalls:sys_enter \
|
||||
-e sched:sched_switch \
|
||||
-e fs:do_sys_open \
|
||||
-i \
|
||||
-r 10
|
||||
else
|
||||
ifdef CFG_VALGRIND
|
||||
CFG_PERF_TOOL :=\
|
||||
$(CFG_VALGRIND) --tool=cachegrind --cache-sim=yes --branch-sim=yes
|
||||
else
|
||||
CFG_PERF_TOOL := /usr/bin/time --verbose
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CFG_OSTYPE), Darwin)
|
||||
|
26
mk/tests.mk
26
mk/tests.mk
@ -15,10 +15,15 @@ CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
|
||||
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
|
||||
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
|
||||
|
||||
# perf tests are the same as bench tests only they run under
|
||||
# a performance monitor.
|
||||
PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
|
||||
|
||||
RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
|
||||
RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
|
||||
CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
|
||||
BENCH_TESTS := $(BENCH_RS)
|
||||
PERF_TESTS := $(PERF_RS)
|
||||
PRETTY_TESTS := $(PRETTY_RS)
|
||||
|
||||
FT := run_pass_stage2
|
||||
@ -40,6 +45,11 @@ ifdef CFG_VALGRIND
|
||||
CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
|
||||
endif
|
||||
|
||||
# Arguments to the perf tests
|
||||
ifdef CFG_PERF_TOOL
|
||||
CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
|
||||
endif
|
||||
|
||||
CTEST_TESTARGS := $(TESTARGS)
|
||||
|
||||
ifdef VERBOSE
|
||||
@ -150,7 +160,7 @@ test/rustctest.stage$(2).out.tmp: test/rustctest.stage$(2)$$(X)
|
||||
$$(Q)touch $$@
|
||||
|
||||
|
||||
# Rules for the cfail/rfail/rpass/bench test runner
|
||||
# Rules for the cfail/rfail/rpass/bench/perf test runner
|
||||
|
||||
check-stage$(2)-cfail: test/compile-fail.stage$(2).out \
|
||||
|
||||
@ -160,6 +170,8 @@ check-stage$(2)-rpass: test/run-pass.stage$(2).out \
|
||||
|
||||
check-stage$(2)-bench: test/bench.stage$(2).out \
|
||||
|
||||
check-stage$(2)-perf: test/perf.stage$(2).out \
|
||||
|
||||
check-stage$(2)-pretty-rpass: test/pretty-rpass.stage$(2).out \
|
||||
|
||||
check-stage$(2)-pretty-rfail: test/pretty-rfail.stage$(2).out \
|
||||
@ -203,6 +215,12 @@ BENCH_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
|
||||
--mode run-pass \
|
||||
$$(CTEST_RUNTOOL) \
|
||||
|
||||
PERF_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
|
||||
--src-base $(S)src/test/bench/ \
|
||||
--build-base test/perf/ \
|
||||
--mode run-pass \
|
||||
$$(CTEST_PERF_RUNTOOL) \
|
||||
|
||||
PRETTY_RPASS_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
|
||||
--src-base $$(S)src/test/run-pass/ \
|
||||
--build-base test/run-pass/ \
|
||||
@ -253,6 +271,12 @@ test/bench.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
|
||||
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(BENCH_ARGS$(2))
|
||||
$$(Q)touch $$@
|
||||
|
||||
test/perf.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
|
||||
$$(BENCH_TESTS)
|
||||
@$$(call E, perf: $$<)
|
||||
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PERF_ARGS$(2))
|
||||
$$(Q)touch $$@
|
||||
|
||||
test/pretty-rpass.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
|
||||
$$(RPASS_TESTS)
|
||||
@$$(call E, run: $$<)
|
||||
|
Loading…
Reference in New Issue
Block a user