Initial commit

This commit is contained in:
Felipe Cardoso
2026-03-25 20:13:15 +01:00
commit c596e38e9e
26 changed files with 2345 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Switch tuned profile to accelerator-performance
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../../lib/common.sh"
source "$SCRIPT_DIR/../../lib/detect.sh"
RECOMMENDED="accelerator-performance"
log_header "Tuned Profile Optimization"
if ! is_cmd tuned-adm; then
log_error "tuned is not installed. Install with: sudo dnf install tuned"
exit 1
fi
current="$(detect_tuned_profile)"
log_info "Current profile: $current"
if [[ "$current" == "$RECOMMENDED" ]]; then
log_success "Already using $RECOMMENDED"
exit 0
fi
# Check availability
if ! tuned-adm list 2>/dev/null | grep -q "$RECOMMENDED"; then
log_error "$RECOMMENDED profile not available"
log_info "Available profiles:"
tuned-adm list 2>/dev/null | grep "^-" | sed 's/^/ /'
exit 1
fi
echo ""
log_info "Recommended: $RECOMMENDED"
log_info "Description: Throughput performance with disabled higher latency STOP states"
log_info "Benefit: 5-8% improvement in prompt processing (pp) benchmarks"
log_info "No reboot required."
echo ""
if ! confirm "Switch to $RECOMMENDED?"; then
log_info "Skipped"
exit 0
fi
# Save current for rollback
echo "$current" > "$(data_dir backups)/tuned-previous-profile.txt"
sudo tuned-adm profile "$RECOMMENDED"
new_profile="$(detect_tuned_profile)"
if [[ "$new_profile" == "$RECOMMENDED" ]]; then
log_success "Profile switched to: $new_profile"
else
log_error "Profile switch may have failed. Current: $new_profile"
fi