Last active
May 13, 2024 04:49
-
-
Save bohanyang/652c917fc771360babe601b874bcd22f 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
#!/usr/bin/env sh | |
set -ex | |
command_exists() { | |
command -v "$@" > /dev/null 2>&1 | |
} | |
user="$(id -un 2>/dev/null || true)" | |
sudo='' | |
if [ "$user" != 'root' ]; then | |
if command_exists sudo; then | |
sudo='sudo' | |
else | |
exit 1 | |
fi | |
fi | |
if ! command_exists sysbench; then | |
$sudo bash -c "$(wget -qO- https://packagecloud.io/install/repositories/akopytov/sysbench/script.deb.sh)" | |
$sudo apt install -y --no-install-recommends sysbench | |
fi | |
cat /proc/cpuinfo > sysbench.log | |
sysbench cpu run | tee -a sysbench.log | |
core_n="$(nproc --all)" | |
if [ "$core_n" -gt 1 ]; then | |
sysbench --threads="$core_n" cpu run | tee -a sysbench.log | |
fi | |
sysbench --memory-oper=read --memory-access-mode=rnd memory run | tee -a sysbench.log | |
sysbench --memory-oper=write --memory-access-mode=rnd memory run | tee -a sysbench.log | |
sysbench --memory-oper=read --memory-access-mode=seq memory run | tee -a sysbench.log | |
sysbench --memory-oper=write --memory-access-mode=seq memory run | tee -a sysbench.log | |
sysbench fileio prepare | |
sysbench --file-test-mode=seqrd fileio run | tee -a sysbench.log | |
sysbench --file-test-mode=seqwr fileio run | tee -a sysbench.log | |
sysbench fileio cleanup | |
sysbench fileio prepare | |
sysbench --file-test-mode=rndrd fileio run | tee -a sysbench.log | |
sysbench --file-test-mode=rndwr fileio run | tee -a sysbench.log | |
sysbench fileio cleanup | |
sysbench fileio prepare | |
sysbench --file-test-mode=rndrw fileio run | tee -a sysbench.log | |
sysbench fileio cleanup |
Author
bohanyang
commented
Dec 2, 2018
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment