Created
August 22, 2025 06:46
-
-
Save tueda/664d5dda26de48c7c338864c0b1ce090 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # @file openssl-bench.sh | |
| # | |
| # Runs an OpenSSL SHA-256 benchmark and prints the time (in seconds) | |
| # to process 1 terabyte. | |
| # | |
| # Usage: | |
| # openssl-bench.sh [NUM_CPUS] | |
| # | |
| set -euo pipefail | |
| ncpu="${1:-1}" | |
| if [[ "$ncpu" -eq 1 ]]; then | |
| opts= | |
| else | |
| opts="-multi $ncpu" | |
| fi | |
| bytes_per_second=$( | |
| openssl speed -evp sha256 -bytes 16384 -seconds 10 -mr $opts 2>/dev/null \ | |
| | grep '^+F' | tail -1 | awk -F: '{print $NF}' | |
| ) | |
| time_per_tb=$(echo "10^12 / $bytes_per_second" | bc -l) | |
| echo "$time_per_tb" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment