Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (28 loc) · 1.46 KB
/
Copy pathMakefile
File metadata and controls
34 lines (28 loc) · 1.46 KB
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
SDK_BENCHMARKS := test/support/sdk-benchmarks
INSTRUMENT_HOOKS := bench/instrument-hooks
INSTRUMENT_HOOKS_NIF := _build/codspeed/instrument_hooks_nif.so
ERTS_INCLUDE_DIR = $(shell erl -noshell -eval 'io:format("~ts/erts-~ts/include", [code:root_dir(), erlang:system_info(version)]), halt().')
NIF_CFLAGS := -std=c11 -O3 -g -fPIC -Wno-format -Wno-format-security -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-type-limits -Wno-uninitialized -Wno-incompatible-pointer-types
ifeq ($(shell uname -s),Darwin)
NIF_LDFLAGS := -dynamiclib -undefined dynamic_lookup
else
NIF_LDFLAGS := -shared
BENCHMARK_ERL_FLAGS := +JPperf true
endif
$(SDK_BENCHMARKS)/environments:
git submodule update --init -- $(SDK_BENCHMARKS)
$(INSTRUMENT_HOOKS)/dist/core.c:
git submodule update --init -- $(INSTRUMENT_HOOKS)
$(INSTRUMENT_HOOKS_NIF): bench/instrument_hooks_nif.c | $(INSTRUMENT_HOOKS)/dist/core.c
mkdir -p $(@D)
$(CC) $(NIF_CFLAGS) -I$(ERTS_INCLUDE_DIR) -I$(INSTRUMENT_HOOKS)/includes $(NIF_LDFLAGS) -o $@ $< $(INSTRUMENT_HOOKS)/dist/core.c
.PHONY: benchmark-build
benchmark-build: $(INSTRUMENT_HOOKS_NIF) | $(SDK_BENCHMARKS)/environments
mix deps.get
mix compile
.PHONY: benchmark
benchmark: benchmark-build
SDK_BENCHMARKS_ENVIRONMENTS_DIR=$(abspath $(SDK_BENCHMARKS)/environments) \
INSTRUMENT_HOOKS_NIF=$(abspath $(basename $(INSTRUMENT_HOOKS_NIF))) \
ERL_FLAGS="$(BENCHMARK_ERL_FLAGS)" \
codspeed run --mode walltime -- mix run --no-compile --no-deps-check bench/sdk_benchmark.exs