-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
executable file
·68 lines (54 loc) · 1.95 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
64
65
66
67
68
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:
go mod init
go mod tidy
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 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
\
mv ./*.svg bench/
profile-web:
go tool pprof -http=":6061" \
pprof/glg-test.bin \
pprof/cpu-glg.out &
go tool pprof -http=":6062" \
pprof/glg-test.bin \
pprof/mem-glg.out
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
format:
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs golines -w -m 200
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs gofumpt -w
find ./ -type d -name .git -prune -o -type f -regex '.*\.go' -print | xargs strictgoimports -w
find ./ -type d -name .git -prune -o -type f -regex '.*\.go' -print | xargs goimports -w
lint:
gometalinter --enable-all . | rg -v comment
test: clean init
GO111MODULE=on go test --race -timeout 1h -v $(go list ./... | rg -v vendor)
contributors:
git log --format='%aN <%aE>' | sort -fu > CONTRIBUTORS