Clean up local changes

This commit is contained in:
root
2025-10-14 23:06:45 +02:00
parent 6b4b9e0b50
commit 795e430228
6 changed files with 9 additions and 406 deletions

View File

@@ -1,97 +0,0 @@
#!/bin/bash
# Battery Drain Analysis Script
# Identifies processes and settings consuming battery power
echo "=== Battery Drain Analysis ==="
echo ""
# Check if on battery
if [ -f /sys/class/power_supply/AC/online ]; then
AC_STATUS=$(cat /sys/class/power_supply/AC/online)
if [ "$AC_STATUS" -eq 1 ]; then
echo "⚡ System is on AC power"
else
echo "🔋 System is on battery power"
fi
fi
echo ""
echo "=== Top 10 CPU Consumers ==="
ps aux --sort=-%cpu | head -11 | awk '{printf "%-12s %6s %6s %s\n", $1, $2, $3, $11}' | head -11
echo ""
echo "=== Top 10 Memory Consumers ==="
ps aux --sort=-%mem | head -11 | awk '{printf "%-12s %6s %6s %s\n", $1, $2, $4, $11}' | head -11
echo ""
echo "=== Network Activity ==="
if command -v ss >/dev/null 2>&1; then
CONNECTIONS=$(ss -tunap 2>/dev/null | grep ESTAB | wc -l)
echo "Active network connections: $CONNECTIONS"
echo ""
echo "Top network users:"
ss -tunap 2>/dev/null | grep ESTAB | grep -oP 'users:\(\(".*?",pid=\d+' | sort | uniq -c | sort -rn | head -5
fi
echo ""
echo "=== WiFi Power Management ==="
iwconfig 2>&1 | grep -E "wlp|Power Management" | grep -v "no wireless"
echo ""
echo "=== Wakeup Analysis ==="
if command -v powertop >/dev/null 2>&1; then
echo "Running powertop analysis (3 seconds)..."
sudo powertop --time=3 2>&1 | grep -A 20 "Top 10 Power" | head -22
else
echo "Install powertop for detailed wakeup analysis: sudo apt install powertop"
fi
echo ""
echo "=== Browser Tabs Analysis ==="
# Count Brave renderer processes (each is roughly a tab)
BRAVE_RENDERERS=$(ps aux | grep "brave --type=renderer" | grep -v grep | wc -l)
echo "Brave renderer processes: $BRAVE_RENDERERS (≈ number of tabs)"
# Find most CPU-intensive Brave processes
echo ""
echo "Most CPU-intensive Brave tabs:"
ps aux | grep "brave --type=renderer" | grep -v grep | sort -k3 -rn | head -3 | awk '{printf " PID: %6s CPU: %5s%% MEM: %5s%%\n", $2, $3, $4}'
echo ""
echo "=== Recommendations ==="
echo ""
# Check for high CPU usage
HIGH_CPU=$(ps aux --sort=-%cpu | head -2 | tail -1 | awk '{print $3}' | cut -d. -f1)
if [ "$HIGH_CPU" -gt 50 ]; then
TOP_PROCESS=$(ps aux --sort=-%cpu | head -2 | tail -1 | awk '{print $11}')
echo "⚠️ High CPU usage detected: $TOP_PROCESS using $HIGH_CPU%"
echo " Consider closing or suspending this application"
echo ""
fi
# Check for many browser tabs
if [ "$BRAVE_RENDERERS" -gt 20 ]; then
echo "⚠️ Many browser tabs open ($BRAVE_RENDERERS processes)"
echo " Consider using tab suspension extension or closing unused tabs"
echo ""
fi
# Check for Element
if pgrep -x "element-desktop" > /dev/null; then
ELEMENT_CPU=$(ps aux | grep element-desktop | grep -v grep | head -1 | awk '{print $3}' | cut -d. -f1)
if [ "$ELEMENT_CPU" -gt 10 ]; then
echo "⚠️ Element Desktop is using ${ELEMENT_CPU}% CPU"
echo " Consider closing when not actively using Matrix"
echo ""
fi
fi
echo "💡 Quick fixes:"
echo " • Close unused browser tabs"
echo " • Suspend browser tabs with 'The Great Suspender' extension"
echo " • Close Element Desktop if not needed: killall element-desktop"
echo " • Reduce screen brightness"
echo " • Check: ./scripts/cpu-power-control.sh preset balanced"
echo ""

0
scripts/cpu-power-control.sh Executable file → Normal file
View File

View File

@@ -1,61 +0,0 @@
#!/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

0
scripts/test-single-core-boost.sh Executable file → Normal file
View File