diff --git a/README.md b/README.md index 5afb061..1209ce9 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,32 @@ # Yet-Another-Bench-Script -Here's an attempt to create _yet another_ damn Linux server *bench*marking _script_. +Presenting an attempt to create _yet another_ Linux server *bench*marking _script_... ![](https://user-images.githubusercontent.com/8313125/106475387-e1f6da00-6473-11eb-918c-c785ebeef8b9.jpg) Logo design by [Dian Pratama](https://github.com/dianp) -This script isn't an attempt to be a golden standard. It's just yet another bench script to add to your arsenal. Included are several tests that I think are most beneficial for the end-user. If there's features that you would like to see added, feel free to submit an issue describing your feature request or fork the project! +This script throws together and automates the execution of the best benchmarking tools of the biz. Included are several tests to check the performance of critical areas of a server: disk performance with [fio](https://github.com/axboe/fio), network performance with [iperf3](https://github.com/esnet/iperf), and CPU/memory performance with [Geekbench](https://www.geekbench.com/). The script is designed to not require any external dependencies to be installed nor elevated privileges to run. If there are any features that you would like to see added, feel free to submit an issue describing your feature request or fork the project and submit a PR! View YABS usage stats [here](https://yabs.rowe.sh). +### **What's New With YABS?** +* [27 Feb 2023](https://github.com/masonr/yet-another-bench-script/commit/06eaa2ab3b32355bec8278c51c4be93b3662a96d) - Newly released [Geekbench 6](https://www.geekbench.com/) is added as the default Geekbench test. +* [26 Feb 2023](https://github.com/masonr/yet-another-bench-script/commit/f075baf59c3057983fff0a30ea0c746b5ea88d91) - Network information added to YABS output using [ip-api](https://ip-api.com/). +* [15 Aug 2022](https://github.com/masonr/yet-another-bench-script/commit/ae24e70fbf7a4848e81a70cf829ec44e060e63d5) - Added JSON output/upload support to export or auto-upload of YABS results for sharing. + ## How to Run -`curl -sL yabs.sh | bash` +``` +curl -sL yabs.sh | bash +``` or -`wget -qO- yabs.sh | bash` +``` +wget -qO- yabs.sh | bash +``` -This script has been tested on the following Linux distributions: CentOS 6+, Debian 8+, Fedora 30, and Ubuntu 16.04+. It is designed to not require any external dependencies to be installed nor elevated privileges to run. +This script has been tested on the following Linux distributions: CentOS 6+, Debian 8+, Fedora 30, and Ubuntu 16.04+. **Local fio/iperf3 Packages**: If the tested system has fio and/or iperf3 already installed, the local package will take precedence over the precompiled binary. @@ -25,25 +34,28 @@ This script has been tested on the following Linux distributions: CentOS 6+, Deb **High Bandwidth Usage Notice**: By default, this script will perform many iperf network tests, which will try to max out the network port for ~20s per location (10s in each direction). Low-bandwidth servers (such as a NAT VPS) should consider running this script with the `-r` flag (for reduced iperf locations) or the `-i` flag (to disable network tests entirely). -### Flags (Skipping Tests, Reducing iperf Locations, Geekbench 4, etc.) - -By default, the script runs all three tests described in the next section below. In the event that you wish to skip one or more of the tests, use the commands below: +### Flags (Skipping Tests, Reducing iperf Locations, Geekbench 4/5/6, etc.) ``` curl -sL yabs.sh | bash -s -- -flags ``` -* `-b` this option forces use of pre-compiled binaries from repo over local packages -* `-f`/`-d` this option disables the fio (disk performance) test -* `-i` this option disables the iperf (network performance) test -* `-g` this option disables the Geekbench (system performance) test -* `-h` this option prints the help message with usage, flags detected, and local package (fio/iperf) status -* `-r` this option reduces the number of iperf locations (Online.net/Clouvider LON+NYC) to lessen bandwidth usage -* `-4` this option overrides the Geekbench 5 performance test and runs a Geekbench 4 test instead -* `-9` this option runs the Geekbench 4 test in addition to the Geekbench 5 test -* `-j` this option prints a JSON representation of the results to the screen -* `-w ` this option writes the JSON results to a file using the file name provided -* `-s ` this option sends a JSON representation of the results to the designated URL(s) (see section below) +| Flag | Description | +| ---- | ----------- | +| -b | Forces use of pre-compiled binaries from repo over local packages | +| -f/-d | Disables the fio (disk performance) test | +| -i | Disables the iperf (network performance) test | +| -g | Disables the Geekbench (system performance) test | +| -n | Skips the network information lookup and print out | +| -h | Prints the help message with usage, flags detected, and local package (fio/iperf) status | +| -r | Reduces the number of iperf locations (Scaleway/Clouvider LON+NYC) to lessen bandwidth usage | +| -4 | Runs a Geekbench 4 test and disables the Geekbench 6 test | +| -5 | Runs a Geekbench 5 test and disables the Geekbench 6 test | +| -9 | Runs both the Geekbench 4 and 5 tests instead of the Geekbench 6 test | +| -6 | Re-enables the Geekbench 6 test if any of the following were used: -4, -5, or -9 (-6 flag must be last to not be overridden) | +| -j | Prints a JSON representation of the results to the screen | +| -w \ | Writes the JSON results to a file using the file name provided | +| -s \ | Sends a JSON representation of the results to the designated URL(s) (see section below) | Options can be grouped together to skip multiple tests, i.e. `-fg` to skip the disk and system performance tests (effectively only testing network performance). @@ -59,13 +71,20 @@ curl -sL yabs.sh | bash -s -- -s "https://example.com/yabs/post" JSON results can be sent to multiple endpoints by entering each site joined by a comma (e.g. "https://example.com/yabs/post,http://example.com/yabs2/post"). -A list of websites supporting acceptance of YABS JSON results will be posted here (when available). Example JSON output: [example.json](bin/example.json). +Sites supporting submission of YABS JSON results: + +| Website | Example Command | +| --- | --- | +| [YABSdb](https://yabsdb.com/) | `curl -sL yabs.sh \| bash -s -- -s "https://yabsdb.com/add"` | +| [VPSBenchmarks](https://www.vpsbenchmarks.com/yabs/get_started) | `curl -sL yabs.sh \| bash -s -- -s https://www.vpsbenchmarks.com/yabs/upload` | + +Example JSON output: [example.json](bin/example.json). ## Tests Conducted * **[fio](https://github.com/axboe/fio)** - the most comprehensive I/O testing software available, fio grants the ability to evaluate disk performance in a variety of methods with a variety of options. Four random read and write fio disk tests are conducted as part of this script with 4k, 64k, 512k, and 1m block sizes. The tests are designed to evaluate disk throughput in near-real world (using random) scenarios with a 50/50 split (50% reads and 50% writes per test). * **[iperf3](https://github.com/esnet/iperf)** - the industry standard for testing download and upload speeds to various locations. This script utilizes iperf3 with 8 parallel threads and tests both download and upload speeds. If an iperf server is busy after 5 tries, the speed test for that location/direction is skipped. -* **[Geekbench](https://www.geekbench.com/)** - Geekbench is a benchmarking program that measures system performance, which is widely used in the tech community. The web URL is displayed to be able to see complete test and individual benchmark results and allow comparison to other geekbench'd systems. The claim URL to add the Geekbench result to your Geekbench profile is written to a file in the directory that this script is executed from. By default, Geekbench 5 is the only Geekbench test performed, however, Geekbench 4 can also be toggled on by passing the appropriate flag. +* **[Geekbench](https://www.geekbench.com/)** - Geekbench is a benchmarking program that measures system performance, which is widely used in the tech community. The web URL is displayed to be able to see complete test and individual benchmark results and allow comparison to other geekbench'd systems. The claim URL to add the Geekbench result to your Geekbench profile is written to a file in the directory that this script is executed from. By default, Geekbench 6 is the only Geekbench test performed, however, Geekbench 4 and/or 5 can also be toggled on by passing the appropriate flag. ### Security Notice @@ -76,82 +95,96 @@ This script relies on external binaries in order to complete the performance tes ``` # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # Yet-Another-Bench-Script # -# v2020-09-21 # +# v2023-04-23 # # https://github.com/masonr/yet-another-bench-script # # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # -Mon 21 Sep 2020 12:31:13 AM EDT +Sun 23 Apr 2023 01:41:14 PM EDT Basic System Information: --------------------------------- +Uptime : 342 days, 18 hours, 35 minutes Processor : Intel(R) Xeon(R) E-2276G CPU @ 3.80GHz -CPU cores : 12 @ 800.087 MHz +CPU cores : 12 @ 4693.667 MHz AES-NI : ✔ Enabled VM-x/AMD-V : ✔ Enabled -RAM : 15Gi -Swap : 14Gi -Disk : 865G +RAM : 15.5 GiB +Swap : 14.9 GiB +Disk : 864.5 GiB +Distro : Ubuntu 20.04.6 LTS +Kernel : 5.4.0-110-generic +VM Type : NONE +IPv4/IPv6 : ✔ Online / ✔ Online + +IPv6 Network Information: +--------------------------------- +ISP : Clouvider Limited +ASN : AS62240 Clouvider +Host : USA Network +Location : New York, New York (NY) +Country : United States fio Disk Speed Tests (Mixed R/W 50/50): --------------------------------- Block Size | 4k (IOPS) | 64k (IOPS) ------ | --- ---- | ---- ---- -Read | 445.04 MB/s (111.2k) | 475.05 MB/s (7.4k) -Write | 446.22 MB/s (111.5k) | 477.55 MB/s (7.4k) -Total | 891.26 MB/s (222.8k) | 952.60 MB/s (14.8k) +Read | 405.41 MB/s (101.3k) | 407.96 MB/s (6.3k) +Write | 406.48 MB/s (101.6k) | 410.11 MB/s (6.4k) +Total | 811.90 MB/s (202.9k) | 818.08 MB/s (12.7k) | | Block Size | 512k (IOPS) | 1m (IOPS) ------ | --- ---- | ---- ---- -Read | 474.42 MB/s (926) | 472.32 MB/s (461) -Write | 499.63 MB/s (975) | 503.77 MB/s (491) -Total | 974.05 MB/s (1.9k) | 976.10 MB/s (952) +Read | 380.21 MB/s (742) | 394.55 MB/s (385) +Write | 400.41 MB/s (782) | 420.82 MB/s (410) +Total | 780.62 MB/s (1.5k) | 815.37 MB/s (795) iperf3 Network Speed Tests (IPv4): --------------------------------- -Provider | Location (Link) | Send Speed | Recv Speed - | | | -Clouvider | London, UK (10G) | 1.19 Gbits/sec | 2.39 Gbits/sec -Online.net | Paris, FR (10G) | 2.35 Gbits/sec | 2.04 Gbits/sec -WorldStream | The Netherlands (10G) | 2.17 Gbits/sec | 1.29 Gbits/sec -Wifx | Zurich, CH (10G) | 1.28 Gbits/sec | 522 Mbits/sec -Biznet | Jakarta, Indonesia (1G) | 19.4 Mbits/sec | 41.8 Mbits/sec -Clouvider | NYC, NY, US (10G) | 9.40 Gbits/sec | 9.41 Gbits/sec -Velocity Online | Tallahassee, FL, US (10G) | 2.39 Gbits/sec | 2.94 Gbits/sec -Clouvider | Los Angeles, CA, US (10G) | 2.40 Gbits/sec | 2.89 Gbits/sec -Iveloz Telecom | Sao Paulo, BR (2G) | 136 Mbits/sec | 192 Mbits/sec +Provider | Location (Link) | Send Speed | Recv Speed | Ping +----- | ----- | ---- | ---- | ---- +Clouvider | London, UK (10G) | 1.61 Gbits/sec | 2.39 Gbits/sec | 77.5 ms +Scaleway | Paris, FR (10G) | busy | 2.25 Gbits/sec | 83.3 ms +Clouvider | NYC, NY, US (10G) | 9.10 Gbits/sec | 8.85 Gbits/sec | 1.21 ms iperf3 Network Speed Tests (IPv6): --------------------------------- -Provider | Location (Link) | Send Speed | Recv Speed - | | | -Clouvider | London, UK (10G) | 803 Mbits/sec | 2.09 Gbits/sec -Online.net | Paris, FR (10G) | 2.32 Gbits/sec | 2.20 Gbits/sec -WorldStream | The Netherlands (10G) | 1.95 Gbits/sec | 1.49 Gbits/sec -Wifx | Zurich, CH (10G) | 168 Mbits/sec | 579 Mbits/sec -Clouvider | NYC, NY, US (10G) | 9.28 Gbits/sec | 9.28 Gbits/sec -Clouvider | Los Angeles, CA, US (10G) | 2.80 Gbits/sec | 2.90 Gbits/sec +Provider | Location (Link) | Send Speed | Recv Speed | Ping +----- | ----- | ---- | ---- | ---- +Clouvider | London, UK (10G) | 2.00 Gbits/sec | 21.1 Mbits/sec | 76.7 ms +Scaleway | Paris, FR (10G) | 2.66 Gbits/sec | 1.56 Gbits/sec | 75.9 ms +Clouvider | NYC, NY, US (10G) | 3.42 Gbits/sec | 7.80 Gbits/sec | 1.15 ms Geekbench 4 Benchmark Test: --------------------------------- Test | Value | -Single Core | 6035 -Multi Core | 24473 -Full Test | https://browser.geekbench.com/v4/cpu/15770150 +Single Core | 5949 +Multi Core | 23425 +Full Test | https://browser.geekbench.com/v4/cpu/16746501 Geekbench 5 Benchmark Test: --------------------------------- Test | Value | -Single Core | 1348 -Multi Core | 5857 -Full Test | https://browser.geekbench.com/v5/cpu/3844555 +Single Core | 1317 +Multi Core | 5529 +Full Test | https://browser.geekbench.com/v5/cpu/21102444 + +Geekbench 6 Benchmark Test: +--------------------------------- +Test | Value + | +Single Core | 1549 +Multi Core | 5278 +Full Test | https://browser.geekbench.com/v6/cpu/1021916 + +YABS completed in 12 min 49 sec ``` ## Acknowledgements -This script was inspired by several great benchmarking scripts out there, including, but not limited to, [bench.sh](https://bench.sh/), [nench.sh](https://github.com/n-st/nench), [ServerBench](https://github.com/K4Y5/ServerBench), among others. Members of the [HostedTalk](https://hostedtalk.net), [LowEndSpirit](https://talk.lowendspirit.com), and [LowEndTalk](https://www.lowendtalk.com) hosting-related communities play a pivotal role in testing, evaluating, and shaping this script as it matures. +This script was inspired by several great benchmarking scripts out there, including, but not limited to, [bench.sh](https://bench.sh/), [nench.sh](https://github.com/n-st/nench), [ServerBench](https://github.com/K4Y5/ServerBench), among others. Members of the [HostBalls](https://hostballs.com), [LowEndSpirit](https://lowendspirit.com), and [LowEndTalk](https://lowendtalk.com) hosting-related communities play a pivotal role in testing, evaluating, and shaping this script as it matures. ## License ``` diff --git a/bin/README.md b/bin/README.md index 2b351bf..f561a46 100644 --- a/bin/README.md +++ b/bin/README.md @@ -4,20 +4,18 @@ This directory contains all of the binaries required to run the benchmarking tes ### Binaries -| Binary Name | Version | Compile Date | Architecture | OS | -|:-:|:-:|:-:|:-:|:-:| -| fio_x64 | 3.31 | 19-AUG-2022 | x86_64 | 64-bit | -| fio_x86 | 3.30* | 19-AUG-2022 | x86 | 32-bit | -| fio_aarch64 | 3.31 | 19-AUG-2022 | ARM | 64-bit | -| fio_arm | 3.31 | 19-AUG-2022 | ARM | 32-bit | -| iperf_x64 | 3.11 | 19-AUG-2022 | x86_64 | 64-bit | -| iperf_x86 | 3.11 | 19-AUG-2022 | x86 | 32-bit | -| iperf_aarch64 | 3.11 | 19-AUG-2022 | ARM | 64-bit | -| iperf_arm | 3.11 | 19-AUG-2022 | ARM | 32-bit | +| Binary Name | Version | Compile Date | Architecture | OS | SHA-256 Hash
(VirusTotal Scan) | +|:-:|:-:|:-:|:-:|:-:|:-:| +| fio_x64 | 3.36 | 20-OCT-2023 | x86_64 | 64-bit | [5d345d0](https://www.virustotal.com/gui/file/5d345d0eac6da12753c5296d86393cec046d1a7e5794594aa62127a19001ce30) | +| fio_x86 | 3.36 | 20-OCT-2023 | i686 | 32-bit | [82aa945](https://www.virustotal.com/gui/file/82aa94592e3498c8a84e6563e070d61a40f7ac385a846c752e6f22f941c10d20) | +| fio_aarch64 | 3.36 | 20-OCT-2023 | ARM (aarch64) | 64-bit | [52d02cb](https://www.virustotal.com/gui/file/52d02cb20959ac488b2369a6fdaad421211619c309deb1d7a795279242a30b22) | +| fio_arm | 3.36 | 20-OCT-2023 | ARM | 32-bit | [b84c3de](https://www.virustotal.com/gui/file/b84c3de74eec4073b7770569937ddbcaef3dc5c33c0e03401694ff277494e745) | +| iperf_x64 | 3.15 | 20-OCT-2023 | x86_64 | 64-bit | [d713ce4](https://www.virustotal.com/gui/file/d713ce4ecc83bfae34c822e7d725c9fdc3a32ea68633a25e11142202974c09a1) | +| iperf_x86 | 3.15 | 20-OCT-2023 | i686 | 32-bit | [dd3d22b](https://www.virustotal.com/gui/file/dd3d22b5b83a8af74b3af1f6bb492bef890e6ebd363ad2f1584780429e4bb24d) | +| iperf_aarch64 | 3.15 | 20-OCT-2023 | ARM (aarch64) | 64-bit | [d223f5f](https://www.virustotal.com/gui/file/d223f5fac4ce1c68b57ae9c12f038d593922a509786477ec18deb0bf52cce8bc) | +| iperf_arm | 3.15 | 20-OCT-2023 | ARM | 32-bit | [310e80f](https://www.virustotal.com/gui/file/310e80f442dda47fa0fe41225af85e8b91e75116dce5187f123380fd3c3c85a8) | -Note: ARM compatibility is considered experimental. Static binaries for ARM-based machines are cross-compiled within a Holy Build Box container using the [musl toolchain](https://musl.cc/). - -\* fio v3.31 is failing to build in a 32-bit environment +Note: ARM compatibility is considered experimental. Static binaries for 32-bit and ARM-based machines are cross-compiled within a Holy Build Box container using the [musl toolchain](https://musl.cc/). ### Compile Notes @@ -30,28 +28,28 @@ Note: ARM compatibility is considered experimental. Static binaries for ARM-base docker run -t -i --rm -v `pwd`:/io phusion/holy-build-box-64:latest bash /io/compile.sh ``` -**Compiling 32-bit binaries**: +64-bit binaries will be placed in the current directory. -```sh -docker run -t -i --rm -v `pwd`:/io phusion/holy-build-box-32:latest linux32 bash /io/compile.sh -``` - -64-bit and 32-bit binaries will be placed in the current directory. - -### ARM Compile Notes +### Cross-compiling Notes Compilation of ARM-compatible binaries requires additional environment variables to identify the proper musl toolchain and architecture to target for cross-compilation. -**Compiling 64-bit binaries**: - -```sh -docker run -t -i --rm -v `pwd`:/io --env ARCH=aarch64 --env CROSS=aarch64-linux-musl --env HOST=aarch64-linux-gnu phusion/holy-build-box-64:latest bash /io/compile-arm.sh -``` - **Compiling 32-bit binaries**: ```sh -docker run -t -i --rm -v `pwd`:/io --env ARCH=arm --env CROSS=arm-linux-musleabihf --env HOST=arm-linux-gnueabihf phusion/holy-build-box-64:latest bash /io/compile-arm.sh +docker run -t -i --rm -v `pwd`:/io --env ARCH=x86 --env CROSS=i686-linux-musl --env HOST=i686-linux-musl phusion/holy-build-box-64:latest bash /io/cross-compile.sh ``` -64-bit (aarch64) and 32-bit (arm) binaries will be placed in the current directory. +**Compiling ARM 64-bit binaries**: + +```sh +docker run -t -i --rm -v `pwd`:/io --env ARCH=aarch64 --env CROSS=aarch64-linux-musl --env HOST=aarch64-linux-gnu phusion/holy-build-box-64:latest bash /io/cross-compile.sh +``` + +**Compiling ARM 32-bit binaries**: + +```sh +docker run -t -i --rm -v `pwd`:/io --env ARCH=arm --env CROSS=arm-linux-musleabihf --env HOST=arm-linux-gnueabihf phusion/holy-build-box-64:latest bash /io/cross-compile.sh +``` + +64-bit (aarch64) and 32-bit (x86, arm) binaries will be placed in the current directory. diff --git a/bin/compile.sh b/bin/compile.sh index b57565d..53cedf1 100755 --- a/bin/compile.sh +++ b/bin/compile.sh @@ -35,7 +35,7 @@ source /hbb_exe/activate # download and compile fio cd ~ -curl -L https://github.com/axboe/fio/archive/fio-3.31.tar.gz -o "fio.tar.gz" +curl -L https://github.com/axboe/fio/archive/fio-3.36.tar.gz -o "fio.tar.gz" tar xf fio.tar.gz cd fio-fio* ./configure --disable-native @@ -48,7 +48,7 @@ cp fio /io/fio_$ARCH # download and compile iperf cd ~ -curl -L https://github.com/esnet/iperf/archive/3.11.tar.gz -o "iperf.tar.gz" +curl -L https://github.com/esnet/iperf/archive/3.15.tar.gz -o "iperf.tar.gz" tar xf iperf.tar.gz cd iperf* ./configure --disable-shared --disable-profiling diff --git a/bin/compile-arm.sh b/bin/cross-compile.sh similarity index 91% rename from bin/compile-arm.sh rename to bin/cross-compile.sh index 602faed..c36c06f 100755 --- a/bin/compile-arm.sh +++ b/bin/cross-compile.sh @@ -26,7 +26,7 @@ source /hbb_exe/activate # download and compile fio cd ~ -curl -L https://github.com/axboe/fio/archive/fio-3.31.tar.gz -o "fio.tar.gz" +curl -L https://github.com/axboe/fio/archive/fio-3.36.tar.gz -o "fio.tar.gz" tar xf fio.tar.gz cd fio-fio* CC=/root/${CROSS}-cross/bin/${CROSS}-gcc ./configure --disable-native --build-static @@ -39,7 +39,7 @@ cp fio /io/fio_$ARCH # download and compile iperf cd ~ -curl -L https://github.com/esnet/iperf/archive/3.11.tar.gz -o "iperf.tar.gz" +curl -L https://github.com/esnet/iperf/archive/3.15.tar.gz -o "iperf.tar.gz" tar xf iperf.tar.gz cd iperf* CC=/root/${CROSS}-cross/bin/${CROSS}-gcc ./configure --disable-shared --disable-profiling --build x86_64-pc-linux-gnu --host ${HOST} --with-openssl=no --enable-static-bin diff --git a/bin/example.json b/bin/example.json index 8da17af..9ca1ca4 100644 --- a/bin/example.json +++ b/bin/example.json @@ -1,89 +1,141 @@ { - "version": "v2022-08-17", - "time": "20220817-035033", + "version": "v2023-04-23", + "time": "20230423-134114", "os": { "arch": "x64", - "distro": "Ubuntu 20.04.4 LTS", - "kernel": "5.4.0-120-generic", - "uptime": 4089127.72 + "distro": "Ubuntu 20.04.6 LTS", + "kernel": "5.4.0-110-generic", + "uptime": 29615719.72, + "vm": "NONE" }, "net": { "ipv4": true, - "ipv6": false + "ipv6": true }, "cpu": { - "model": "Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz", + "model": "Intel(R) Xeon(R) E-2276G CPU @ 3.80GHz", "cores": 12, - "freq": "4000.089 MHz", + "freq": "4693.667 MHz", "aes": true, "virt": true }, "mem": { - "ram": 32720272, - "swap": 41904120, - "disk": 47170290544 + "ram": 16246580, + "ram_units": "KiB", + "swap": 15625212, + "swap_units": "KiB", + "disk": 906519496, + "disk_units": "KB" + }, + "ip_info": { + "protocol": "IPv6", + "isp": "Clouvider Limited", + "asn": "AS62240 Clouvider", + "org": "USA Network", + "city": "New York", + "region": "New York", + "region_code": "NY", + "country": "United States" }, "fio": [{ "bs": "4k", - "speed_r": 165590, - "iops_r": 41397, - "speed_w": 166027, - "iops_w": 41506, - "speed_rw": 331617, - "iops_rw": 82903 + "speed_r": 405417, + "iops_r": 101354, + "speed_w": 406487, + "iops_w": 101621, + "speed_rw": 811904, + "iops_rw": 202975, + "speed_units": "KBps" }, { "bs": "64k", - "speed_r": 198505, - "iops_r": 3101, - "speed_w": 199549, - "iops_w": 3117, - "speed_rw": 398054, - "iops_rw": 6218 + "speed_r": 407967, + "iops_r": 6374, + "speed_w": 410114, + "iops_w": 6408, + "speed_rw": 818081, + "iops_rw": 12782, + "speed_units": "KBps" }, { "bs": "512k", - "speed_r": 227239, - "iops_r": 443, - "speed_w": 239313, - "iops_w": 467, - "speed_rw": 466552, - "iops_rw": 910 + "speed_r": 380212, + "iops_r": 742, + "speed_w": 400413, + "iops_w": 782, + "speed_rw": 780625, + "iops_rw": 1524, + "speed_units": "KBps" }, { "bs": "1m", - "speed_r": 238296, - "iops_r": 232, - "speed_w": 254166, - "iops_w": 248, - "speed_rw": 492462, - "iops_rw": 480 + "speed_r": 394550, + "iops_r": 385, + "speed_w": 420827, + "iops_w": 410, + "speed_rw": 815377, + "iops_rw": 795, + "speed_units": "KBps" }], "iperf": [{ "mode": "IPv4", "provider": "Clouvider", "loc": "London, UK (10G)", - "send": "122 Mbits/sec", - "recv": "58.5 Mbits/sec" + "send": "1.61 Gbits/sec", + "recv": "2.39 Gbits/sec", + "latency": "77.5 ms" }, { "mode": "IPv4", - "provider": "Online.net", + "provider": "Scaleway", "loc": "Paris, FR (10G)", - "send": "111 Mbits/sec", - "recv": "busy " + "send": "busy ", + "recv": "2.25 Gbits/sec", + "latency": "83.3 ms" }, { "mode": "IPv4", "provider": "Clouvider", "loc": "NYC, NY, US (10G)", - "send": "129 Mbits/sec", - "recv": "107 Mbits/sec" + "send": "9.10 Gbits/sec", + "recv": "8.85 Gbits/sec", + "latency": "1.21 ms" + }, { + "mode": "IPv6", + "provider": "Clouvider", + "loc": "London, UK (10G)", + "send": "2.00 Gbits/sec", + "recv": "21.1 Mbits/sec", + "latency": "76.7 ms" + }, { + "mode": "IPv6", + "provider": "Scaleway", + "loc": "Paris, FR (10G)", + "send": "2.66 Gbits/sec", + "recv": "1.56 Gbits/sec", + "latency": "75.9 ms" + }, { + "mode": "IPv6", + "provider": "Clouvider", + "loc": "NYC, NY, US (10G)", + "send": "3.42 Gbits/sec", + "recv": "7.80 Gbits/sec", + "latency": "1.15 ms" }], "geekbench": [{ "version": 4, - "single": 5443, - "multi": 24535, - "url": "https://browser.geekbench.com/v4/cpu/16603522" + "single": 5949, + "multi": 23425, + "url": "https://browser.geekbench.com/v4/cpu/16746501" }, { "version": 5, - "single": 1157, - "multi": 5908, - "url": "https://browser.geekbench.com/v5/cpu/16679843" - }] + "single": 1317, + "multi": 5529, + "url": "https://browser.geekbench.com/v5/cpu/21102444" + }, { + "version": 6, + "single": 1549, + "multi": 5278, + "url": "https://browser.geekbench.com/v6/cpu/1021916" + }], + "runtime": { + "start": 1682271674, + "end": 1682272443, + "elapsed": 769 + } } diff --git a/bin/fio/fio_aarch64 b/bin/fio/fio_aarch64 index 63177b7..0bb764b 100755 Binary files a/bin/fio/fio_aarch64 and b/bin/fio/fio_aarch64 differ diff --git a/bin/fio/fio_arm b/bin/fio/fio_arm index f2bcd59..78b5a95 100755 Binary files a/bin/fio/fio_arm and b/bin/fio/fio_arm differ diff --git a/bin/fio/fio_x64 b/bin/fio/fio_x64 index 2cfcdd5..f444fcc 100755 Binary files a/bin/fio/fio_x64 and b/bin/fio/fio_x64 differ diff --git a/bin/fio/fio_x86 b/bin/fio/fio_x86 index ab59b5f..7b040f5 100755 Binary files a/bin/fio/fio_x86 and b/bin/fio/fio_x86 differ diff --git a/bin/iperf/iperf3_aarch64 b/bin/iperf/iperf3_aarch64 index 76751bc..5119a41 100755 Binary files a/bin/iperf/iperf3_aarch64 and b/bin/iperf/iperf3_aarch64 differ diff --git a/bin/iperf/iperf3_arm b/bin/iperf/iperf3_arm index 375b3e9..4c64443 100755 Binary files a/bin/iperf/iperf3_arm and b/bin/iperf/iperf3_arm differ diff --git a/bin/iperf/iperf3_x64 b/bin/iperf/iperf3_x64 index fb17a73..e2aa5ac 100755 Binary files a/bin/iperf/iperf3_x64 and b/bin/iperf/iperf3_x64 differ diff --git a/bin/iperf/iperf3_x86 b/bin/iperf/iperf3_x86 index a28ea9b..70e22d8 100755 Binary files a/bin/iperf/iperf3_x86 and b/bin/iperf/iperf3_x86 differ diff --git a/yabs.sh b/yabs.sh old mode 100755 new mode 100644 index 244ac18..611919b --- a/yabs.sh +++ b/yabs.sh @@ -1,8 +1,8 @@ #!/bin/bash # Yet Another Bench Script by Mason Rowe -# Initial Oct 2019; Last update Aug 2022 -# +# Initial Oct 2019; Last update Sep 2023 + # Disclaimer: This project is a work in progress. Any errors or suggestions should be # relayed to me via the GitHub project page linked below. # @@ -11,8 +11,8 @@ # overall system performance via Geekbench 4/5, and random disk # performance via fio. The script is designed to not require any dependencies # - either compiled or installed - nor admin privileges to run. -# -YABS_VERSION="v2022-08-20" + +YABS_VERSION="v2023-09-06" echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #' echo -e '# Yet-Another-Bench-Script #' @@ -23,9 +23,10 @@ echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #' echo -e date TIME_START=$(date '+%Y%m%d-%H%M%S') +YABS_START_TIME=$(date +%s) # override locale to eliminate parsing errors (i.e. using commas as delimiters rather than periods) -if locale -a | grep ^C$ > /dev/null ; then +if locale -a 2>/dev/null | grep ^C$ > /dev/null; then # locale "C" installed export LC_ALL=C else @@ -42,7 +43,7 @@ elif [[ $ARCH = *i?86* ]]; then # host is running a 32-bit kernel ARCH="x86" elif [[ $ARCH = *aarch* || $ARCH = *arm* ]]; then - KERNEL_BIT=`getconf LONG_BIT` + KERNEL_BIT=$(getconf LONG_BIT) if [[ $KERNEL_BIT = *64* ]]; then # host is running an ARM 64-bit kernel ARCH="aarch64" @@ -58,21 +59,24 @@ else fi # flags to skip certain performance tests -unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE -GEEKBENCH_5="True" # gb5 test enabled by default +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 +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 'bfdighr49jw:s:' flag; do +while getopts 'bfdignhr4596jw:s:' flag; do case "${flag}" in b) PREFER_BIN="True" ;; f) SKIP_FIO="True" ;; d) SKIP_FIO="True" ;; i) SKIP_IPERF="True" ;; g) SKIP_GEEKBENCH="True" ;; + n) SKIP_NET="True" ;; h) PRINT_HELP="True" ;; r) REDUCE_NET="True" ;; - 4) GEEKBENCH_4="True" && unset GEEKBENCH_5 ;; - 9) GEEKBENCH_4="True" && GEEKBENCH_5="True" ;; + 4) GEEKBENCH_4="True" && unset GEEKBENCH_6 ;; + 5) GEEKBENCH_5="True" && unset GEEKBENCH_6 ;; + 9) GEEKBENCH_4="True" && GEEKBENCH_5="True" && unset GEEKBENCH_6 ;; + 6) GEEKBENCH_6="True" ;; j) JSON+="j" ;; w) JSON+="w" && JSON_FILE=${OPTARG} ;; s) JSON+="s" && JSON_SEND=${OPTARG} ;; @@ -84,6 +88,9 @@ done command -v fio >/dev/null 2>&1 && LOCAL_FIO=true || unset LOCAL_FIO command -v iperf3 >/dev/null 2>&1 && LOCAL_IPERF=true || unset LOCAL_IPERF +# check for ping +command -v ping >/dev/null 2>&1 && LOCAL_PING=true || unset LOCAL_PING + # check for curl/wget command -v curl >/dev/null 2>&1 && LOCAL_CURL=true || unset LOCAL_CURL @@ -110,13 +117,16 @@ if [ ! -z "$PRINT_HELP" ]; then echo -e " -f/d : skips the fio disk benchmark test" echo -e " -i : skips the iperf network test" echo -e " -g : skips the geekbench performance test" + echo -e " -n : skips the network information lookup and print out" echo -e " -h : prints this lovely message, shows any flags you passed," echo -e " shows if fio/iperf3 local packages have been detected," echo -e " then exits" echo -e " -r : reduce number of iperf3 network locations (to only three)" echo -e " to lessen bandwidth usage" - echo -e " -4 : use geekbench 4 instead of geekbench 5" - echo -e " -9 : use both geekbench 4 AND geekbench 5" + echo -e " -4 : use geekbench 4 instead of geekbench 6" + echo -e " -5 : use geekbench 5 instead of geekbench 6" + echo -e " -9 : use both geekbench 4 AND geekbench 5 instead of geekbench 6" + echo -e " -6 : user geekbench 6 in addition to 4 and/or 5 (only needed if -4, -5, or -9 are set; -6 must come last)" echo -e " -j : print jsonified YABS results at conclusion of test" echo -e " -w : write jsonified YABS results to disk using file name provided" echo -e " -s : send jsonified YABS results to URL" @@ -128,9 +138,11 @@ if [ ! -z "$PRINT_HELP" ]; then [[ ! -z $SKIP_FIO ]] && echo -e " -f/d, skipping fio disk benchmark test" [[ ! -z $SKIP_IPERF ]] && echo -e " -i, skipping iperf network test" [[ ! -z $SKIP_GEEKBENCH ]] && echo -e " -g, skipping geekbench test" + [[ ! -z $SKIP_NET ]] && echo -e " -n, skipping network info lookup and print out" [[ ! -z $REDUCE_NET ]] && echo -e " -r, using reduced (3) iperf3 locations" [[ ! -z $GEEKBENCH_4 ]] && echo -e " running geekbench 4" [[ ! -z $GEEKBENCH_5 ]] && echo -e " running geekbench 5" + [[ ! -z $GEEKBENCH_6 ]] && echo -e " running geekbench 6" echo -e echo -e "Local Binary Check:" [[ -z $LOCAL_FIO ]] && echo -e " fio not detected, will download precompiled binary" || @@ -238,20 +250,94 @@ DISTRO=$(grep 'PRETTY_NAME' /etc/os-release | cut -d '"' -f 2 ) echo -e "Distro : $DISTRO" KERNEL=$(uname -r) echo -e "Kernel : $KERNEL" +VIRT=$(systemd-detect-virt 2>/dev/null) +VIRT=${VIRT^^} || VIRT="UNKNOWN" +echo -e "VM Type : $VIRT" +[[ -z "$IPV4_CHECK" ]] && ONLINE="\xE2\x9D\x8C Offline / " || ONLINE="\xE2\x9C\x94 Online / " +[[ -z "$IPV6_CHECK" ]] && ONLINE+="\xE2\x9D\x8C Offline" || ONLINE+="\xE2\x9C\x94 Online" +echo -e "IPv4/IPv6 : $ONLINE" + +# Function to get information from IP Address using ip-api.com free API +function ip_info() { + # check for curl vs wget + [[ ! -z $LOCAL_CURL ]] && DL_CMD="curl -s" || DL_CMD="wget -qO-" + + local ip6me_resp="$($DL_CMD http://ip6.me/api/)" + local net_type="$(echo $ip6me_resp | cut -d, -f1)" + local net_ip="$(echo $ip6me_resp | cut -d, -f2)" + + local response=$($DL_CMD http://ip-api.com/json/$net_ip) + + # if no response, skip output + if [[ -z $response ]]; then + return + fi + + local country=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^country/ {print $2}' | head -1) + country=${country//\"} + + local region=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^regionName/ {print $2}') + region=${region//\"} + + local region_code=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^region/ {print $2}' | head -1) + region_code=${region_code//\"} + + local city=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^city/ {print $2}') + city=${city//\"} + + local isp=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^isp/ {print $2}') + isp=${isp//\"} + + local org=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^org/ {print $2}') + org=${org//\"} + + local as=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^as/ {print $2}') + as=${as//\"} + + echo + echo "$net_type Network Information:" + echo "---------------------------------" + + if [[ -n "$isp" ]]; then + echo "ISP : $isp" + else + echo "ISP : Unknown" + fi + if [[ -n "$as" ]]; then + echo "ASN : $as" + else + echo "ASN : Unknown" + fi + if [[ -n "$org" ]]; then + echo "Host : $org" + fi + if [[ -n "$city" && -n "$region" ]]; then + echo "Location : $city, $region ($region_code)" + fi + if [[ -n "$country" ]]; then + echo "Country : $country" + fi + + [[ ! -z $JSON ]] && JSON_RESULT+=',"ip_info":{"protocol":"'$net_type'","isp":"'$isp'","asn":"'$as'","org":"'$org'","city":"'$city'","region":"'$region'","region_code":"'$region_code'","country":"'$country'"}' +} if [ ! -z $JSON ]; then UPTIME_S=$(awk '{print $1}' /proc/uptime) IPV4=$([ ! -z $IPV4_CHECK ] && echo "true" || echo "false") IPV6=$([ ! -z $IPV6_CHECK ] && echo "true" || echo "false") AES=$([[ "$CPU_AES" = *Enabled* ]] && echo "true" || echo "false") - VIRT=$([[ "$CPU_VIRT" = *Enabled* ]] && echo "true" || echo "false") + CPU_VIRT_BOOL=$([[ "$CPU_VIRT" = *Enabled* ]] && echo "true" || echo "false") JSON_RESULT='{"version":"'$YABS_VERSION'","time":"'$TIME_START'","os":{"arch":"'$ARCH'","distro":"'$DISTRO'","kernel":"'$KERNEL'",' - JSON_RESULT+='"uptime":'$UPTIME_S'},"net":{"ipv4":'$IPV4',"ipv6":'$IPV6'},"cpu":{"model":"'$CPU_PROC'","cores":'$CPU_CORES',' - JSON_RESULT+='"freq":"'$CPU_FREQ'","aes":'$AES',"virt":'$VIRT'},"mem":{"ram":'$TOTAL_RAM_RAW',"swap":'$TOTAL_SWAP_RAW',"disk":'$TOTAL_DISK_RAW'}' + JSON_RESULT+='"uptime":'$UPTIME_S',"vm":"'$VIRT'"},"net":{"ipv4":'$IPV4',"ipv6":'$IPV6'},"cpu":{"model":"'$CPU_PROC'","cores":'$CPU_CORES',' + JSON_RESULT+='"freq":"'$CPU_FREQ'","aes":'$AES',"virt":'$CPU_VIRT_BOOL'},"mem":{"ram":'$TOTAL_RAM_RAW',"ram_units":"KiB","swap":'$TOTAL_SWAP_RAW',"swap_units":"KiB","disk":'$TOTAL_DISK_RAW',"disk_units":"KB"}' +fi + +if [ -z $SKIP_NET ]; then + ip_info fi # create a directory in the same location that the script is being run to temporarily store YABS-related files -DATE=`date -Iseconds | sed -e "s/:/_/g"` +DATE=$(date -Iseconds | sed -e "s/:/_/g") YABS_PATH=./$DATE touch $DATE.test 2> /dev/null # test if the user has write permissions in the current directory and exit if not @@ -425,7 +511,7 @@ function dd_test { } # check if disk performance is being tested and the host has required space (2G) -AVAIL_SPACE=`df -k . | awk 'NR==2{print $4}'` +AVAIL_SPACE=$(df -k . | awk 'NR==2{print $4}') if [[ -z "$SKIP_FIO" && "$AVAIL_SPACE" -lt 2097152 && "$ARCH" != "aarch64" && "$ARCH" != "arm" ]]; then # 2GB = 2097152KB echo -e "\nLess than 2GB of space available. Skipping disk test..." elif [[ -z "$SKIP_FIO" && "$AVAIL_SPACE" -lt 524288 && ("$ARCH" = "aarch64" || "$ARCH" = "arm") ]]; then # 512MB = 524288KB @@ -567,10 +653,10 @@ elif [ -z "$SKIP_FIO" ]; then if [ ! -z $JSON ]; then JSON_RESULT+='{"bs":"'${BLOCK_SIZES[DISK_COUNT]}'","speed_r":'${DISK_RESULTS_RAW[DISK_COUNT*6+1]}',"iops_r":'${DISK_RESULTS_RAW[DISK_COUNT*6+4]} JSON_RESULT+=',"speed_w":'${DISK_RESULTS_RAW[DISK_COUNT*6+2]}',"iops_w":'${DISK_RESULTS_RAW[DISK_COUNT*6+5]}',"speed_rw":'${DISK_RESULTS_RAW[DISK_COUNT*6]} - JSON_RESULT+=',"iops_rw":'${DISK_RESULTS_RAW[DISK_COUNT*6+3]}'},' + JSON_RESULT+=',"iops_rw":'${DISK_RESULTS_RAW[DISK_COUNT*6+3]}',"speed_units":"KBps"},' JSON_RESULT+='{"bs":"'${BLOCK_SIZES[DISK_COUNT+1]}'","speed_r":'${DISK_RESULTS_RAW[(DISK_COUNT+1)*6+1]}',"iops_r":'${DISK_RESULTS_RAW[(DISK_COUNT+1)*6+4]} JSON_RESULT+=',"speed_w":'${DISK_RESULTS_RAW[(DISK_COUNT+1)*6+2]}',"iops_w":'${DISK_RESULTS_RAW[(DISK_COUNT+1)*6+5]}',"speed_rw":'${DISK_RESULTS_RAW[(DISK_COUNT+1)*6]} - JSON_RESULT+=',"iops_rw":'${DISK_RESULTS_RAW[(DISK_COUNT+1)*6+3]}'},' + JSON_RESULT+=',"iops_rw":'${DISK_RESULTS_RAW[(DISK_COUNT+1)*6+3]}',"speed_units":"KBps"},' fi DISK_COUNT=$(expr $DISK_COUNT + 2) done @@ -600,7 +686,7 @@ function iperf_test { do echo -en "Performing $MODE iperf3 send test to $HOST (Attempt #$I of 3)..." # select a random iperf port from the range provided - PORT=`shuf -i $PORTS -n 1` + PORT=$(shuf -i $PORTS -n 1) # run the iperf test sending data from the host to the iperf server; includes # a timeout of 15s in case the iperf server is not responding; uses 8 parallel # threads for the network test @@ -628,7 +714,7 @@ function iperf_test { do echo -n "Performing $MODE iperf3 recv test from $HOST (Attempt #$J of 3)..." # select a random iperf port from the range provided - PORT=`shuf -i $PORTS -n 1` + PORT=$(shuf -i $PORTS -n 1) # run the iperf test receiving data from the iperf server to the host; includes # a timeout of 15s in case the iperf server is not responding; uses 8 parallel # threads for the network test @@ -645,10 +731,15 @@ function iperf_test { fi echo -en "\r\033[0K" done + + # Run a latency test via ping -c1 command -> will return "xx.x ms" + [[ ! -z $LOCAL_PING ]] && LATENCY_RUN="$(ping -c1 $URL 2>/dev/null | grep -o 'time=.*' | sed s/'time='//)" + [[ -z $LATENCY_RUN ]] && LATENCY_RUN="--" # parse the resulting send and receive speed results IPERF_SENDRESULT="$(echo "${IPERF_RUN_SEND}" | grep SUM | grep receiver)" IPERF_RECVRESULT="$(echo "${IPERF_RUN_RECV}" | grep SUM | grep receiver)" + LATENCY_RESULT="$(echo "${LATENCY_RUN}")" } # launch_iperf @@ -664,8 +755,8 @@ function launch_iperf { echo -e echo -e "iperf3 Network Speed Tests ($MODE):" echo -e "---------------------------------" - printf "%-15s | %-25s | %-15s | %-15s\n" "Provider" "Location (Link)" "Send Speed" "Recv Speed" - printf "%-15s | %-25s | %-15s | %-15s\n" + printf "%-15s | %-25s | %-15s | %-15s | %-15s\n" "Provider" "Location (Link)" "Send Speed" "Recv Speed" "Ping" + printf "%-15s | %-25s | %-15s | %-15s | %-15s\n" "-----" "-----" "----" "----" "----" # loop through iperf locations array to run iperf test using each public iperf server for (( i = 0; i < IPERF_LOCS_NUM; i++ )); do @@ -678,14 +769,15 @@ function launch_iperf { IPERF_SENDRESULT_UNIT=$(echo $IPERF_SENDRESULT | awk '{ print $7 }') IPERF_RECVRESULT_VAL=$(echo $IPERF_RECVRESULT | awk '{ print $6 }') IPERF_RECVRESULT_UNIT=$(echo $IPERF_RECVRESULT | awk '{ print $7 }') + LATENCY_VAL=$(echo $LATENCY_RESULT) # if the results are blank, then the server is "busy" and being overutilized [[ -z $IPERF_SENDRESULT_VAL || "$IPERF_SENDRESULT_VAL" == *"0.00"* ]] && IPERF_SENDRESULT_VAL="busy" && IPERF_SENDRESULT_UNIT="" [[ -z $IPERF_RECVRESULT_VAL || "$IPERF_RECVRESULT_VAL" == *"0.00"* ]] && IPERF_RECVRESULT_VAL="busy" && IPERF_RECVRESULT_UNIT="" # print the speed results for the iperf location currently being evaluated - printf "%-15s | %-25s | %-15s | %-15s\n" "${IPERF_LOCS[i*5+2]}" "${IPERF_LOCS[i*5+3]}" "$IPERF_SENDRESULT_VAL $IPERF_SENDRESULT_UNIT" "$IPERF_RECVRESULT_VAL $IPERF_RECVRESULT_UNIT" + printf "%-15s | %-25s | %-15s | %-15s | %-15s\n" "${IPERF_LOCS[i*5+2]}" "${IPERF_LOCS[i*5+3]}" "$IPERF_SENDRESULT_VAL $IPERF_SENDRESULT_UNIT" "$IPERF_RECVRESULT_VAL $IPERF_RECVRESULT_UNIT" "$LATENCY_VAL" if [ ! -z $JSON ]; then JSON_RESULT+='{"mode":"'$MODE'","provider":"'${IPERF_LOCS[i*5+2]}'","loc":"'${IPERF_LOCS[i*5+3]} - JSON_RESULT+='","send":"'$IPERF_SENDRESULT_VAL' '$IPERF_SENDRESULT_UNIT'","recv":"'$IPERF_RECVRESULT_VAL' '$IPERF_RECVRESULT_UNIT'"},' + JSON_RESULT+='","send":"'$IPERF_SENDRESULT_VAL' '$IPERF_SENDRESULT_UNIT'","recv":"'$IPERF_RECVRESULT_VAL' '$IPERF_RECVRESULT_UNIT'","latency":"'$LATENCY_VAL'"},' fi fi done @@ -725,13 +817,13 @@ if [ -z "$SKIP_IPERF" ]; then # 5. network modes supported by the iperf server (IPv4 = IPv4-only, IPv4|IPv6 = IPv4 + IPv6, etc.) IPERF_LOCS=( \ "lon.speedtest.clouvider.net" "5200-5209" "Clouvider" "London, UK (10G)" "IPv4|IPv6" \ - "ping.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv4" \ - "ping6.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv6" \ - "speedtest-nl-oum.hybula.net" "5201-5206" "Hybula" "The Netherlands (40G)" "IPv4|IPv6" \ + "ping.online.net" "5200-5209" "Scaleway" "Paris, FR (10G)" "IPv4" \ + "ping6.online.net" "5200-5209" "Scaleway" "Paris, FR (10G)" "IPv6" \ + "speedtest.novoserve.com" "5201-5206" "NovoServe" "North Holland, NL (40G)" "IPv4|IPv6" \ "speedtest.uztelecom.uz" "5200-5207" "Uztelecom" "Tashkent, UZ (10G)" "IPv4|IPv6" \ "nyc.speedtest.clouvider.net" "5200-5209" "Clouvider" "NYC, NY, US (10G)" "IPv4|IPv6" \ "dal.speedtest.clouvider.net" "5200-5209" "Clouvider" "Dallas, TX, US (10G)" "IPv4|IPv6" \ - "la.speedtest.clouvider.net" "5200-5209" "Clouvider" "Los Angeles, CA, US (10G)" "IPv4|IPv6" \ + "la.speedtest.clouvider.net" "5200-5209" "Clouvider" "Los Angeles, CA, US (10G)" "IPv4|IPv6" ) # if the "REDUCE_NET" flag is activated, then do a shorter iperf test with only three locations @@ -739,8 +831,8 @@ if [ -z "$SKIP_IPERF" ]; then if [ ! -z "$REDUCE_NET" ]; then IPERF_LOCS=( \ "lon.speedtest.clouvider.net" "5200-5209" "Clouvider" "London, UK (10G)" "IPv4|IPv6" \ - "ping.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv4" \ - "ping6.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv6" \ + "ping.online.net" "5200-5209" "Scaleway" "Paris, FR (10G)" "IPv4" \ + "ping6.online.net" "5200-5209" "Scaleway" "Paris, FR (10G)" "IPv6" \ "nyc.speedtest.clouvider.net" "5200-5209" "Clouvider" "NYC, NY, US (10G)" "IPv4|IPv6" \ ) fi @@ -772,98 +864,100 @@ function launch_geekbench { GEEKBENCH_PATH=$YABS_PATH/geekbench_$VERSION mkdir -p $GEEKBENCH_PATH + GB_URL="" + GB_CMD="" + GB_RUN="" + # check for curl vs wget [[ ! -z $LOCAL_CURL ]] && DL_CMD="curl -s" || DL_CMD="wget -qO-" if [[ $VERSION == *4* && ($ARCH = *aarch64* || $ARCH = *arm*) ]]; then - echo -e "\nARM architecture not supported by Geekbench 4, use Geekbench 5." + echo -e "\nARM architecture not supported by Geekbench 4, use Geekbench 5 or 6." elif [[ $VERSION == *4* && $ARCH != *aarch64* && $ARCH != *arm* ]]; then # Geekbench v4 - echo -en "\nRunning GB4 benchmark test... *cue elevator music*" - # download the latest Geekbench 4 tarball and extract to geekbench temp directory - $DL_CMD https://cdn.geekbench.com/Geekbench-4.4.4-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null - - if [[ "$ARCH" == *"x86"* ]]; then - # check if geekbench file exists - if test -f "geekbench.license"; then - $GEEKBENCH_PATH/geekbench_x86_32 --unlock `cat geekbench.license` > /dev/null 2>&1 - fi - - # run the Geekbench 4 test and grep the test results URL given at the end of the test - GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench_x86_32 --upload 2>/dev/null | grep "https://browser") - else - # check if geekbench file exists - if test -f "geekbench.license"; then - $GEEKBENCH_PATH/geekbench4 --unlock `cat geekbench.license` > /dev/null 2>&1 - fi - - # run the Geekbench 4 test and grep the test results URL given at the end of the test - GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench4 --upload 2>/dev/null | grep "https://browser") - fi - fi - - if [[ $VERSION == *5* ]]; then # Geekbench v5 + GB_URL="https://cdn.geekbench.com/Geekbench-4.4.4-Linux.tar.gz" + [[ "$ARCH" == *"x86"* ]] && GB_CMD="geekbench_x86_32" || GB_CMD="geekbench4" + GB_RUN="True" + elif [[ $VERSION == *5* || $VERSION == *6* ]]; then # Geekbench v5/6 if [[ $ARCH = *x86* && $GEEKBENCH_4 == *False* ]]; then # don't run Geekbench 5 if on 32-bit arch - echo -e "\nGeekbench 5 cannot run on 32-bit architectures. Re-run with -4 flag to use" - echo -e "Geekbench 4, which can support 32-bit architectures. Skipping Geekbench 5." + echo -e "\nGeekbench $VERSION cannot run on 32-bit architectures. Re-run with -4 flag to use" + echo -e "Geekbench 4, which can support 32-bit architectures. Skipping Geekbench $VERSION." elif [[ $ARCH = *x86* && $GEEKBENCH_4 == *True* ]]; then - echo -e "\nGeekbench 5 cannot run on 32-bit architectures. Skipping test." + echo -e "\nGeekbench $VERSION cannot run on 32-bit architectures. Skipping test." else - echo -en "\nRunning GB5 benchmark test... *cue elevator music*" - # download the latest Geekbench 5 tarball and extract to geekbench temp directory - if [[ $ARCH = *aarch64* || $ARCH = *arm* ]]; then - $DL_CMD https://cdn.geekbench.com/Geekbench-5.4.4-LinuxARMPreview.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null - else - $DL_CMD https://cdn.geekbench.com/Geekbench-5.4.5-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null + if [[ $VERSION == *5* ]]; then # Geekbench v5 + [[ $ARCH = *aarch64* || $ARCH = *arm* ]] && GB_URL="https://cdn.geekbench.com/Geekbench-5.5.1-LinuxARMPreview.tar.gz" \ + || GB_URL="https://cdn.geekbench.com/Geekbench-5.5.1-Linux.tar.gz" + GB_CMD="geekbench5" + else # Geekbench v6 + [[ $ARCH = *aarch64* || $ARCH = *arm* ]] && GB_URL="https://cdn.geekbench.com/Geekbench-6.2.1-LinuxARMPreview.tar.gz" \ + || GB_URL="https://cdn.geekbench.com/Geekbench-6.2.1-Linux.tar.gz" + GB_CMD="geekbench6" fi - - # check if geekbench file exists - if test -f "geekbench.license"; then - $GEEKBENCH_PATH/geekbench5 --unlock `cat geekbench.license` > /dev/null 2>&1 - fi - - GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench5 --upload 2>/dev/null | grep "https://browser") + GB_RUN="True" fi fi - # ensure the test ran successfully - if [ -z "$GEEKBENCH_TEST" ]; then - if [[ -z "$IPV4_CHECK" ]]; then - # Geekbench test failed to download because host lacks IPv4 (cdn.geekbench.com = IPv4 only) - echo -e "\r\033[0KGeekbench releases can only be downloaded over IPv4. FTP the Geekbench files and run manually." - elif [[ $ARCH != *x86* ]]; then - # if the Geekbench test failed for any reason, exit cleanly and print error message - echo -e "\r\033[0KGeekbench $VERSION test failed. Run manually to determine cause." - fi - else - # if the Geekbench test succeeded, parse the test results URL - GEEKBENCH_URL=$(echo -e $GEEKBENCH_TEST | head -1) - GEEKBENCH_URL_CLAIM=$(echo $GEEKBENCH_URL | awk '{ print $2 }') - GEEKBENCH_URL=$(echo $GEEKBENCH_URL | awk '{ print $1 }') - # sleep a bit to wait for results to be made available on the geekbench website - sleep 20 - # parse the public results page for the single and multi core geekbench scores - [[ $VERSION == *5* ]] && GEEKBENCH_SCORES=$($DL_CMD $GEEKBENCH_URL | grep "div class='score'") || - GEEKBENCH_SCORES=$($DL_CMD $GEEKBENCH_URL | grep "span class='score'") - GEEKBENCH_SCORES_SINGLE=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $3 }') - GEEKBENCH_SCORES_MULTI=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $7 }') - - # print the Geekbench results - echo -en "\r\033[0K" - echo -e "Geekbench $VERSION Benchmark Test:" - echo -e "---------------------------------" - printf "%-15s | %-30s\n" "Test" "Value" - printf "%-15s | %-30s\n" - printf "%-15s | %-30s\n" "Single Core" "$GEEKBENCH_SCORES_SINGLE" - printf "%-15s | %-30s\n" "Multi Core" "$GEEKBENCH_SCORES_MULTI" - printf "%-15s | %-30s\n" "Full Test" "$GEEKBENCH_URL" + if [[ $GB_RUN == *True* ]]; then # run GB test + echo -en "\nRunning GB$VERSION benchmark test... *cue elevator music*" - if [ ! -z $JSON ]; then - JSON_RESULT+='{"version":'$VERSION',"single":'$GEEKBENCH_SCORES_SINGLE',"multi":'$GEEKBENCH_SCORES_MULTI - JSON_RESULT+=',"url":"'$GEEKBENCH_URL'"},' + # check for local geekbench installed + if command -v "$GB_CMD" &>/dev/null; then + GEEKBENCH_PATH=$(dirname "$(command -v "$GB_CMD")") + else + # download the desired Geekbench tarball and extract to geekbench temp directory + $DL_CMD $GB_URL | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null fi - # write the geekbench claim URL to a file so the user can add the results to their profile (if desired) - [ ! -z "$GEEKBENCH_URL_CLAIM" ] && echo -e "$GEEKBENCH_URL_CLAIM" >> geekbench_claim.url 2> /dev/null + # unlock if license file detected + test -f "geekbench.license" && $GEEKBENCH_PATH/$GB_CMD --unlock $(cat geekbench.license) > /dev/null 2>&1 + + # run the Geekbench test and grep the test results URL given at the end of the test + GEEKBENCH_TEST=$($GEEKBENCH_PATH/$GB_CMD --upload 2>/dev/null | grep "https://browser") + + # ensure the test ran successfully + if [ -z "$GEEKBENCH_TEST" ]; then + if [[ -z "$IPV4_CHECK" ]]; then + # Geekbench test failed to download because host lacks IPv4 (cdn.geekbench.com = IPv4 only) + echo -e "\r\033[0KGeekbench releases can only be downloaded over IPv4. FTP the Geekbench files and run manually." + elif [[ $VERSION != *4* && $TOTAL_RAM_RAW -le 1048576 ]]; then + # Geekbench 5/6 test failed with low memory (<=1GB) + echo -e "\r\033[0KGeekbench test failed and low memory was detected. Add at least 1GB of SWAP or use GB4 instead (higher compatibility with low memory systems)." + elif [[ $ARCH != *x86* ]]; then + # if the Geekbench test failed for any other reason, exit cleanly and print error message + echo -e "\r\033[0KGeekbench $VERSION test failed. Run manually to determine cause." + fi + else + # if the Geekbench test succeeded, parse the test results URL + GEEKBENCH_URL=$(echo -e $GEEKBENCH_TEST | head -1) + GEEKBENCH_URL_CLAIM=$(echo $GEEKBENCH_URL | awk '{ print $2 }') + GEEKBENCH_URL=$(echo $GEEKBENCH_URL | awk '{ print $1 }') + # sleep a bit to wait for results to be made available on the geekbench website + sleep 10 + # parse the public results page for the single and multi core geekbench scores + [[ $VERSION == *4* ]] && GEEKBENCH_SCORES=$($DL_CMD $GEEKBENCH_URL | grep "span class='score'") || \ + GEEKBENCH_SCORES=$($DL_CMD $GEEKBENCH_URL | grep "div class='score'") + + GEEKBENCH_SCORES_SINGLE=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $3 }') + GEEKBENCH_SCORES_MULTI=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $7 }') + + # print the Geekbench results + echo -en "\r\033[0K" + echo -e "Geekbench $VERSION Benchmark Test:" + echo -e "---------------------------------" + printf "%-15s | %-30s\n" "Test" "Value" + printf "%-15s | %-30s\n" + printf "%-15s | %-30s\n" "Single Core" "$GEEKBENCH_SCORES_SINGLE" + printf "%-15s | %-30s\n" "Multi Core" "$GEEKBENCH_SCORES_MULTI" + printf "%-15s | %-30s\n" "Full Test" "$GEEKBENCH_URL" + + if [ ! -z $JSON ]; then + JSON_RESULT+='{"version":'$VERSION',"single":'$GEEKBENCH_SCORES_SINGLE',"multi":'$GEEKBENCH_SCORES_MULTI + JSON_RESULT+=',"url":"'$GEEKBENCH_URL'"},' + fi + + # write the geekbench claim URL to a file so the user can add the results to their profile (if desired) + [ ! -z "$GEEKBENCH_URL_CLAIM" ] && echo -e "$GEEKBENCH_URL_CLAIM" >> geekbench_claim.url 2> /dev/null + fi fi } @@ -877,13 +971,42 @@ if [ -z "$SKIP_GEEKBENCH" ]; then if [[ $GEEKBENCH_5 == *True* ]]; then launch_geekbench 5 fi - [[ ! -z $JSON ]] && JSON_RESULT=${JSON_RESULT::${#JSON_RESULT}-1} && JSON_RESULT+=']' + + if [[ $GEEKBENCH_6 == *True* ]]; then + launch_geekbench 6 + fi + [[ ! -z $JSON ]] && [[ $(echo -n $JSON_RESULT | tail -c 1) == ',' ]] && JSON_RESULT=${JSON_RESULT::${#JSON_RESULT}-1} + [[ ! -z $JSON ]] && JSON_RESULT+=']' fi # finished all tests, clean up all YABS files and exit echo -e rm -rf $YABS_PATH +YABS_END_TIME=$(date +%s) + +# calculate_time_taken +# Purpose: This method is designed to find the time taken for the completion of a YABS run. +# Parameters: +# 1. YABS_END_TIME - time when GB has completed and all files are removed +# 2. YABS_START_TIME - time when YABS is started +function calculate_time_taken() { + end_time=$1 + start_time=$2 + + time_taken=$(( ${end_time} - ${start_time} )) + if [ ${time_taken} -gt 60 ]; then + min=$(expr $time_taken / 60) + sec=$(expr $time_taken % 60) + echo "YABS completed in ${min} min ${sec} sec" + else + echo "YABS completed in ${time_taken} sec" + fi + [[ ! -z $JSON ]] && JSON_RESULT+=',"runtime":{"start":'$start_time',"end":'$end_time',"elapsed":'$time_taken'}' +} + +calculate_time_taken $YABS_END_TIME $YABS_START_TIME + if [[ ! -z $JSON ]]; then JSON_RESULT+='}'