@cryptotaxi247 / kubo / commits / ad546f935

feat(integration_test) add make task to perform benchmarks in docker env

pprof cannot be used reliably on OS X. This provides two make tasks to collect and analyze profiling data. To run profiling in a dockerized linux environment... ``` make // or `make collect` ``` To analyze results on host machine... ``` make analyze ``` @jbenet @whyrusleeping

Brian Tiger Chow committed Dec 24, 2014 at 08:29 UTC ad546f935a44510aab107693455a29ca5fe7d1f9
1 file changed +32
epictest/Makefile new
+32
@@ -0,0 +1,32 @@
1 +# This Makefile provides a way to really simple way to run benchmarks in a
2 +# docker environment.
3 +
4 +IMAGE = jbenet/go-ipfs-bench
5 +CONTAINER = go-ipfs-bench
6 +PACKAGE = epictest
7 +PACKAGE_DIR = epictest
8 +BUILD_DIR = ./build/bench
9 +CONTAINER_WORKING_DIR = /go
10 +CPU_PROF_NAME = cpu.out
11 +
12 +all: collect
13 +
14 +collect: clean build_image run_profiler cp_pprof_from_container
15 +
16 +cp_pprof_from_container:
17 + docker cp $(CONTAINER):$(CONTAINER_WORKING_DIR)/$(CPU_PROF_NAME) $(BUILD_DIR)
18 + docker cp $(CONTAINER):$(CONTAINER_WORKING_DIR)/$(PACKAGE).test $(BUILD_DIR)
19 +
20 +build_image:
21 + cd .. && docker build -t $(IMAGE) .
22 +
23 +run_profiler:
24 + docker run --name $(CONTAINER) -it --entrypoint go $(IMAGE) test ./src/github.com/jbenet/go-ipfs/$(PACKAGE_DIR) --cpuprofile=$(CPU_PROF_NAME)
25 +
26 +
27 +clean:
28 + docker rm $(CONTAINER) || true
29 + rm -rf $(BUILD_DIR)
30 +
31 +analyze:
32 + go tool pprof $(BUILD_DIR)/$(PACKAGE).test $(BUILD_DIR)/$(CPU_PROF_NAME)