blob: 858faf33dcee19d464e975bdc69657423ac44d85 (
plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
GO ?= go
ifdef DTAIL_USE_ACL
GO_TAGS=linuxacl
endif
ifdef DTAIL_USE_PROPRIETARY
GO_TAGS+=proprietary
endif
all: build
build: dserver dcat dgrep dmap dtail dtailhealth
dserver:
${GO} build ${GO_FLAGS} -tags '${GO_TAGS}' -o dserver ./cmd/dserver/main.go
dcat:
${GO} build ${GO_FLAGS} -tags '${GO_TAGS}' -o dcat ./cmd/dcat/main.go
dgrep:
${GO} build ${GO_FLAGS} -tags '${GO_TAGS}' -o dgrep ./cmd/dgrep/main.go
dmap:
${GO} build ${GO_FLAGS} -tags '${GO_TAGS}' -o dmap ./cmd/dmap/main.go
dtail:
${GO} build ${GO_FLAGS} -tags '${GO_TAGS}' -o dtail ./cmd/dtail/main.go
dtailhealth:
${GO} build ${GO_FLAGS} -tags '${GO_TAGS}' -o dtailhealth ./cmd/dtailhealth/main.go
dtail-tools:
${GO} build ${GO_FLAGS} -tags '${GO_TAGS}' -o dtail-tools ./cmd/dtail-tools/main.go
install:
${GO} install -tags '${GO_TAGS}' ./cmd/dserver/main.go
${GO} install -tags '${GO_TAGS}' ./cmd/dcat/main.go
${GO} install -tags '${GO_TAGS}' ./cmd/dgrep/main.go
${GO} install -tags '${GO_TAGS}' ./cmd/dmap/main.go
${GO} install -tags '${GO_TAGS}' ./cmd/dtail/main.go
${GO} install -tags '${GO_TAGS}' ./cmd/dtailhealth/main.go
clean:
ls ./cmd/ | while read cmd; do \
test -f $$cmd && rm $$cmd; \
done
@echo "Removing .tmp files..."
find . -name "*.tmp" -type f -delete
@echo "Removing .prof files..."
find . -name "*.prof" -type f -delete
vet:
find . -type d | egrep -v '(./examples|./log|./doc)' | while read dir; do \
echo ${GO} vet $$dir; \
${GO} vet $$dir; \
done
sh -c 'grep -R NEXT: .'
sh -c 'grep -R TODO: .'
lint:
${GO} get golang.org/x/lint/golint
find . -type d | while read dir; do \
echo golint $$dir; \
golint $$dir; \
done | grep -F .go:
test:
${GO} clean -testcache
set -e; find . -name '*_test.go' | while read file; do dirname $$file; done | \
sort -u | while read dir; do ${GO} test -tags '${GO_TAGS}' --race -v -failfast $$dir || exit 2; done
benchmark: build dtail-tools
./dtail-tools benchmark -mode run
benchmark-quick: build dtail-tools
./dtail-tools benchmark -mode run -quick
benchmark-full: build dtail-tools
./dtail-tools benchmark -mode run -iterations 3x
benchmark-baseline: build dtail-tools
@read -p "Enter a descriptive name for this baseline (e.g. 'before-optimization', 'v1.0-release'): " tag; \
if [ -z "$$tag" ]; then \
echo "Error: Baseline name cannot be empty"; \
exit 1; \
fi; \
./dtail-tools benchmark -mode baseline -tag "$$tag"
benchmark-baseline-quick: build dtail-tools
@read -p "Enter a descriptive name for this baseline (e.g. 'before-optimization', 'v1.0-release'): " tag; \
if [ -z "$$tag" ]; then \
echo "Error: Baseline name cannot be empty"; \
exit 1; \
fi; \
./dtail-tools benchmark -mode baseline -tag "$$tag" -quick
benchmark-compare: build dtail-tools
@if [ -z "${BASELINE}" ]; then \
echo "Usage: make benchmark-compare BASELINE=benchmarks/baselines/baseline_TIMESTAMP.txt"; \
./dtail-tools benchmark -mode list; \
exit 1; \
fi
./dtail-tools benchmark -mode compare -baseline ${BASELINE}
# Profiling targets
profile-all: build dtail-tools
./dtail-tools profile -mode full
profile-quick: build dtail-tools
./dtail-tools profile -mode quick
profile-dmap: build dtail-tools
./dtail-tools profile -mode dmap
profile-list: dtail-tools
./dtail-tools profile -mode list
# Interactive profile analysis
profile-analyze: dtail-tools
@if [ -z "${PROFILE}" ]; then \
echo "Usage: make profile-analyze PROFILE=profiles/dcat_cpu_*.prof"; \
./dtail-tools profile -mode list; \
else \
./dtail-tools profile -mode analyze ${PROFILE}; \
fi
# Generate flame graph (web interface)
profile-web: dtail-tools
@if [ -z "${PROFILE}" ]; then \
echo "Usage: make profile-web PROFILE=profiles/dcat_cpu_*.prof"; \
./dtail-tools profile -mode list; \
else \
./dtail-tools profile -mode analyze ${PROFILE} -web; \
fi
# Clean profiles
profile-clean:
@echo "Cleaning profile directory..."
rm -rf profiles testdata
@echo "Profile directory cleaned"
# Show profiling help
profile-help:
@echo "DTail Profiling Targets:"
@echo ""
@echo " make profile-quick - Quick profiling with small datasets"
@echo " make profile-all - Full profiling suite"
@echo " make profile-dmap - Profile dmap specifically"
@echo " make profile-list - List available profiles"
@echo ""
@echo " make profile-analyze PROFILE=<file> - Analyze a specific profile"
@echo " make profile-web PROFILE=<file> - Open web interface for profile"
@echo ""
@echo " make profile-clean - Clean all profiles"
@echo ""
@echo "Examples:"
@echo " make profile-quick # Fast profiling"
@echo " make profile-analyze PROFILE=profiles/dcat_cpu_*.prof"
@echo ""
.PHONY: profile-all profile-quick profile-dmap profile-list profile-analyze profile-web profile-clean profile-help
|