mirror of
https://github.com/masonr/yet-another-bench-script.git
synced 2025-09-14 07:51:17 +00:00
Feats: Add Custom Iperf3 Server Option (#113)
Some checks failed
CI 🤖 / Shellcheck 🐚 (push) Has been cancelled
Some checks failed
CI 🤖 / Shellcheck 🐚 (push) Has been cancelled
* add geekbench v6 in main comments * add iperf3 customs servers argument * remove confusing comma in help message
This commit is contained in:
31
yabs.sh
Normal file → Executable file
31
yabs.sh
Normal file → Executable file
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Purpose: The purpose of this script is to quickly gauge the performance of a Linux-
|
||||
# based server by benchmarking network performance via iperf3, CPU and
|
||||
# overall system performance via Geekbench 4/5, and random disk
|
||||
# overall system performance via Geekbench 4/5/6, and random disk
|
||||
# performance via fio. The script is designed to not require any dependencies
|
||||
# - either compiled or installed - nor admin privileges to run.
|
||||
|
||||
@@ -59,11 +59,11 @@ else
|
||||
fi
|
||||
|
||||
# flags to skip certain performance tests
|
||||
unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH SKIP_NET PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 GEEKBENCH_6 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE
|
||||
unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH SKIP_NET PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 GEEKBENCH_6 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE IPERF_SERVERS
|
||||
GEEKBENCH_6="True" # gb6 test enabled by default
|
||||
|
||||
# get any arguments that were passed to the script and set the associated skip flags (if applicable)
|
||||
while getopts 'bfdignhr4596jw:s:' flag; do
|
||||
while getopts 'bfdignhr4596jw:s:p:' flag; do
|
||||
case "${flag}" in
|
||||
b) PREFER_BIN="True" ;;
|
||||
f) SKIP_FIO="True" ;;
|
||||
@@ -80,6 +80,7 @@ while getopts 'bfdignhr4596jw:s:' flag; do
|
||||
j) JSON+="j" ;;
|
||||
w) JSON+="w" && JSON_FILE=${OPTARG} ;;
|
||||
s) JSON+="s" && JSON_SEND=${OPTARG} ;;
|
||||
p) IPERF_SERVERS=${OPTARG} ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
done
|
||||
@@ -148,6 +149,9 @@ if [ -n "$PRINT_HELP" ]; then
|
||||
echo -e " -j : print jsonified YABS results at conclusion of test"
|
||||
echo -e " -w <filename> : write jsonified YABS results to disk using file name provided"
|
||||
echo -e " -s <url> : send jsonified YABS results to URL"
|
||||
echo -e " -p <servers> : specify custom iperf servers (format: host:port_range:name:location:network_modes)"
|
||||
echo -e " multiple servers separated by commas"
|
||||
echo -e " example: -p \"example.com:5201-5210:MyServer:New York (10G):IPv4|IPv6\""
|
||||
echo -e
|
||||
echo -e "Detected Arch: $ARCH"
|
||||
echo -e
|
||||
@@ -161,6 +165,7 @@ if [ -n "$PRINT_HELP" ]; then
|
||||
[[ -n $GEEKBENCH_4 ]] && echo -e " running geekbench 4"
|
||||
[[ -n $GEEKBENCH_5 ]] && echo -e " running geekbench 5"
|
||||
[[ -n $GEEKBENCH_6 ]] && echo -e " running geekbench 6"
|
||||
[[ -n $IPERF_SERVERS ]] && echo -e " -p, using custom iperf servers: $IPERF_SERVERS"
|
||||
echo -e
|
||||
echo -e "Local Binary Check:"
|
||||
([[ -z $LOCAL_FIO ]] && echo -e " fio not detected, will download precompiled binary") ||
|
||||
@@ -897,6 +902,24 @@ if [ -z "$SKIP_IPERF" ]; then
|
||||
)
|
||||
fi
|
||||
|
||||
# if custom iperf servers are provided, use them instead of the default servers
|
||||
if [ -n "$IPERF_SERVERS" ]; then
|
||||
# clear the default iperf locations array
|
||||
IPERF_LOCS=()
|
||||
|
||||
# parse the custom iperf servers and add them to the array
|
||||
IFS=',' read -ra CUSTOM_SERVERS <<< "$IPERF_SERVERS"
|
||||
for server in "${CUSTOM_SERVERS[@]}"; do
|
||||
# parse server definition: host:port_range:name:location:network_modes
|
||||
IFS=':' read -ra SERVER_PARTS <<< "$server"
|
||||
if [ ${#SERVER_PARTS[@]} -eq 5 ]; then
|
||||
IPERF_LOCS+=("${SERVER_PARTS[0]}" "${SERVER_PARTS[1]}" "${SERVER_PARTS[2]}" "${SERVER_PARTS[3]}" "${SERVER_PARTS[4]}")
|
||||
else
|
||||
echo -e "Invalid server format: $server (expected format: host:port_range:name:location:network_modes)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# get the total number of iperf locations (total array size divided by 5 since each location has 5 elements)
|
||||
IPERF_LOCS_NUM=${#IPERF_LOCS[@]}
|
||||
IPERF_LOCS_NUM=$((IPERF_LOCS_NUM / 5))
|
||||
@@ -914,7 +937,7 @@ if [ -z "$SKIP_IPERF" ]; then
|
||||
fi
|
||||
|
||||
# launch_geekbench
|
||||
# Purpose: This method is designed to run the Primate Labs' Geekbench 4/5 Cross-Platform Benchmark utility
|
||||
# Purpose: This method is designed to run the Primate Labs' Geekbench 4/5/6 Cross-Platform Benchmark utility
|
||||
# Parameters:
|
||||
# 1. VERSION - indicates which Geekbench version to run
|
||||
function launch_geekbench {
|
||||
|
Reference in New Issue
Block a user