-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (30 loc) · 1.15 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
BINARY_NAME=officestruggle
TS := $(shell /bin/date "+%Y%m%d-%H%M%S")
all: build test
build:
go build -o ${BINARY_NAME} main.go
test:
go test -v -cover ./...
testprofile: build
go test -v -cpuprofile profile/cpu${TS}.prof -memprofile profile/mem${TS}.prof ./systems
go tool pprof -png ${BINARY_NAME} profile/cpu${TS}.prof > profile/cpu${TS}.png
go tool pprof -png ${BINARY_NAME} profile/mem${TS}.prof > profile/mem${TS}.png
benchmark:
go test -v -benchmem -bench=. ./...
benchmarkprofile:
go test -v -benchmem -cpuprofile profile/cpu${TS}.prof -memprofile profile/mem${TS}.prof -bench=. ./systems
go tool pprof -png ${BINARY_NAME} profile/cpu${TS}.prof > profile/cpu${TS}.png
go tool pprof -png ${BINARY_NAME} profile/mem${TS}.prof > profile/mem${TS}.png
run:
go run -race main.go 2> err.log
clean:
go clean
rm ${BINARY_NAME}
deps:
sudo apt install graphviz
go install
profile: build
mkdir -p profile
./${BINARY_NAME} -cpuprofile profile/cpu${TS}.prof -memprofile profile/mem${TS}.prof
go tool pprof -png ${BINARY_NAME} profile/cpu${TS}.prof > profile/cpu${TS}.png
go tool pprof -png ${BINARY_NAME} profile/mem${TS}.prof > profile/mem${TS}.png