This repository has been archived by the owner on Feb 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmakefile
91 lines (66 loc) · 2.39 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
ifndef HAMUSTRO_SCHEMA
HAMUSTRO_SCHEMA:=http://
endif
ifndef HAMUSTRO_HOST
HAMUSTRO_HOST:=$(warning Please define HAMUSTRO_HOST environment variable, using default "localhost")localhost
endif
ifndef HAMUSTRO_PORT
HAMUSTRO_PORT:=$(warning Please define HAMUSTRO_PORT environment variable, using "8080")8080
endif
ifndef HAMUSTRO_CONFIG
HAMUSTRO_CONFIG:=$(warning Please define HAMUSTRO_CONFIG environment variable, using "config/config.json.sample")config/config.json.sample
endif
ifndef PYC
PYC:=python
endif
all:
@echo "Please specify a target!"
install/%:
./utils/installer/_$*.sh
setup:
$(PYC) utils/setup.py
src/%.go:
src/%/%.go:
src/%/%/%.go:
hamustro: src/payload/payload.pb.go \
src/*.go \
src/*/*.go \
src/*/*/*.go
go build -o $@ src/*.go
hamustro_linux: src/payload/payload.pb.go \
src/*.go \
src/*/*.go \
src/*/*/*.go
CGO_ENABLED=0 GOOS=linux go build -o $@ src/*.go
src/payload/payload.pb.go:
protoc --go_out=. proto/*.proto
mkdir -p $(dir $@) && mv proto/*.go $@
utils/payload/payload_pb2.py:
protoc --python_out=. proto/*.proto
mkdir -p $(dir $@) && mv proto/*.py $@
dev: hamustro utils/payload/payload_pb2.py
./$< -config $(HAMUSTRO_CONFIG) -verbose
server: hamustro
./$< -config $(HAMUSTRO_CONFIG)
profile/:
mkdir -p $@
profile/cpu: profile/
go tool pprof --pdf hamustro $(HAMUSTRO_SCHEMA)$(HAMUSTRO_HOST):$(HAMUSTRO_PORT)/debug/pprof/profile > [email protected]
profile/goroutine: profile/
go tool pprof --pdf hamustro $(HAMUSTRO_SCHEMA)$(HAMUSTRO_HOST):$(HAMUSTRO_PORT)/debug/pprof/goroutine > [email protected]
profile/heap: profile/
go tool pprof --pdf hamustro $(HAMUSTRO_SCHEMA)$(HAMUSTRO_HOST):$(HAMUSTRO_PORT)/debug/pprof/heap > [email protected]
profile/lines:
git ls-files | xargs cat | wc -l
tests/run:
go test -v -cover ./...
tests/send/%:
$(PYC) utils/send_single_message.py --format "$*" $(HAMUSTRO_CONFIG) "$(HAMUSTRO_SCHEMA)$(HAMUSTRO_HOST):$(HAMUSTRO_PORT)/api/v1/track"
tests/1-messages/:
$(PYC) utils/generate_stress_messages.py $(HAMUSTRO_CONFIG) $@
tests/n-messages/:
$(PYC) utils/generate_stress_messages.py -r $(HAMUSTRO_CONFIG) $@
tests/protobuf/%: tests/%-messages/
cd $< && wrk -t5 -c10 -d1m -s ../protobuf.lua "$(HAMUSTRO_SCHEMA)$(HAMUSTRO_HOST):$(HAMUSTRO_PORT)/api/v1/track"
tests/json/%: tests/%-messages/
cd $< && wrk -t5 -c10 -d1m -s ../json.lua "$(HAMUSTRO_SCHEMA)$(HAMUSTRO_HOST):$(HAMUSTRO_PORT)/api/v1/track"