Feat: Benchmarks
This commit is contained in:
parent
befa4de16f
commit
cdaa1e0196
3 changed files with 37 additions and 4 deletions
2
Implementierung/.gitignore
vendored
2
Implementierung/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
|||
build
|
||||
md2
|
||||
testfile*
|
||||
t
|
|
@ -5,6 +5,8 @@ OBJ = ${subst src,build,${SRC:.c=.o}}
|
|||
CC = gcc
|
||||
CFLAGS = -Ilib -ggdb -std=c11 -g -Wall -Wextra -no-pie -O3
|
||||
LDFLAGS =
|
||||
TESTFILES = t/1 t/10 t/100 #t/1000 t/2000 t/5000 t/10000
|
||||
TESTFILES_SIZES = ${subst t/,,${TESTFILES}}
|
||||
|
||||
all: md2
|
||||
|
||||
|
@ -18,9 +20,7 @@ help:
|
|||
@echo - all: build everything
|
||||
@echo - clean: clean distfiles
|
||||
@echo - help: show this help
|
||||
|
||||
build:
|
||||
mkdir build
|
||||
@echo - benchmarks: run benchmarks (only works on linux!)
|
||||
|
||||
build/%.o: src/%.c
|
||||
@mkdir -p build/md2_impls
|
||||
|
@ -29,4 +29,36 @@ build/%.o: src/%.c
|
|||
md2: ${OBJ}
|
||||
${CC} -o $@ $(OBJ) ${LDFLAGS}
|
||||
|
||||
t/%:
|
||||
@echo
|
||||
@echo "=== Generating ${subst t/,,$@}MB of random data... ==="
|
||||
dd if=/dev/random of=$@ bs=1M count=${subst t/,,$@} status=progress
|
||||
@echo "=== done ==="
|
||||
@echo
|
||||
|
||||
benchmarks.csv: ${TESTFILES}
|
||||
@echo "" > $@
|
||||
@for i in 0 1 2 3; do \
|
||||
echo ;\
|
||||
echo "=== Testing implementation $$i ===";\
|
||||
for t in $(TESTFILES_SIZES); do \
|
||||
echo -n "- with $${t}MB ... "; \
|
||||
if ! r=$$(./md2 t/$${t} -B1 -V1); then \
|
||||
echo; \
|
||||
echo "ERROR!"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
r=$$(echo $$r | grep "cycles took" | sed 's/ seconds//g' | sed 's/took /\n/g' | tail -1) \
|
||||
echo $$?; \
|
||||
echo "$${r}s"; \
|
||||
echo "$${i};$${t};$${r}" >> $@; \
|
||||
done; \
|
||||
echo "=== done ===";\
|
||||
echo;\
|
||||
done
|
||||
|
||||
|
||||
tests: md2
|
||||
|
||||
|
||||
.PHONY: all clean help
|
1
Implementierung/benchmarks.csv
Normal file
1
Implementierung/benchmarks.csv
Normal file
|
@ -0,0 +1 @@
|
|||
|
|
Loading…
Reference in a new issue