Skip to content

Commit cdce33a

Browse files
committed
Add configure and make machinery to activate perf metrics and ratchets.
1 parent bc4c89c commit cdce33a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ opt optimize 1 "build optimized rust code"
372372
opt optimize-cxx 1 "build optimized C++ code"
373373
opt optimize-llvm 1 "build optimized LLVM"
374374
opt debug 0 "build with extra debug fun"
375+
opt ratchet-bench 0 "ratchet benchmarks"
375376
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
376377
opt manage-submodules 1 "let the build manage the git submodules"
377378
opt mingw-cross 0 "cross-compile for win32 using mingw"

mk/tests.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ endif
6060
TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
6161
TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
6262

63+
TEST_RATCHET_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4)-metrics.json
64+
TEST_RATCHET_NOISE_PERCENT=10.0
65+
66+
# Whether to ratchet or merely save benchmarks
67+
ifdef CFG_RATCHET_BENCH
68+
CRATE_TEST_BENCH_ARGS=\
69+
--test --bench \
70+
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
71+
--ratchet-noise-percent $(TEST_RATCHET_NOISE_PERCENT)
72+
else
73+
CRATE_TEST_BENCH_ARGS=\
74+
--test --bench \
75+
--save-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4))
76+
endif
77+
6378
define DEF_TARGET_COMMANDS
6479

6580
ifdef CFG_UNIXY_$(1)
@@ -359,11 +374,14 @@ $(foreach host,$(CFG_HOST_TRIPLES), \
359374
define DEF_TEST_CRATE_RULES
360375
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
361376

377+
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
378+
362379
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
363380
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
364381
@$$(call E, run: $$<)
365382
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
366383
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
384+
$$(call CRATE_TEST_BENCH_ARGS,$(1),$(2),$(3),$(4)) \
367385
&& touch $$@
368386
endef
369387

@@ -552,6 +570,7 @@ CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
552570
$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
553571
--src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
554572
--build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
573+
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
555574
--mode $$(CTEST_MODE_$(4)) \
556575
$$(CTEST_RUNTOOL_$(4))
557576

0 commit comments

Comments
 (0)