Welcome to mirror list, hosted at ThFree Co, Russian Federation.

microbench.mk « acceptance-tests - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 44015fb0df68439ceac8465a56ceedb07e6134a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
check-microbench: DebianShootoutMono.stamp
	@$(MAKE) test-run-microbench

DebianShootoutMono.stamp: 
	@$(MAKE) validate-DebianShootoutMono RESET_VERSIONS=1
	@$(MAKE) prepare-dlls
	@touch $@

abs_top_srcdir = $(abspath $(top_srcdir))
TEST_EXE_PATH=$(abs_top_srcdir)/acceptance-tests/external/DebianShootoutMono/release/
NET_4_X_RUNTIME=MONO_PATH=$(TEST_EXE_PATH):$(abs_top_srcdir)/mcs/class/lib/net_4_x $(abs_top_srcdir)/runtime/mono-wrapper
FULL_AOT_RUNTIME=MONO_PATH=$(abs_top_srcdir)/mcs/class/lib/testing_aot_full $(abs_top_srcdir)/runtime/mono-wrapper

PERF_BINARY=$(if $(MONO_PERF_BINARY),$(MONO_PERF_BINARY),perf)
PERF_RUNTIME=$(abs_top_srcdir)/acceptance-tests/microbench-perf.sh

define BenchmarkDotNetTemplate

run-microbench-$(1):: DebianShootoutMono.stamp
	MONO_BENCH_AOT_RUN="$(AOT_RUN_FLAGS)" \
	MONO_BENCH_AOT_BUILD="$(AOT_BUILD_FLAGS)" \
	MONO_BENCH_EXECUTABLE="$(abs_top_srcdir)/runtime/mono-wrapper" \
	MONO_BENCH_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
	MONO_BENCH_INPUT="$(2)" \
	$(NET_4_X_RUNTIME) \
	$(TEST_EXE_PATH)/DebianShootoutMono.exe $(1)

test-run-microbench:: run-microbench-$(1)

run-microbench-debug-$(1):: DebianShootoutMono.stamp
	echo MONO_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" $(abs_top_srcdir)/runtime/mono-wrapper $(AOT_BUILD_FLAGS) $(TEST_EXE_PATH)/DebianShootoutMono.exe
	MONO_BENCH_INPUT="$(2)" \
	MONO_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
	$(abs_top_srcdir)/runtime/mono-wrapper $(AOT_RUN_FLAGS) $(TEST_EXE_PATH)/DebianShootoutMono.exe Run $(1)

test-run-microbench-debug:: run-microbench-debug-$(1)

if HOST_LINUX
run-microbench-profiled-$(1):: microbench-results/$(1).perf.data 

microbench-results/$(1).perf.data: DebianShootoutMono.stamp 
	mkdir -p microbench-results
	MONO_PERF_BINARY="$(PERF_BINARY)" \
	MONO_BENCH_EXECUTABLE="$(PERF_RUNTIME)" \
	MONO_BENCH_AOT_RUN="$(AOT_RUN_FLAGS)"\
	MONO_BENCH_AOT_BUILD="$(AOT_BUILD_FLAGS)"\
	MONO_BENCH_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
	MONO_BENCH_INPUT="$(2)" \
	$(NET_4_X_RUNTIME) \
	$(TEST_EXE_PATH)/DebianShootoutMono.exe $(1) $(2)
	mv perf.data microbench-results/$(1).perf.data

microbench-results/$(1).tmp.perf: microbench-results/$(1).perf.data
	$(PERF_BINARY) script -i microbench-results/$(1).perf.data > microbench-results/$(1).tmp.perf

microbench-results/$(1).perf-flame.svg: microbench-results/$(1).tmp.perf
	cat microbench-results/$(1).tmp.perf | ./external/DebianShootoutMono/FlameGraph/stackcollapse-perf.pl > microbench-results/$(1).perf-folded
	./external/DebianShootoutMono/FlameGraph/flamegraph.pl microbench-results/$(1).perf-folded > microbench-results/$(1).perf-flame.svg
	rm microbench-results/$(1).tmp.perf
	rm microbench-results/$(1).perf-folded

MONO_PERF_FLAGS=--show-cpu-utilization -n --hierarchy -T $(MONO_PERF_ADDITIONAL_FLAGS)

microbench-results/$(1).perf.report: microbench-results/$(1).perf.data
	$(PERF_BINARY) report -i microbench-results/$(1).perf.data $(MONO_PERF_FLAGS) > microbench-results/$(1).perf.report 

test-run-microbench-profiled:: run-microbench-profiled-$(1)

test-run-microbench-publish-collect:: microbench-results/$(1).perf.data microbench-results/$(1).perf.report microbench-results/$(1).perf-flame.svg

endif

endef

if HOST_LINUX

test-run-microbench-perf-check:
	$(PERF_BINARY) record -a -o perf.data -- echo "testing"
	rm perf.data

microbench-results/perf-data.zip:
	zip microbench-results/perf-data.zip microbench-results/*.perf.data
	rm microbench-results/*.perf.data

perf-report: microbench-results/perf-data.zip

perf-report-total: test-run-microbench-publish-collect
	@$(MAKE) perf-report

endif

.PHONY: prepare-dlls

if FULL_AOT_TESTS
prepare-dlls: 
	$(FULL_AOT_RUNTIME) $(AOT_BUILD_FLAGS) $(TEST_EXE_PATH)/*.{dll,exe}

else

prepare-dlls:

endif

FIXTURE_DIR=$(abs_top_srcdir)/acceptance-tests/external/DebianShootoutMono/fixtures

$(eval $(call BenchmarkDotNetTemplate,Mandelbrot,))
$(eval $(call BenchmarkDotNetTemplate,RegexRedux,$(FIXTURE_DIR)/regexredux-input.txt))
$(eval $(call BenchmarkDotNetTemplate,KNucleotide,$(FIXTURE_DIR)/knucleotide-input.txt))

$(eval $(call BenchmarkDotNetTemplate,BinaryTrees,))
$(eval $(call BenchmarkDotNetTemplate,NBodyTest,))
$(eval $(call BenchmarkDotNetTemplate,SpectralNorm,))
$(eval $(call BenchmarkDotNetTemplate,Fannkuchredux,))
$(eval $(call BenchmarkDotNetTemplate,Fasta,))

$(eval $(call BenchmarkDotNetTemplate,RevComp,$(FIXTURE_DIR)/revcomp-input.txt)) 

#$(eval $(call BenchmarkDotNetTemplate,GistBenchmark,$(MONO_BENCH_GIST_URL))) broken in BDN, bug filed