uhd/host/tests/streaming_performance/setupPCIe.sh
Grant Meyerhoff a18579e3e5 ci: Add support for USRP B310
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Wade Fife <wade.fife@ettus.com>
Co-authored-by: Javier Valenzuela <javier.j.valenzuela@emerson.com>
2026-08-04 12:00:49 +02:00

92 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
#
# setup script for PCIe streaming performance enhancements
#
# Instructions
# copy this file to the host machine
# the script should be run as root
# sudo ./setupPCIe.sh [-v] [-s]
#
# This script configures CPU governors for optimal performance
VERBOSE=NO
STATS=NO
INSTALL_DEPS=NO
HELP=NO
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-h|--help)
HELP=YES
shift
;;
-v|--verbose)
VERBOSE=YES
shift
;;
-s|--stats)
STATS=YES
shift
;;
--deps)
INSTALL_DEPS=YES
shift
;;
*)
echo "Unknown option: $1"
echo "Use -h or --help for usage information"
exit 1
;;
esac
done
if [[ "$HELP" == "YES" ]]; then
echo "Usage:"
echo " ./setupPCIe.sh [options]"
echo ""
echo "Setup script for PCIe streaming performance."
echo "Configures CPU cores for performance mode."
echo ""
echo "Options:"
echo " -v, --verbose display extra log messages"
echo " -s, --stats display info about the resulting system configuration"
echo " --deps installs dependencies (cpufrequtils)"
exit 0
fi
function log() {
if [[ "$VERBOSE" == "YES" ]]; then
echo "$@"
fi
}
if [[ "$INSTALL_DEPS" == "YES" ]]; then
apt install -y cpufrequtils
echo "Deps installed. Rerun without --deps flag."
exit 0
fi
log ""
log "SETTING CPU GOVERNORS"
for ((i=0;i<$(nproc --all);i++)); do
log "setting core $i to performance"
cpufreq-set -c $i -r -g performance;
done
function print_config() {
echo ""
echo "CURRENT SYSTEM CONFIG"
echo "----------------------------------------------------------------------"
for ((i=0;i<$(nproc);i++)); do
echo "analyzing cpu $i:"
cpufreq-info -c $i -p
done
}
if [[ "$STATS" == "YES" ]]; then
print_config
fi
echo "PCIe performance setup complete."