Skip to content

Commit

Permalink
v159
Browse files Browse the repository at this point in the history
+ DietPi-Config | Tools > Benchmarks: Added ability to benchmark CPU
performance using sysbench:
https://github.com/Fourdee/DietPi/issues/1253#issuecomment-346441545
  • Loading branch information
Fourdee committed Nov 22, 2017
1 parent 196c25f commit af034bb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ v159

Changes / Improvements / Optimizations:
General | DietPi RPi kernel: Updated to 4.9.62.
DietPi-Config | Tools > Benchmarks: Added ability to benchmark CPU performance using sysbench: https://github.com/Fourdee/DietPi/issues/1253#issuecomment-346441545
DietPi-Config | Time sync modes: NTP is now uninstalled when SystemD timedatectl is enabled. Reinstalled on demand. Timedatectl pool servers are now also set: https://github.com/Fourdee/DietPi/issues/1208#issuecomment-343762480
DietPi-Software | APT log: Moved to /etc/dietpi/logs/dietpi-software_apt.log, to prevent RAMlog clearing log during automated installations.
DietPi-Software | MPD (Stretch): Install updated to 0.20.11. Also supports native DSD playback (thanks to @sudeep and PJotr), when "Native" output freq/bit is set: https://github.com/Fourdee/DietPi/issues/1236
Expand Down
54 changes: 50 additions & 4 deletions dietpi/dietpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -3822,6 +3822,8 @@ _EOF_
}

#Benchmark Scores
CPU_PRIME_TIME='Not Tested'
CPU_PRIME_MAX=10000
SD_WRITE='Not Tested'
SD_READ='Not Tested'
USB_WRITE='Not Tested'
Expand Down Expand Up @@ -3988,20 +3990,64 @@ _EOF_

}

Run_CPUBenchmark(){

if (( ! $(dpkg --get-selections | grep -ci -m1 '^sysbench[[:space:]]') )); then

/DietPi/dietpi/func/dietpi-notify 2 "Installing Sysbench, please wait..."
apt-get install sysbench -y

fi

/DietPi/dietpi/dietpi-services stop

/DietPi/dietpi/func/dietpi-notify 0 "Running Sysbench with max prime of $CPU_PRIME_MAX, please wait..."

local fp_log_sysbench='/tmp/.fp_log_sysbench'
sysbench --test=cpu --num-threads=$(nproc --all) --cpu-max-prime=$CPU_PRIME_MAX --validate=on run | tee -a "$fp_log_sysbench"

/DietPi/dietpi/func/dietpi-notify 0 "Sysbench completed"

CPU_PRIME_TIME=$(grep -m1 'total time' "$fp_log_sysbench" | awk '{print $NF}')

rm "$fp_log_sysbench"

/DietPi/dietpi/dietpi-services start

}

#TARGETMENUID=12
Menu_FilesystemBenchmark(){

TARGETMENUID=11

WHIP_TITLE='DietPi - Filesystem benchmarks'
OPTION=$(whiptail --title "$WHIP_TITLE" --menu " RootFS : Write = $SD_WRITE | Read = $SD_READ \n USB Drive : Write = $USB_WRITE | Read = $USB_READ\n Custom : Write = $CUSTOM_WRITE | Read = $CUSTOM_READ\n RAM : Write = $RAM_WRITE | Read = $RAM_READ" --cancel-button "$TEXT_MENU_BACK" --backtitle "$WHIP_BACKTITLE" 15 65 4 \
WHIP_TITLE='DietPi - Benchmarks'
OPTION=$(whiptail --title "$WHIP_TITLE" --menu "\
CPU : Total time $CPU_PRIME_MAX prime = $CPU_PRIME_TIME\n\
RAM : Write = $RAM_WRITE | Read = $RAM_READ\n\
RootFS : Write = $SD_WRITE | Read = $SD_READ \n\
USB Drive : Write = $USB_WRITE | Read = $USB_READ\n\
Custom : Write = $CUSTOM_WRITE | Read = $CUSTOM_READ\
" --cancel-button "$TEXT_MENU_BACK" --backtitle "$WHIP_BACKTITLE" 19 70 7 \
"" "─── Performance ─────────────────────────────" \
"CPU" "Benchmark CPU performance." \
"RAM" "Benchmark RAM performance." \
"" "─── Filesystem ──────────────────────────────" \
"RootFS" "Benchmark SD/EMMC IO performance." \
"USB Drive" "Benchmark USB drive IO performance." \
"Custom" "Benchmark from a selection of mounted devices." \
"RAM" "Benchmark RAM IO performance." 3>&1 1>&2 2>&3)
"Custom" "Benchmark from a selection of mounted devices." 3>&1 1>&2 2>&3)

case "$OPTION" in

"CPU")

Run_CPUBenchmark

#Return to this menu
TARGETMENUID=12

;;

"RootFS")

Run_FilesystemBenchmark 0
Expand Down

0 comments on commit af034bb

Please sign in to comment.