microbench.mk 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. check-microbench: DebianShootoutMono.stamp
  2. @$(MAKE) test-run-microbench
  3. DebianShootoutMono.stamp:
  4. @$(MAKE) validate-DebianShootoutMono RESET_VERSIONS=1
  5. @$(MAKE) prepare-dlls
  6. @touch $@
  7. abs_top_srcdir = $(abspath $(top_srcdir))
  8. TEST_EXE_PATH=$(abs_top_srcdir)/acceptance-tests/external/DebianShootoutMono/release/
  9. NET_4_X_RUNTIME=MONO_PATH=$(TEST_EXE_PATH):$(abs_top_srcdir)/mcs/class/lib/net_4_x $(abs_top_srcdir)/runtime/mono-wrapper
  10. FULL_AOT_RUNTIME=MONO_PATH=$(abs_top_srcdir)/mcs/class/lib/testing_aot_full $(abs_top_srcdir)/runtime/mono-wrapper
  11. PERF_BINARY=$(if $(MONO_PERF_BINARY),$(MONO_PERF_BINARY),perf)
  12. PERF_RUNTIME=$(abs_top_srcdir)/acceptance-tests/microbench-perf.sh
  13. define BenchmarkDotNetTemplate
  14. run-microbench-$(1):: DebianShootoutMono.stamp
  15. MONO_BENCH_AOT_RUN="$(AOT_RUN_FLAGS)" \
  16. MONO_BENCH_AOT_BUILD="$(AOT_BUILD_FLAGS)" \
  17. MONO_BENCH_EXECUTABLE="$(abs_top_srcdir)/runtime/mono-wrapper" \
  18. MONO_BENCH_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
  19. MONO_BENCH_INPUT="$(2)" \
  20. $(NET_4_X_RUNTIME) \
  21. $(TEST_EXE_PATH)/DebianShootoutMono.exe $(1)
  22. test-run-microbench:: run-microbench-$(1)
  23. run-microbench-debug-$(1):: DebianShootoutMono.stamp
  24. 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
  25. MONO_BENCH_INPUT="$(2)" \
  26. MONO_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
  27. $(abs_top_srcdir)/runtime/mono-wrapper $(AOT_RUN_FLAGS) $(TEST_EXE_PATH)/DebianShootoutMono.exe Run $(1)
  28. test-run-microbench-debug:: run-microbench-debug-$(1)
  29. if HOST_LINUX
  30. run-microbench-profiled-$(1):: microbench-results/$(1).perf.data
  31. microbench-results/$(1).perf.data: DebianShootoutMono.stamp
  32. mkdir -p microbench-results
  33. MONO_PERF_BINARY="$(PERF_BINARY)" \
  34. MONO_BENCH_EXECUTABLE="$(PERF_RUNTIME)" \
  35. MONO_BENCH_AOT_RUN="$(AOT_RUN_FLAGS)"\
  36. MONO_BENCH_AOT_BUILD="$(AOT_BUILD_FLAGS)"\
  37. MONO_BENCH_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
  38. MONO_BENCH_INPUT="$(2)" \
  39. $(NET_4_X_RUNTIME) \
  40. $(TEST_EXE_PATH)/DebianShootoutMono.exe $(1) $(2)
  41. mv perf.data microbench-results/$(1).perf.data
  42. microbench-results/$(1).tmp.perf: microbench-results/$(1).perf.data
  43. $(PERF_BINARY) script -i microbench-results/$(1).perf.data > microbench-results/$(1).tmp.perf
  44. microbench-results/$(1).perf-flame.svg: microbench-results/$(1).tmp.perf
  45. cat microbench-results/$(1).tmp.perf | ./external/DebianShootoutMono/FlameGraph/stackcollapse-perf.pl > microbench-results/$(1).perf-folded
  46. ./external/DebianShootoutMono/FlameGraph/flamegraph.pl microbench-results/$(1).perf-folded > microbench-results/$(1).perf-flame.svg
  47. rm microbench-results/$(1).tmp.perf
  48. rm microbench-results/$(1).perf-folded
  49. MONO_PERF_FLAGS=--show-cpu-utilization -n --hierarchy -T $(MONO_PERF_ADDITIONAL_FLAGS)
  50. microbench-results/$(1).perf.report: microbench-results/$(1).perf.data
  51. $(PERF_BINARY) report -i microbench-results/$(1).perf.data $(MONO_PERF_FLAGS) > microbench-results/$(1).perf.report
  52. test-run-microbench-profiled:: run-microbench-profiled-$(1)
  53. test-run-microbench-publish-collect:: microbench-results/$(1).perf.data microbench-results/$(1).perf.report microbench-results/$(1).perf-flame.svg
  54. endif
  55. endef
  56. if HOST_LINUX
  57. test-run-microbench-perf-check:
  58. $(PERF_BINARY) record -a -o perf.data -- echo "testing"
  59. rm perf.data
  60. microbench-results/perf-data.zip:
  61. zip microbench-results/perf-data.zip microbench-results/*.perf.data
  62. rm microbench-results/*.perf.data
  63. perf-report: microbench-results/perf-data.zip
  64. perf-report-total: test-run-microbench-publish-collect
  65. @$(MAKE) perf-report
  66. endif
  67. .PHONY: prepare-dlls
  68. if FULL_AOT_TESTS
  69. prepare-dlls:
  70. $(FULL_AOT_RUNTIME) $(AOT_BUILD_FLAGS) $(TEST_EXE_PATH)/*.{dll,exe}
  71. else
  72. prepare-dlls:
  73. endif
  74. FIXTURE_DIR=$(abs_top_srcdir)/acceptance-tests/external/DebianShootoutMono/fixtures
  75. $(eval $(call BenchmarkDotNetTemplate,Mandelbrot,))
  76. $(eval $(call BenchmarkDotNetTemplate,RegexRedux,$(FIXTURE_DIR)/regexredux-input.txt))
  77. $(eval $(call BenchmarkDotNetTemplate,KNucleotide,$(FIXTURE_DIR)/knucleotide-input.txt))
  78. $(eval $(call BenchmarkDotNetTemplate,BinaryTrees,))
  79. $(eval $(call BenchmarkDotNetTemplate,NBodyTest,))
  80. $(eval $(call BenchmarkDotNetTemplate,SpectralNorm,))
  81. $(eval $(call BenchmarkDotNetTemplate,Fannkuchredux,))
  82. $(eval $(call BenchmarkDotNetTemplate,Fasta,))
  83. $(eval $(call BenchmarkDotNetTemplate,RevComp,$(FIXTURE_DIR)/revcomp-input.txt))
  84. #$(eval $(call BenchmarkDotNetTemplate,GistBenchmark,$(MONO_BENCH_GIST_URL))) broken in BDN, bug filed