forked from kpango/glg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (46 loc) · 1.77 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
GO_VERSION:=$(shell go version)
.PHONY: all clean bench bench-all profile lint test contributors update install
all: clean install lint test bench
clean:
go clean ./...
rm -rf ./*.log
rm -rf ./*.svg
rm -rf ./go.mod
rm -rf ./go.sum
rm -rf bench
rm -rf pprof
rm -rf vendor
bench: clean init
go test -count=5 -run=NONE -bench . -benchmem
init:
GO111MODULE=on go mod init
GO111MODULE=on go mod vendor
sleep 3
profile: clean init
rm -rf bench
mkdir bench
mkdir pprof
\
go test -count=10 -run=NONE -bench=BenchmarkGlg -benchmem -o pprof/glg-test.bin -cpuprofile pprof/cpu-glg.out -memprofile pprof/mem-glg.out
go tool pprof --svg pprof/glg-test.bin pprof/cpu-glg.out > cpu-glg.svg
go tool pprof --svg pprof/glg-test.bin pprof/mem-glg.out > mem-glg.svg
go-torch -f bench/cpu-glg-graph.svg pprof/glg-test.bin pprof/cpu-glg.out
go-torch --alloc_objects -f bench/mem-glg-graph.svg pprof/glg-test.bin pprof/mem-glg.out
\
go test -count=10 -run=NONE -bench=BenchmarkDefaultLog -benchmem -o pprof/default-test.bin -cpuprofile pprof/cpu-default.out -memprofile pprof/mem-default.out
go tool pprof --svg pprof/default-test.bin pprof/mem-default.out > mem-default.svg
go tool pprof --svg pprof/default-test.bin pprof/cpu-default.out > cpu-default.svg
go-torch -f bench/cpu-default-graph.svg pprof/default-test.bin pprof/cpu-default.out
go-torch --alloc_objects -f bench/mem-default-graph.svg pprof/default-test.bin pprof/mem-default.out
\
mv ./*.svg bench/
cpu:
go tool pprof pprof/glg-test.bin pprof/cpu-glg.out
mem:
go tool pprof --alloc_space pprof/glg-test.bin pprof/mem-glg.out
lint:
gometalinter --enable-all . | rg -v comment
test: clean init
GO111MODULE=on go test --race -v $(go list ./... | rg -v vendor)
contributors:
git log --format='%aN <%aE>' | sort -fu > CONTRIBUTORS