Initial Commit
This commit is contained in:
commit
ff6f5394ac
3 changed files with 229 additions and 0 deletions
50
.forgejo/workflows/power-graph.yml
Normal file
50
.forgejo/workflows/power-graph.yml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
name: Generate Power Graph
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- power_log.csv
|
||||
|
||||
jobs:
|
||||
plot:
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
run: |
|
||||
git clone https://mentalnet.xyz/forgejo/markmental/amd-telemetry.git .
|
||||
echo "✅ Repository checked out"
|
||||
|
||||
- name: Install Python deps
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y python3 python3-pip
|
||||
pip install matplotlib pandas
|
||||
|
||||
- name: Generate power graph
|
||||
run: |
|
||||
python3 - <<'EOF'
|
||||
import pandas as pd, matplotlib.pyplot as plt
|
||||
df = pd.read_csv('power_log.csv', names=['time','apu','gpu','total'])
|
||||
plt.figure(figsize=(10,5))
|
||||
plt.plot(df['time'], df['apu'], label='APU Power (W)', color='orange')
|
||||
plt.plot(df['time'], df['gpu'], label='GPU Power (W)', color='green')
|
||||
plt.plot(df['time'], df['total'], label='Total (W)', color='blue', linewidth=1.5)
|
||||
plt.xlabel('Time')
|
||||
plt.ylabel('Watts')
|
||||
plt.title('AMD TUF Power Log')
|
||||
plt.legend()
|
||||
plt.xticks(rotation=45)
|
||||
plt.tight_layout()
|
||||
plt.grid(True, alpha=0.3)
|
||||
plt.savefig('power_graph.png', dpi=120)
|
||||
print('✅ Graph generated: power_graph.png')
|
||||
EOF
|
||||
|
||||
- name: Upload graph artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: power-graph
|
||||
path: power_graph.png
|
||||
|
||||
68
amd-monitor.sh
Executable file
68
amd-monitor.sh
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
# AMD Laptop APU + GPU Live Monitor for ASUS TUF (Debian 13)
|
||||
# Author: MarkMental
|
||||
|
||||
# --- Configuration ---
|
||||
APU_HWMON="/sys/class/hwmon/hwmon5" # APU sensor
|
||||
GPU_HWMON="/sys/class/drm/card0/device/hwmon/hwmon4" # dGPU sensor
|
||||
INTERVAL=1 # seconds between refreshes
|
||||
LOGFILE="power_log.csv" # CSV output file
|
||||
MAX_LINES=500 # limit to last 500 lines
|
||||
|
||||
# --- Helpers ---
|
||||
read_watts() {
|
||||
local file=$1
|
||||
if [ -f "$file" ]; then
|
||||
awk '{printf "%.2f", $1/1000000}' "$file"
|
||||
else
|
||||
echo "0.00"
|
||||
fi
|
||||
}
|
||||
|
||||
read_temp() {
|
||||
local file=$1
|
||||
if [ -f "$file" ]; then
|
||||
awk '{printf "%.1f", $1/1000}' "$file"
|
||||
else
|
||||
echo "N/A"
|
||||
fi
|
||||
}
|
||||
|
||||
# --- Ensure CSV exists and has header ---
|
||||
if [ ! -f "$LOGFILE" ]; then
|
||||
echo "timestamp,apu_w,gpu_w,total_w,apu_temp,gpu_temp" > "$LOGFILE"
|
||||
fi
|
||||
|
||||
# --- Main loop ---
|
||||
clear
|
||||
echo "🧠 AMD APU / GPU Live Power Monitor (Debian 13 TUF)"
|
||||
echo "--------------------------------------------------"
|
||||
|
||||
while true; do
|
||||
APU_PWR=$(read_watts "$APU_HWMON/power1_input")
|
||||
GPU_PWR=$(read_watts "$GPU_HWMON/power1_average")
|
||||
APU_TEMP=$(read_temp "$APU_HWMON/temp1_input")
|
||||
GPU_TEMP=$(read_temp "$GPU_HWMON/temp1_input")
|
||||
TOTAL=$(awk -v a="$APU_PWR" -v g="$GPU_PWR" 'BEGIN {printf "%.2f", a+g}')
|
||||
TIME=$(date -Iseconds)
|
||||
|
||||
# --- Print live readout ---
|
||||
tput cup 2 0
|
||||
echo "APU Power: ${APU_PWR} W | Temp: ${APU_TEMP} °C "
|
||||
echo "GPU Power: ${GPU_PWR} W | Temp: ${GPU_TEMP} °C "
|
||||
echo "-----------------------------------------------"
|
||||
echo "Total Power: ${TOTAL} W"
|
||||
echo "Press Ctrl+C to exit"
|
||||
|
||||
# --- Append to CSV ---
|
||||
echo "$TIME,$APU_PWR,$GPU_PWR,$TOTAL,$APU_TEMP,$GPU_TEMP" >> "$LOGFILE"
|
||||
|
||||
# --- Keep only last $MAX_LINES lines ---
|
||||
LINES=$(wc -l < "$LOGFILE")
|
||||
if (( LINES > MAX_LINES )); then
|
||||
tail -n $MAX_LINES "$LOGFILE" > "${LOGFILE}.tmp" && mv "${LOGFILE}.tmp" "$LOGFILE"
|
||||
fi
|
||||
|
||||
sleep $INTERVAL
|
||||
done
|
||||
|
||||
111
power_log.csv
Normal file
111
power_log.csv
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
timestamp,apu_w,gpu_w,total_w,apu_temp,gpu_temp
|
||||
2025-11-05T17:39:03-05:00,61.04,9.00,70.04,73.0,68.0
|
||||
2025-11-05T17:39:04-05:00,55.15,10.00,65.15,72.0,68.0
|
||||
2025-11-05T17:39:05-05:00,59.17,9.00,68.17,73.0,68.0
|
||||
2025-11-05T17:39:06-05:00,2.20,9.00,11.20,73.0,68.0
|
||||
2025-11-05T17:39:07-05:00,9.01,9.00,18.01,73.0,68.0
|
||||
2025-11-05T17:39:08-05:00,64.03,9.00,73.03,72.0,68.0
|
||||
2025-11-05T17:39:09-05:00,3.05,9.00,12.05,73.0,68.0
|
||||
2025-11-05T17:39:10-05:00,37.21,9.00,46.21,73.0,68.0
|
||||
2025-11-05T17:39:11-05:00,2.20,9.00,11.20,73.0,68.0
|
||||
2025-11-05T17:39:12-05:00,5.00,9.00,14.00,73.0,68.0
|
||||
2025-11-05T17:39:13-05:00,46.03,9.00,55.03,72.0,68.0
|
||||
2025-11-05T17:39:14-05:00,8.21,9.00,17.21,72.0,68.0
|
||||
2025-11-05T17:39:15-05:00,64.20,9.00,73.20,73.0,68.0
|
||||
2025-11-05T17:39:16-05:00,56.09,9.00,65.09,73.0,68.0
|
||||
2025-11-05T17:39:17-05:00,54.16,10.00,64.16,72.0,68.0
|
||||
2025-11-05T17:39:18-05:00,50.09,9.00,59.09,73.0,68.0
|
||||
2025-11-05T17:39:19-05:00,3.09,9.00,12.09,73.0,68.0
|
||||
2025-11-05T17:39:20-05:00,53.10,9.00,62.10,73.0,68.0
|
||||
2025-11-05T17:39:21-05:00,56.12,10.00,66.12,73.0,68.0
|
||||
2025-11-05T17:39:22-05:00,65.06,9.00,74.06,73.0,68.0
|
||||
2025-11-05T17:39:23-05:00,48.05,9.00,57.05,73.0,68.0
|
||||
2025-11-05T17:39:24-05:00,60.11,9.00,69.11,73.0,68.0
|
||||
2025-11-05T17:39:25-05:00,1.02,9.00,10.02,72.0,68.0
|
||||
2025-11-05T17:39:26-05:00,57.24,9.00,66.24,72.0,68.0
|
||||
2025-11-05T17:39:27-05:00,2.10,9.00,11.10,73.0,68.0
|
||||
2025-11-05T17:39:28-05:00,55.11,9.00,64.11,73.0,68.0
|
||||
2025-11-05T17:39:29-05:00,12.13,9.00,21.13,73.0,68.0
|
||||
2025-11-05T17:39:30-05:00,51.21,9.00,60.21,73.0,68.0
|
||||
2025-11-05T17:39:31-05:00,55.13,10.00,65.13,74.0,68.0
|
||||
2025-11-05T17:39:32-05:00,3.08,11.00,14.08,73.0,68.0
|
||||
2025-11-05T17:39:33-05:00,7.08,9.00,16.08,73.0,68.0
|
||||
2025-11-05T17:39:34-05:00,63.06,9.00,72.06,72.0,68.0
|
||||
2025-11-05T17:39:35-05:00,5.13,11.00,16.13,73.0,68.0
|
||||
2025-11-05T17:39:36-05:00,55.10,9.00,64.10,73.0,68.0
|
||||
2025-11-05T17:39:37-05:00,13.07,9.00,22.07,73.0,68.0
|
||||
2025-11-05T17:39:38-05:00,11.18,9.00,20.18,74.0,68.0
|
||||
2025-11-05T17:39:39-05:00,61.02,9.00,70.02,73.0,68.0
|
||||
2025-11-05T17:39:40-05:00,6.12,10.00,16.12,72.0,68.0
|
||||
2025-11-05T17:39:41-05:00,58.00,9.00,67.00,72.0,68.0
|
||||
2025-11-05T17:39:42-05:00,60.21,9.00,69.21,73.0,68.0
|
||||
2025-11-05T17:39:43-05:00,59.16,9.00,68.16,73.0,68.0
|
||||
2025-11-05T17:39:44-05:00,7.16,9.00,16.16,74.0,68.0
|
||||
2025-11-05T17:39:45-05:00,58.17,9.00,67.17,73.0,68.0
|
||||
2025-11-05T17:39:46-05:00,6.13,9.00,15.13,73.0,68.0
|
||||
2025-11-05T17:39:48-05:00,54.22,9.00,63.22,73.0,68.0
|
||||
2025-11-05T17:39:49-05:00,62.12,9.00,71.12,73.0,68.0
|
||||
2025-11-05T17:39:50-05:00,51.03,9.00,60.03,73.0,68.0
|
||||
2025-11-05T17:39:51-05:00,12.15,9.00,21.15,72.0,68.0
|
||||
2025-11-05T17:39:52-05:00,2.09,9.00,11.09,72.0,68.0
|
||||
2025-11-05T17:39:53-05:00,54.15,9.00,63.15,73.0,68.0
|
||||
2025-11-05T17:39:54-05:00,45.09,9.00,54.09,73.0,68.0
|
||||
2025-11-05T17:39:55-05:00,58.22,9.00,67.22,73.0,68.0
|
||||
2025-11-05T17:39:56-05:00,60.19,10.00,70.19,73.0,68.0
|
||||
2025-11-05T17:39:57-05:00,62.12,9.00,71.12,72.0,68.0
|
||||
2025-11-05T17:39:58-05:00,65.04,9.00,74.04,73.0,68.0
|
||||
2025-11-05T17:39:59-05:00,56.03,9.00,65.03,74.0,68.0
|
||||
2025-11-05T17:40:00-05:00,0.25,9.00,9.25,73.0,68.0
|
||||
2025-11-05T17:40:01-05:00,2.03,9.00,11.03,73.0,68.0
|
||||
2025-11-05T17:40:02-05:00,59.05,11.00,70.05,73.0,68.0
|
||||
2025-11-05T17:40:03-05:00,50.09,9.00,59.09,73.0,68.0
|
||||
2025-11-05T17:40:04-05:00,43.13,9.00,52.13,73.0,68.0
|
||||
2025-11-05T17:40:05-05:00,9.15,10.00,19.15,72.0,68.0
|
||||
2025-11-05T17:40:06-05:00,12.11,9.00,21.11,73.0,68.0
|
||||
2025-11-05T17:40:07-05:00,9.15,9.00,18.15,73.0,68.0
|
||||
2025-11-05T17:40:08-05:00,61.02,11.00,72.02,72.0,68.0
|
||||
2025-11-05T17:40:09-05:00,6.16,9.00,15.16,73.0,68.0
|
||||
2025-11-05T17:40:10-05:00,55.21,9.00,64.21,72.0,68.0
|
||||
2025-11-05T17:40:11-05:00,46.15,9.00,55.15,72.0,68.0
|
||||
2025-11-05T17:40:12-05:00,57.07,9.00,66.07,73.0,68.0
|
||||
2025-11-05T17:40:13-05:00,25.12,12.00,37.12,73.0,68.0
|
||||
2025-11-05T17:40:14-05:00,16.09,9.00,25.09,74.0,68.0
|
||||
2025-11-05T17:40:15-05:00,3.20,9.00,12.20,73.0,68.0
|
||||
2025-11-05T17:40:16-05:00,62.06,9.00,71.06,73.0,68.0
|
||||
2025-11-05T17:40:17-05:00,22.07,9.00,31.07,73.0,68.0
|
||||
2025-11-05T17:40:18-05:00,61.08,9.00,70.08,72.0,68.0
|
||||
2025-11-05T17:40:19-05:00,49.18,9.00,58.18,73.0,68.0
|
||||
2025-11-05T17:40:20-05:00,13.03,9.00,22.03,73.0,68.0
|
||||
2025-11-05T17:40:21-05:00,59.12,10.00,69.12,74.0,68.0
|
||||
2025-11-05T17:40:22-05:00,60.01,9.00,69.01,73.0,68.0
|
||||
2025-11-05T17:40:52-05:00,29.14,9.00,38.14,73.0,68.0
|
||||
2025-11-05T17:40:53-05:00,60.11,9.00,69.11,72.0,68.0
|
||||
2025-11-05T17:40:54-05:00,0.00,11.00,11.00,73.0,68.0
|
||||
2025-11-05T17:40:55-05:00,4.24,10.00,14.24,73.0,68.0
|
||||
2025-11-05T17:40:56-05:00,2.17,9.00,11.17,75.0,68.0
|
||||
2025-11-05T17:40:57-05:00,64.24,9.00,73.24,74.0,68.0
|
||||
2025-11-05T17:40:58-05:00,13.24,9.00,22.24,72.0,68.0
|
||||
2025-11-05T17:40:59-05:00,54.19,9.00,63.19,73.0,68.0
|
||||
2025-11-05T17:41:00-05:00,17.11,9.00,26.11,73.0,68.0
|
||||
2025-11-05T17:41:01-05:00,19.14,9.00,28.14,73.0,68.0
|
||||
2025-11-05T17:41:02-05:00,58.13,9.00,67.13,73.0,68.0
|
||||
2025-11-05T17:41:03-05:00,12.21,9.00,21.21,73.0,68.0
|
||||
2025-11-05T17:41:04-05:00,59.09,10.00,69.09,73.0,68.0
|
||||
2025-11-05T17:41:05-05:00,16.12,9.00,25.12,72.0,68.0
|
||||
2025-11-05T17:41:06-05:00,2.03,9.00,11.03,73.0,68.0
|
||||
2025-11-05T17:41:07-05:00,57.08,10.00,67.08,73.0,68.0
|
||||
2025-11-05T17:41:08-05:00,41.01,9.00,50.01,72.0,68.0
|
||||
2025-11-05T17:41:09-05:00,6.06,10.00,16.06,73.0,68.0
|
||||
2025-11-05T17:41:10-05:00,2.24,9.00,11.24,73.0,68.0
|
||||
2025-11-05T17:41:11-05:00,45.04,10.00,55.04,72.0,68.0
|
||||
2025-11-05T17:41:12-05:00,51.11,9.00,60.11,73.0,68.0
|
||||
2025-11-05T17:43:06-05:00,57.03,9.00,66.03,72.0,68.0
|
||||
2025-11-05T17:43:07-05:00,63.10,9.00,72.10,73.0,68.0
|
||||
2025-11-05T17:43:08-05:00,43.16,9.00,52.16,72.0,68.0
|
||||
2025-11-05T17:43:09-05:00,57.22,10.00,67.22,72.0,68.0
|
||||
2025-11-05T17:43:10-05:00,25.02,9.00,34.02,73.0,68.0
|
||||
2025-11-05T17:43:11-05:00,50.18,10.00,60.18,74.0,68.0
|
||||
2025-11-05T17:43:12-05:00,56.07,10.00,66.07,73.0,68.0
|
||||
2025-11-05T17:43:13-05:00,40.12,9.00,49.12,73.0,68.0
|
||||
2025-11-05T17:43:14-05:00,9.04,9.00,18.04,73.0,68.0
|
||||
2025-11-05T17:43:15-05:00,38.06,9.00,47.06,73.0,68.0
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue