Add CPU power management tools and dynamic frequency scaling

- Add cpu-power-control.sh: Script for managing CPU power limits and presets
- Add monitor-cpu-freq.sh: Real-time CPU frequency monitoring tool
- Add test-single-core-boost.sh: Tool for testing single-core boost frequencies
- Add BIOS-FIX.md: Documentation for BIOS configuration fix
- Update tlp.conf: Configure dynamic CPU frequency scaling (400MHz-4.2GHz on AC, 400MHz-2.2GHz on battery)
- Add Intel RAPL power limit controls for CPU power capping
- Enable dynamic frequency scaling with proper platform profiles
- Fix CPU frequency stuck at 1.6GHz issue (required BIOS SpeedStep disable)
- Configure balanced battery mode with 2.2GHz max for responsiveness
This commit is contained in:
rwiegand
2025-10-06 22:34:19 +02:00
parent ba8f37706f
commit b9e2c2a731
5 changed files with 648 additions and 12 deletions

61
scripts/monitor-cpu-freq.sh Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/bash
# Real-time CPU Frequency Monitor
# Shows actual CPU frequencies and helps identify boost behavior
echo "=== Real-time CPU Frequency Monitor ==="
echo "Press Ctrl+C to stop"
echo ""
echo "Note: Modern Intel CPUs dynamically adjust frequency based on:"
echo " - Workload type (single vs multi-core)"
echo " - Power limits (TDP)"
echo " - Temperature"
echo " - Energy efficiency preferences"
echo ""
# Check if turbostat is available
if command -v turbostat >/dev/null 2>&1; then
echo "Using turbostat for accurate frequency monitoring..."
echo ""
sudo turbostat --quiet --show Core,CPU,Busy%,Bzy_MHz,PkgWatt --interval 2
else
echo "turbostat not available, using basic monitoring..."
echo ""
echo "Timestamp | CPU0 CPU1 CPU2 CPU3 | Avg MHz | Governor | Temp"
echo "----------------+---------------------------------+---------+-----------+------"
while true; do
TIMESTAMP=$(date +"%H:%M:%S")
# Get frequencies
FREQ0=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
FREQ1=$(cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq)
FREQ2=$(cat /sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq)
FREQ3=$(cat /sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq)
# Convert to MHz
F0=$((FREQ0 / 1000))
F1=$((FREQ1 / 1000))
F2=$((FREQ2 / 1000))
F3=$((FREQ3 / 1000))
# Calculate average
AVG=$(( (F0 + F1 + F2 + F3) / 4 ))
# Get governor
GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
# Get temperature if available
if [ -r "/sys/class/thermal/thermal_zone0/temp" ]; then
TEMP_RAW=$(cat /sys/class/thermal/thermal_zone0/temp)
TEMP=$((TEMP_RAW / 1000))
else
TEMP="N/A"
fi
printf "%s | %4d %4d %4d %4d | %4d MHz | %-9s | %s°C\n" \
"$TIMESTAMP" "$F0" "$F1" "$F2" "$F3" "$AVG" "$GOV" "$TEMP"
sleep 2
done
fi