commit 693ec6c713e4b3db0755e77372d3371ba71ee25c Author: Imbus <> Date: Sun Jun 23 00:29:08 2024 +0200 Initial diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3e4b8e2 --- /dev/null +++ b/Makefile @@ -0,0 +1,73 @@ +# Simple benchmarking for linux + +CPU_MODEL=$(shell cat /proc/cpuinfo | grep "model name" | head -n 1 | cut -d ":" -f 2 | sed 's/^[ \t]*//') +export CPU_MODEL + +KERNEL=$(shell uname -r) +DATE=$(shell date +"%Y-%m-%d") + +# Suitable file name for the cpu model +FILE_NAME1=$(shell echo "$(CPU_MODEL)" | sed 's/ /_/g' | sed 's/__*/_/g') + +# Remove everything inside parens +FILE_NAME=$(shell echo "$(FILE_NAME1)" | sed 's/([^()]*)//g') + +NPROC=$(shell nproc) + +SINGLE_CORE_FILE=$(FILE_NAME)-single-core.log +MULTI_CORE_FILE=$(FILE_NAME)-multi-core.log +LSCPU_FILE=$(FILE_NAME)-lscpu.log +DMIDECODE_FILE=$(FILE_NAME)-dmidecode.log + +# Ensure all the deps are installed +entry: + @echo "CPU Model: $(CPU_MODEL)" + @echo "File Name: $(FILE_NAME)" + @echo "Kernel: $(KERNEL)" + @echo -e "Number of processors: $(NPROC)\n" + + @# Check dependencies + @which sysbench &> /dev/null || (echo "sysbench not installed" && exit 1) + @which lscpu &> /dev/null || (echo "lscpu not installed" && exit 1) + @which 7za &> /dev/null || (echo "7za not installed" && exit 1) + @which dmidecode &> /dev/null || (echo "dmidecode not installed" && exit 1) + + @# Check root + @[ `id -u` -eq 0 ] || (echo "Please run as root" && exit 1) + + @echo -e "\nAll dependencies are installed" + make all + + @echo -e "\033[0;32mSuccess!\033[0m" + +all: $(LSCPU_FILE) $(SINGLE_CORE_FILE) $(MULTI_CORE_FILE) $(DMIDECODE_FILE) + tar -cvzf $(FILE_NAME)-$(DATE).tar.gz $^ Makefile + +$(SINGLE_CORE_FILE): + sysbench cpu run > $@ + +$(MULTI_CORE_FILE): + sysbench cpu run --num-threads=$(NPROC) > $@ + +$(LSCPU_FILE): + lscpu > $@ + +$(DMIDECODE_FILE): + dmidecode > $@ + +install: + pacman -S sysbench lscpu p7zip dmi-decode + +clean: + rm *.log *.tar.gz + +# Sysbench Memory +# sysbench-mem: +# sysbench --test=memory --memory-block-size=1M --memory-total-size=10G run + +# # Sysbench Threads +# sysbench-threads: +# sysbench --test=threads --num-threads=64 --thread-yields=100 --thread-locks=6 run + +# 7za: +# 7za b