Makefile 970 Bytes
Newer Older
1 2 3
# This Makefile provides a way to really simple way to run benchmarks in a
# docker environment.

4
IPFS_ROOT = ../..
5 6
IMAGE = jbenet/go-ipfs-bench
CONTAINER = go-ipfs-bench
7 8
PACKAGE = integrationtest
PACKAGE_DIR = test/integration
9 10 11
BUILD_DIR = ./build/bench
CONTAINER_WORKING_DIR = /go
CPU_PROF_NAME = cpu.out
12
EXTRA_TEST_ARGS =
13 14 15 16 17 18 19 20 21 22

all: collect

collect: clean build_image run_profiler cp_pprof_from_container

cp_pprof_from_container:
	docker cp $(CONTAINER):$(CONTAINER_WORKING_DIR)/$(CPU_PROF_NAME) $(BUILD_DIR)
	docker cp $(CONTAINER):$(CONTAINER_WORKING_DIR)/$(PACKAGE).test $(BUILD_DIR)

build_image:
23
	cd $(IPFS_ROOT) && docker build -t $(IMAGE) .
24 25

run_profiler:
26
	docker run --name $(CONTAINER) -it --entrypoint go $(IMAGE) test ./src/github.com/jbenet/go-ipfs/$(PACKAGE_DIR) --cpuprofile=$(CPU_PROF_NAME) $(EXTRA_TEST_ARGS)
27 28 29 30 31 32 33 34


clean:
	docker rm $(CONTAINER) || true
	rm -rf $(BUILD_DIR)

analyze:
	go tool pprof $(BUILD_DIR)/$(PACKAGE).test $(BUILD_DIR)/$(CPU_PROF_NAME)