-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (54 loc) · 3.22 KB
/
Makefile
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
all: help
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## plot: plot the data
.PHONY: plot
plot:
@echo "Post processing the data..."
# simple_task/1K
# BenchmarkNaivepool/simple_task/1K_tasks-4
@sed -n -E 's/BenchmarkNaivepool\/.*\/(.*)_\w+-[0-9]+/\1/p' go-work.dat | column -t -s ' ' | awk '{print $$1, $$3}' > go-work-final.dat
@sed -n -E 's/BenchmarkNaivepool\/.*\/(.*)_\w+-[0-9]+/\1/p' for-select-for-select.dat | column -t -s ' ' | awk '{print $$1, $$3}' > for-select-for-select-final.dat
@sed -n -E 's/BenchmarkNaivepool\/.*\/(.*)_\w+-[0-9]+/\1/p' for-select-for-range.dat | column -t -s ' ' | awk '{print $$1, $$3}' > for-select-for-range-final.dat
@sed -n -E 's/BenchmarkNaivepool\/.*\/(.*)_\w+-[0-9]+/\1/p' no-jobChan-for-range-worker.dat | column -t -s ' ' | awk '{print $$1, $$3}' > no-jobChan-for-range-worker-final.dat
@sed -n -E 's/BenchmarkNormalGoroutine\/.*\/(.*)_\w+-[0-9]+/\1/p' normal-goroutine.dat | column -t -s ' ' | awk '{print $$1, $$3}' > normal-goroutine-final.dat
@sed -n -E 's/BenchmarkPond\/.*\/(.*)_\w+-[0-9]+/\1/p' pond.dat | column -t -s ' ' | awk '{print $$1, $$3}' > pond-final.dat
@echo "Done post processing.\n"
@echo "plotting data with gnuplot..."
@gnuplot -c plot.gp
@echo "Done!"
## bench/naivepool/different-impl: benchmark all tests of naivepool between different implementation.
.PHONY: bench/naivepool/different-impl
bench/naivepool/different-impl:
@echo "Running benchmark between different implementation of naivepool..."
@go test -v --bench=BenchmarkNormalGoroutine > normal-goroutine
@go test -v --bench=BenchmarkPond > pond
@git checkout feat-pool-go-work && make bench/naivepool/all > go-work.dat
@git checkout feat-dispatcher-for-select-worker-for-select && make bench/naivepool/all > for-select-for-select.dat
@git checkout feat-dispatcher-for-select-worker-for-range && make bench/naivepool/all > for-select-for-range.dat
@git checkout feat-no-jobChan-with-for-range-worker && make bench/naivepool/all > no-jobChan-for-range-worker.dat
@git checkout master
@benchstat -html no-jobChan-for-range-worker for-select-for-range for-select-for-select go-work > output.html
@benchstat -html no-jobChan-for-range-worker normal-goroutine pond > cmp-normal-pond.html
## bench/naivepool/all: benchmark all tests of naivepool
.PHONY: bench/naivepool/all
bench/naivepool/all:
@go test -v --bench=BenchmarkNaivepool -benchmem
## bench/naivepool/simple_task: benchmark naivepool with simple task
.PHONY: bench/naivepool/simple_task
bench/naivepool/simple_task:
@go test -v --bench=BenchmarkNaivepool/simple_task -benchmem
## bench/naivepool/long-running_task: benchmark naivepool with long-running task
.PHONY: bench/naivepool/long-running_task
bench/naivepool/long-running_task:
@go test -v --bench=BenchmarkNaivepool/long-running_task -benchmem
## bench/naivepool/print: benchmark naivepool with IO bound function - print
.PHONY: bench/naivepool/print
bench/naivepool/print:
@go test -v --bench=BenchmarkNaivepool/print -benchmem