Skip to content

Commit 6439c2a

Browse files
committed
bench(WIP): add the code size measurement script
- construct the size command in Makefile - add the testSize script for code size measurement Signed-off-by: willieyz <willie.zhao@chelpis.com>
1 parent 4b8243c commit 6439c2a

File tree

2 files changed

+848
-4
lines changed

2 files changed

+848
-4
lines changed

Makefile

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
bench_components_512 bench_components_768 bench_components_1024 bench_components \
1515
run_bench_components_512 run_bench_components_768 run_bench_components_1024 run_bench_components \
1616
build test all \
17-
clean quickcheck check-defined-CYCLES
17+
clean quickcheck check-defined-CYCLES \
18+
size_512 size_768 size_1024 size \
19+
run_size_512 run_size_768 run_size_1024 run_size
1820

1921
.DEFAULT_GOAL := build
2022
all: build
@@ -94,13 +96,10 @@ bench: bench_512 bench_768 bench_1024
9496

9597
run_bench_512: bench_512
9698
$(W) $(MLKEM512_DIR)/bin/bench_mlkem512
97-
$(Q)$(SIZE) $(BUILD_DIR)/*mlkem512.a
9899
run_bench_768: bench_768
99100
$(W) $(MLKEM768_DIR)/bin/bench_mlkem768
100-
$(Q)$(SIZE) $(BUILD_DIR)/*mlkem768.a
101101
run_bench_1024: bench_1024
102102
$(W) $(MLKEM1024_DIR)/bin/bench_mlkem1024
103-
$(Q)$(SIZE) $(BUILD_DIR)/*mlkem1024.a
104103

105104
# Use .WAIT to prevent parallel execution when -j is passed
106105
run_bench: \
@@ -129,6 +128,24 @@ run_bench_components: \
129128
run_bench_components_768 .WAIT\
130129
run_bench_components_1024
131130

131+
132+
size_512: $(BUILD_DIR)/libmlkem512.a
133+
size_768: $(BUILD_DIR)/libmlkem768.a
134+
size_1024: $(BUILD_DIR)/libmlkem1024.a
135+
size: size_512 size_768 size_1024
136+
137+
run_size_512: size_512
138+
$(SIZE) $(BUILD_DIR)/libmlkem512.a
139+
run_size_768: size_768
140+
$(SIZE) $(BUILD_DIR)/libmlkem768.a
141+
run_size_1024: size_1024
142+
$(SIZE) $(BUILD_DIR)/libmlkem1024.a
143+
144+
run_size: \
145+
run_bench_512 \
146+
run_bench_768 \
147+
run_bench_1024
148+
132149
clean:
133150
-$(RM) -rf *.gcno *.gcda *.lcov *.o *.so
134151
-$(RM) -rf $(BUILD_DIR)

0 commit comments

Comments
 (0)