forked from microsoftarchive/hamustro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
72 lines (51 loc) · 1.95 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
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
PYC:=python
all:
@echo "Please specify a target!"
install/%:
./utils/installer/_$*.sh
src/%.go:
src/%/%.go:
src/%/%/%.go:
hamustro: src/payload/ src/*.go src/*/*.go src/*/*/*.go
go build -o $@ src/*.go
src/payload/:
protoc --go_out=. proto/*.proto
mkdir -p $@ && mv proto/*.go src/payload/
utils/payload/:
protoc --python_out=. proto/*.proto
mkdir -p $@ && mv proto/*.py utils/payload/
echo "from payload_pb2 import *" > $@/__init__.py
dev: hamustro utils/payload/
./$< -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]
tests/run:
go test -v ./...
tests/send:
$(PYC) utils/send_single_message.py $(HAMUSTRO_CONFIG) "$(HAMUSTRO_SCHEMA)$(HAMUSTRO_HOST):$(HAMUSTRO_PORT)/api/v1/track"
tests/stress/1-messages/:
$(PYC) utils/generate_stress_messages.py $(HAMUSTRO_CONFIG) $@
tests/stress/n-messages/:
$(PYC) utils/generate_stress_messages.py -r $(HAMUSTRO_CONFIG) $@
tests/stress/%: tests/stress/%-messages/
cd $< && wrk -t5 -c10 -d1m -s ../run.lua "$(HAMUSTRO_SCHEMA)$(HAMUSTRO_HOST):$(HAMUSTRO_PORT)/api/v1/track"