-
Notifications
You must be signed in to change notification settings - Fork 106
/
Makefile
84 lines (66 loc) · 1.94 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
TESTS = test_common
TEST_DATA = s Tai
CFLAGS = -O0 -Wall -Werror -g
# Control the build verbosity
ifeq ("$(VERBOSE)","1")
Q :=
VECHO = @true
else
Q := @
VECHO = @printf
endif
GIT_HOOKS := .git/hooks/applied
.PHONY: all clean
all: $(GIT_HOOKS) $(TESTS)
$(GIT_HOOKS):
@scripts/install-git-hooks
@echo
OBJS_LIB = \
tst.o bloom.o
OBJS := \
$(OBJS_LIB) \
test_common.o \
deps := $(OBJS:%.o=.%.o.d)
test_%: test_%.o $(OBJS_LIB)
$(VECHO) " LD\t$@\n"
$(Q)$(CC) $(LDFLAGS) -o $@ $^ -lm
%.o: %.c
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(CFLAGS) -c -MMD -MF [email protected] $<
test: $(TESTS)
echo 3 | sudo tee /proc/sys/vm/drop_caches;
sudo perf stat --repeat 100 \
-e cache-misses,cache-references,instructions,cycles \
./test_common --bench CPY $(TEST_DATA)
sudo perf stat --repeat 100 \
-e cache-misses,cache-references,instructions,cycles \
./test_common --bench REF $(TEST_DATA)
bench: $(TESTS)
@echo "COPY mechanism"
@for test in $(TESTS); do \
echo -n "$$test => "; \
./$$test --bench CPY $(TEST_DATA) | grep "searched prefix "; \
done
@echo "REFERENCE mechanism"
@for test in $(TESTS); do \
echo -n "$$test => "; \
./$$test --bench REF $(TEST_DATA) | grep "searched prefix "; \
done
plot: $(TESTS)
echo 3 | sudo tee /proc/sys/vm/drop_caches;
sudo perf stat --repeat 100 \
-e cache-misses,cache-references,instructions,cycles \
./test_common --bench CPY $(TEST_DATA) \
| grep 'ternary_tree, loaded 206849 words'\
| grep -Eo '[0-9]+\.[0-9]+' > cpy_data.csv
sudo perf stat --repeat 100 \
-e cache-misses,cache-references,instructions,cycles \
./test_common --bench REF $(TEST_DATA)\
| grep 'ternary_tree, loaded 206849 words'\
| grep -Eo '[0-9]+\.[0-9]+' > ref_data.csv
clean:
$(RM) $(TESTS) $(OBJS)
$(RM) $(deps)
$(RM) bench_cpy.txt bench_ref.txt ref.txt cpy.txt
$(RM) *.csv
-include $(deps)