-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (28 loc) · 1.21 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
DEBUG ?= 0
ifeq ($(DEBUG), 1)
BUILDFLAG = -tags jsonpack_debug
TESTFLAG = -tags jsonpack_debug
endif
BENCH_TARGET = $(TARGET)
ifeq ($(TARGET),)
TARGET = .
endif
PKGNAME = github.com/arloliu/jsonpack
.PHONY: test benchmark cpu-pprof mem-pprof protoc
test:
go test $(PKGNAME)/buffer -v $(TESTFLAG) -run $(TARGET)
go test $(PKGNAME) -v $(TESTFLAG) -run $(TARGET)
benchmark:
cd ./benchmark; go test benchmark -v $(TESTFLAG) -tags jsonpack_benchmark -benchmem -run ^$$ -bench $(TARGET)
cpu-pprof:
$(eval LOGFILE := $(shell mktemp -u --suffix .prof))
# go test $(PKGNAME) -cpuprofile $(LOGFILE) -v -benchmem -benchtime 5s -run ^$$ -bench BenchmarkComplex_Jsoniter_Marshal
cd ./benchmark; go test benchmark -cpuprofile $(LOGFILE) -v -benchmem -benchtime 2s -run ^$$ -bench $(BENCH_TARGET)
pprof -http=0.0.0.0:4231 $(LOGFILE)
mem-pprof:
$(eval LOGFILE := $(shell mktemp -u --suffix .prof))
# go test $(PKGNAME) -cpuprofile $(LOGFILE) -v -benchmem -benchtime 5s -run ^$$ -bench BenchmarkComplex_Jsoniter_Marshal
cd ./benchmark; go test benchmark -memprofile $(LOGFILE) -v -benchmem -benchtime 2s -run ^$$ -bench $(BENCH_TARGET)
pprof -http=0.0.0.0:4231 $(LOGFILE)
protoc:
protoc --go_out=paths=source_relative:. testdata/*.proto