-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (51 loc) · 1.41 KB
/
Makefile
File metadata and controls
64 lines (51 loc) · 1.41 KB
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
GO ?= go
GOFLAGS = CGO_ENABLED=0
LINTER ?= golint
BINDIR := _examples
BINARY := _examples
VERSION := 0.1.9
LDFLAGS = -ldflags "-X main.gitSHA=$(shell git rev-parse HEAD) -X main.version=$(VERSION) -X main.name=$(BINARY)"
OS := $(shell go env GOHOSTOS)
.PHONY:
$(BINDIR)/$(BINARY): clean
if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
GOOS=$(OS) $(GOFLAGS) $(GO) build -v -o $(BINDIR)/$(BINARY) $(LDFLAGS)
.PHONY:
test:
$(GO) test -v -cover ./...
.PHONY:
clean:
$(GO) clean
rm -f $(BINDIR)/$(BINARY)
rm -f ./auth/dbpprof/*.prof
rm -f ./dbpprof/*.prof
.PHONY:
lint:
$(LINTER)
.PHONY:
cleanbench:
rm -f ./auth/dbpprof/*.prof
rm -f ./dbpprof/*.prof
.PHONY:
mkbench:
if [ ! -d "./auth/dbpprof" ]; then mkdir ./auth/dbpprof; fi
if [ ! -d "./dbpprof" ]; then mkdir ./dbpprof; fi
.PHONY:
bench_run:
$(GO) test -bench=. -benchmem -benchtime=1s -run=XXX ./auth -blockprofile=block.prof -cpuprofile=cpu.prof -memprofile=mem.prof -mutexprofile=mutex.prof
mv ./*.prof ./auth/dbpprof
$(GO) test -bench=. -benchmem -benchtime=2s -run=XXX ./ -blockprofile=block.prof -cpuprofile=cpu.prof -memprofile=mem.prof -mutexprofile=mutex.prof
mv ./*.prof ./dbpprof
.PHONY:
bench: | mkbench cleanbench bench_run
# use the new google UI for pprof
# requires installation via:
#
# go get github.com/google/pprof
#
.PHONY:
auth_cpu_prof:
pprof -http ":8888" auth/dbpprof/cpu.prof
.PHONY:
emailage_cpu_prof:
pprof -http ":8888" dbpprof/cpu.prof