-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
92 lines (79 loc) · 3.22 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
92
CC := gcc
CCFLAGS := -Wall -Werror -pthread -g
B_TARGETS := test_trie_single_threaded test_trie_s_lock test_trie_rw_lock test_trie_hoh_lock
R_TARGETS := single_threaded s_lock rw_lock hoh_lock
ST_TARGETS := single_threaded
MT_TARGETS := s_lock rw_lock hoh_lock
test_all: $(R_TARGETS)
test_trie_rw_lock.c: test_trie_s_lock.c
@tail -n +2 $< > $@
@echo Updated $@
test_trie_hoh_lock.c: test_trie_s_lock.c
@tail -n +3 $< > $@
@echo Updated $@
$(B_TARGETS): % : %.c
@echo Building
$(CC) -o $@ $^ $(CCFLAGS)
$(ST_TARGETS): % : test_trie_%
@rm -f -r ./.testout
@mkdir .testout
@echo "\n-------------------------------------------"
@echo "Program Output($<):"
@echo "-------------------------------------------"
@-valgrind --leak-check=full --show-leak-kinds=all --log-file="./.testout/memtest_out_$<" ./$<
@echo "\n-------------------------------------------"
@echo "Valgrind Output($<):"
@echo "-------------------------------------------"
@cat ./.testout/memtest_out_$<
$(MT_TARGETS): % : test_trie_%
@rm -f -r ./.testout
@mkdir .testout
@echo "\n-------------------------------------------"
@echo "Program Output($<):"
@echo "-------------------------------------------"
@-valgrind --leak-check=full --show-leak-kinds=all --log-file="./.testout/memtest_out_$<" ./$<
@echo "\n-------------------------------------------"
@echo "Valgrind Memcheck Output($<):"
@echo "-------------------------------------------"
@cat ./.testout/memtest_out_$<
@-valgrind --tool=helgrind --log-file="./.testout/heltest_out_$<" ./$< > /dev/null
@echo "\n-------------------------------------------"
@echo "Valgrind Helgrind Output($<):"
@echo "-------------------------------------------"
@cat ./.testout/heltest_out_$<
clean:
rm -f $(B_TARGETS)
rm -f -r ./.testout
rm -f -r ./test_trie_rw_lock.c
rm -f -r ./test_trie_hoh_lock.c
COMPARE_FOLDER := ./comparison/
generate_workload:
@echo "generating workload....."
@cd comparison && python3 script_generator.py
read_write:
@echo "running on read-write 50-50 workload and generating plot......"
@cd comparison
@$(CC) -o $(COMPARE_FOLDER)s_lock $(COMPARE_FOLDER)s_lock.c $(CCFLAGS)
@cd comparison && ./s_lock 0
@$(CC) -o $(COMPARE_FOLDER)rw_lock $(COMPARE_FOLDER)rw_lock.c $(CCFLAGS)
@cd comparison && ./rw_lock 0
@$(CC) -o $(COMPARE_FOLDER)hoh_lock $(COMPARE_FOLDER)hoh_lock.c $(CCFLAGS)
@cd comparison && ./hoh_lock 0 && python3 plots.py
read_intensive:
@echo "running on read intensive workload and generating plot......"
@cd comparison
@$(CC) -o $(COMPARE_FOLDER)s_lock $(COMPARE_FOLDER)s_lock.c $(CCFLAGS)
@cd comparison && ./s_lock 1
@$(CC) -o $(COMPARE_FOLDER)rw_lock $(COMPARE_FOLDER)rw_lock.c $(CCFLAGS)
@cd comparison && ./rw_lock 1
@$(CC) -o $(COMPARE_FOLDER)hoh_lock $(COMPARE_FOLDER)hoh_lock.c $(CCFLAGS)
@cd comparison && ./hoh_lock 1 && python3 plots.py
write_intensive:
@echo "running on write intensive workload and generating plot......"
@cd comparison
@$(CC) -o $(COMPARE_FOLDER)s_lock $(COMPARE_FOLDER)s_lock.c $(CCFLAGS)
@cd comparison && ./s_lock 2
@$(CC) -o $(COMPARE_FOLDER)rw_lock $(COMPARE_FOLDER)rw_lock.c $(CCFLAGS)
@cd comparison && ./rw_lock 2
@$(CC) -o $(COMPARE_FOLDER)hoh_lock $(COMPARE_FOLDER)hoh_lock.c $(CCFLAGS)
@cd comparison && ./hoh_lock 2 && python3 plots.py