-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (33 loc) · 1004 Bytes
/
Makefile
File metadata and controls
46 lines (33 loc) · 1004 Bytes
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
APP_NAME := web
PROFILE_FILE := cpu.pprof
CALLGRIND_FILE := output.callgrind
PROFILE_DURATION := 30
.PHONY: install tests build-js install-js install-go build profile-build profile convert open clean run
install-js:
npm install
build-js:
npm run build
install-go:
go mod tidy && go mod vendor
install:
go mod tidy && go mod vendor
npm install && npm run build
tests:
go test -covermode=set ./... -coverprofile=coverage.txt
build:
go build -ldflags="-s -w" -o $(APP_NAME) .
all: build-dev
profile-build:
go build -gcflags=all="-N -l" -o $(APP_NAME) .
run:
./$(APP_NAME)
profile:
@echo "Profiling $(APP_NAME) for $(PROFILE_DURATION) seconds..."
go tool pprof -seconds=$(PROFILE_DURATION) http://localhost:6060/debug/pprof/profile > $(PROFILE_FILE)
convert:
@echo "Converting profile to callgrind format..."
go tool pprof --callgrind ./$(APP_NAME) $(PROFILE_FILE) > $(CALLGRIND_FILE)
open:
kcachegrind $(CALLGRIND_FILE)
clean:
rm -f $(APP_NAME) $(PROFILE_FILE) $(CALLGRIND_FILE)