Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 113 additions & 113 deletions hwtweaked-run
Original file line number Diff line number Diff line change
@@ -1,113 +1,113 @@
#!/bin/bash
echo -e "\033[0;91m\033[47m \033[0m"
echo -e "\033[0;91m\033[47m **************************************** \033[0m"
echo -e "\033[0;91m\033[47m **** YOU SHOULD NOT USE THIS SCRIPT **** \033[0m"
echo -e "\033[0;91m\033[47m **************************************** \033[0m"
echo -e "\033[0;91m\033[47m \033[0m"
echo ""
echo "This script tries to tweak your hardware to make tests less flaky, but still, this is NOT the way to run proper performance tests. Results here cannot be used to complain about performance."
echo ""
OS=
case "$(uname -s)" in
Linux*) OS=linux;;
Darwin*) OS=mac;;
CYGWIN*|MINGW*|MSYS*) OS=windows;;
esac
if [ "$OS" == "windows" ]; then
echo -e "\033[0;31mThis script does not support Windows, sorry.\033[0m"
exit 1
fi
source hardware-tweaks.conf
echo "Requirements check:"
if ! command -v cpupower >/dev/null 2>&1
then
echo -e " - \033[0;31m✗ cpupower: Command not found, please install it\033[0m"
exit 1
else
echo -e " - \033[0;32m✓ cpupower\033[0m"
fi
if ! command -v taskset >/dev/null 2>&1
then
echo -e " - \033[0;31m✗ taskset: Command not found, please install it\033[0m"
exit 1
else
echo -e " - \033[0;32m✓ taskset\033[0m"
fi
if ! command -v perf >/dev/null 2>&1
then
echo -e " - \033[0;31m✗ perf: Command not found, please install it\033[0m"
exit 1
else
echo -e " - \033[0;32m✓ perf \033[0m"
fi
if [[ -z "${IS_INTEL}" ]]; then
CPU_INFO=$(lscpu -p=MODELNAME)
if grep -iq "Intel(R)" <<< "$CPU_INFO"; then
IS_INTEL=true
echo -e " - \033[0;32m✓ Auto-detected Intel CPU\033[0m"
else
IS_INTEL=false
echo -e " - \033[0;32m✓ Auto-detected non-Intel CPU\033[0m"
fi
fi
if [[ -z "${MIN_FREQ}" || -z "${MAX_FREQ}" ]]; then
IFS=" " read -r MIN_FREQ MAX_FREQ <<< "$(cpupower frequency-info -l | tail -n 1)"
if [[ -z "${MIN_FREQ}" || -z "${MAX_FREQ}" ]]; then
echo -e "\033[0;31mError: Could not auto-detect CPU frequencies. Please set MIN_FREQ and MAX_FREQ in hardware-tweaks.conf\033[0m"
exit 1
else
echo -e " - \033[0;32m✓ Auto-detected MIN_FREQ=$MIN_FREQ, MAX_FREQ=$MAX_FREQ\033[0m"
fi
fi
if [ $HARDWARE_CONFIGURED == false ]; then
echo -e "\033[0;31mMake sure you edit the hardware-tweaks.conf file before you run this\033[0m"
exit 1;
else
echo -e " - \033[0;32m✓ configuration\033[0m"
fi
echo "This command will ask you for your sudo password to tweak the hardware."
echo "It will restore back all the hardware configuration, but it may fail. Be careful using this command."
echo "Disabling turbo boost"
if [ $IS_INTEL == true ]; then
echo "1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
else
sudo cpupower set --turbo-boost 0
fi
echo "Setting a constant CPU frequency"
sudo cpupower frequency-set --min $TEST_FREQ
sudo cpupower frequency-set --max $TEST_FREQ
echo "Clearing IO Operations"
sudo sync
echo "Clearing Swap"
echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo swapoff -a && sudo swapon -a
# Launch run with all the configuration options
./run "$@"
echo "Trying to restore the hardware configuration"
echo "Free CPU frequency"
sudo cpupower frequency-set --min $MIN_FREQ
sudo cpupower frequency-set --max $MAX_FREQ
echo "Re-enabling turbo boost"
if [ $IS_INTEL == true ]; then
echo "1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
else
sudo cpupower set --turbo-boost 1
fi
#!/bin/bash

echo -e "\033[0;91m\033[47m \033[0m"
echo -e "\033[0;91m\033[47m **************************************** \033[0m"
echo -e "\033[0;91m\033[47m **** YOU SHOULD NOT USE THIS SCRIPT **** \033[0m"
echo -e "\033[0;91m\033[47m **************************************** \033[0m"
echo -e "\033[0;91m\033[47m \033[0m"
echo ""
echo "This script tries to tweak your hardware to make tests less flaky, but still, this is NOT the way to run proper performance tests. Results here cannot be used to complain about performance."
echo ""

OS=
case "$(uname -s)" in
Linux*) OS=linux;;
Darwin*) OS=mac;;
CYGWIN*|MINGW*|MSYS*) OS=windows;;
esac
if [ "$OS" == "windows" ]; then
echo -e "\033[0;31mThis script does not support Windows, sorry.\033[0m"
exit 1
fi

source hardware-tweaks.conf

echo "Requirements check:"

if ! command -v cpupower >/dev/null 2>&1
then
echo -e " - \033[0;31m✗ cpupower: Command not found, please install it\033[0m"
exit 1
else
echo -e " - \033[0;32m✓ cpupower\033[0m"
fi

if ! command -v taskset >/dev/null 2>&1
then
echo -e " - \033[0;31m✗ taskset: Command not found, please install it\033[0m"
exit 1
else
echo -e " - \033[0;32m✓ taskset\033[0m"
fi

if ! command -v perf >/dev/null 2>&1
then
echo -e " - \033[0;31m✗ perf: Command not found, please install it\033[0m"
exit 1
else
echo -e " - \033[0;32m✓ perf \033[0m"
fi

if [[ -z "${IS_INTEL}" ]]; then
CPU_INFO=$(lscpu -p=MODELNAME)
if grep -iq "Intel(R)" <<< "$CPU_INFO"; then
IS_INTEL=true
echo -e " - \033[0;32m✓ Auto-detected Intel CPU\033[0m"
else
IS_INTEL=false
echo -e " - \033[0;32m✓ Auto-detected non-Intel CPU\033[0m"
fi
fi

if [[ -z "${MIN_FREQ}" || -z "${MAX_FREQ}" ]]; then
IFS=" " read -r MIN_FREQ MAX_FREQ <<< "$(cpupower frequency-info -l | tail -n 1)"
if [[ -z "${MIN_FREQ}" || -z "${MAX_FREQ}" ]]; then
echo -e "\033[0;31mError: Could not auto-detect CPU frequencies. Please set MIN_FREQ and MAX_FREQ in hardware-tweaks.conf\033[0m"
exit 1
else
echo -e " - \033[0;32m✓ Auto-detected MIN_FREQ=$MIN_FREQ, MAX_FREQ=$MAX_FREQ\033[0m"
fi
fi

if [ $HARDWARE_CONFIGURED == false ]; then
echo -e "\033[0;31mMake sure you edit the hardware-tweaks.conf file before you run this\033[0m"
exit 1;
else
echo -e " - \033[0;32m✓ configuration\033[0m"
fi

echo "This command will ask you for your sudo password to tweak the hardware."
echo "It will restore back all the hardware configuration, but it may fail. Be careful using this command."

echo "Disabling turbo boost"
if [ $IS_INTEL == true ]; then
echo "1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
else
sudo cpupower set --turbo-boost 0
fi

echo "Setting a constant CPU frequency"
sudo cpupower frequency-set --min $TEST_FREQ
sudo cpupower frequency-set --max $TEST_FREQ

echo "Clearing IO Operations"
sudo sync

echo "Clearing Swap"
echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo swapoff -a && sudo swapon -a

# Launch run with all the configuration options
./run "$@"

echo "Trying to restore the hardware configuration"
echo "Free CPU frequency"
sudo cpupower frequency-set --min $MIN_FREQ
sudo cpupower frequency-set --max $MAX_FREQ

echo "Re-enabling turbo boost"
if [ $IS_INTEL == true ]; then
echo "1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
else
sudo cpupower set --turbo-boost 1
fi
158 changes: 79 additions & 79 deletions run
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
#!/bin/bash
set -uo pipefail
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export TEST_DIR=${script_dir}
export TEST_SRC_DIR=${TEST_DIR}/src
export TEST_APPS_DIR=${TEST_DIR}/apps
export TEST_BUILDS_DIR=${TEST_DIR}/builds
# Detects the operating system.
case "$(uname -s)" in
Linux*) export DETECTED_OS=linux;;
Darwin*) export DETECTED_OS=mac;;
CYGWIN*|MINGW*|MSYS*) export DETECTED_OS=windows;;
esac
export TEST_ENGINE=""
if command -v podman >/dev/null 2>&1; then
TEST_ENGINE="podman"
elif command -v docker >/dev/null 2>&1; then
TEST_ENGINE="docker"
else
echo "Error: Neither podman nor docker can be found"
exit 3
fi
source "${TEST_SRC_DIR}"/scripts/suitefuncs.sh
if [ -t 1 ] ; then
export BOLD="\033[1m"
export NORMAL="\033[0m"
export RED="\033[31m"
export GREEN="\033[32m"
export CURUP="\033M"
export CLREOL="\033[0J"
else
export BOLD=""
export NORMAL=""
export RED=""
export GREEN=""
export CURUP=""
export CLREOL=""
fi
function list_commands() {
for filename in "${TEST_SRC_DIR}"/scripts/bin/*.sh; do
name=$(basename "$filename" ".sh")
description=$(grep -m 1 '^# DESCRIPTION=' "$filename" || true | cut -d'=' -f2-)
if [[ -z "${description}" ]]; then
echo -e " ${BOLD}$name${NORMAL}"
else
echo -e " ${BOLD}$name :${NORMAL} $description"
fi
done
}
if [[ $# -eq 0 || "$1" == "-h" || "$1" == "--help" ]]; then
if [[ $# -eq 0 ]]; then
echo "ERROR: Missing command."
fi
echo "This is the Leyden Performance Test runner."
echo "Usage: ./run <command> [<args>]"
echo ""
echo "Available commands:"
list_commands
exit 3
fi
command="$1"
if [[ ! -f "${TEST_SRC_DIR}/scripts/bin/${command}.sh" ]]; then
echo "ERROR: Unknown command '${command}'."
echo "Available commands:"
list_commands
exit 1
fi
shift
"${TEST_SRC_DIR}"/scripts/bin/"${command}".sh "$@"
#!/bin/bash
set -uo pipefail

script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

export TEST_DIR=${script_dir}
export TEST_SRC_DIR=${TEST_DIR}/src
export TEST_APPS_DIR=${TEST_DIR}/apps
export TEST_BUILDS_DIR=${TEST_DIR}/builds

# Detects the operating system.
case "$(uname -s)" in
Linux*) export DETECTED_OS=linux;;
Darwin*) export DETECTED_OS=mac;;
CYGWIN*|MINGW*|MSYS*) export DETECTED_OS=windows;;
esac

export TEST_ENGINE=""
if command -v podman >/dev/null 2>&1; then
TEST_ENGINE="podman"
elif command -v docker >/dev/null 2>&1; then
TEST_ENGINE="docker"
else
echo "Error: Neither podman nor docker can be found"
exit 3
fi

source "${TEST_SRC_DIR}"/scripts/suitefuncs.sh

if [ -t 1 ] ; then
export BOLD="\033[1m"
export NORMAL="\033[0m"
export RED="\033[31m"
export GREEN="\033[32m"
export CURUP="\033M"
export CLREOL="\033[0J"
else
export BOLD=""
export NORMAL=""
export RED=""
export GREEN=""
export CURUP=""
export CLREOL=""
fi

function list_commands() {
for filename in "${TEST_SRC_DIR}"/scripts/bin/*.sh; do
name=$(basename "$filename" ".sh")
description=$(grep -m 1 '^# DESCRIPTION=' "$filename" || true | cut -d'=' -f2-)
if [[ -z "${description}" ]]; then
echo -e " ${BOLD}$name${NORMAL}"
else
echo -e " ${BOLD}$name :${NORMAL} $description"
fi
done
}

if [[ $# -eq 0 || "$1" == "-h" || "$1" == "--help" ]]; then
if [[ $# -eq 0 ]]; then
echo "ERROR: Missing command."
fi
echo "This is the Leyden Performance Test runner."
echo "Usage: ./run <command> [<args>]"
echo ""
echo "Available commands:"
list_commands
exit 3
fi

command="$1"
if [[ ! -f "${TEST_SRC_DIR}/scripts/bin/${command}.sh" ]]; then
echo "ERROR: Unknown command '${command}'."
echo "Available commands:"
list_commands
exit 1
fi

shift
"${TEST_SRC_DIR}"/scripts/bin/"${command}".sh "$@"