power update/ added plot python script for runner to use
All checks were successful
Generate Power Graph / plot (push) Successful in 2m4s
All checks were successful
Generate Power Graph / plot (push) Successful in 2m4s
This commit is contained in:
parent
619524c75e
commit
f792c5fb45
2 changed files with 208 additions and 0 deletions
64
plot_power.py
Normal file
64
plot_power.py
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
plot_power.py
|
||||||
|
Generates a PNG graph from power_log.csv for AMD Laptop APU/GPU telemetry.
|
||||||
|
Designed for Forgejo CI artifact publishing.
|
||||||
|
Author: MarkMental
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
# --- Configuration ---
|
||||||
|
CSV_PATH = "power_log.csv"
|
||||||
|
OUTPUT_FILE = "power_graph.png"
|
||||||
|
|
||||||
|
print(f"📊 Reading {CSV_PATH}...")
|
||||||
|
|
||||||
|
# --- Load data ---
|
||||||
|
try:
|
||||||
|
df = pd.read_csv(CSV_PATH)
|
||||||
|
except FileNotFoundError:
|
||||||
|
raise SystemExit(f"❌ CSV not found: {CSV_PATH}")
|
||||||
|
|
||||||
|
# --- Sanity checks ---
|
||||||
|
required_cols = {"timestamp", "apu_w", "gpu_w", "total_w"}
|
||||||
|
if not required_cols.issubset(df.columns):
|
||||||
|
raise SystemExit(f"❌ Missing columns in {CSV_PATH}. Found: {df.columns.tolist()}")
|
||||||
|
|
||||||
|
# --- Parse timestamps ---
|
||||||
|
try:
|
||||||
|
df["timestamp"] = pd.to_datetime(df["timestamp"], errors="coerce")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"⚠️ Failed to parse some timestamps: {e}")
|
||||||
|
|
||||||
|
# --- Plot ---
|
||||||
|
plt.figure(figsize=(10, 5))
|
||||||
|
plt.plot(df["timestamp"], df["apu_w"], label="APU Power (W)", color="orange", linewidth=1.3)
|
||||||
|
plt.plot(df["timestamp"], df["gpu_w"], label="GPU Power (W)", color="green", linewidth=1.3)
|
||||||
|
plt.plot(df["timestamp"], df["total_w"], label="Total Power (W)", color="blue", linewidth=1.5)
|
||||||
|
|
||||||
|
# Optional: plot temperatures if present
|
||||||
|
if "apu_temp" in df.columns and "gpu_temp" in df.columns:
|
||||||
|
ax2 = plt.gca().twinx()
|
||||||
|
ax2.plot(df["timestamp"], df["apu_temp"], "--", color="red", alpha=0.4, label="APU Temp (°C)")
|
||||||
|
ax2.plot(df["timestamp"], df["gpu_temp"], "--", color="purple", alpha=0.4, label="GPU Temp (°C)")
|
||||||
|
ax2.set_ylabel("Temperature (°C)")
|
||||||
|
lines, labels = plt.gca().get_legend_handles_labels()
|
||||||
|
lines2, labels2 = ax2.get_legend_handles_labels()
|
||||||
|
plt.legend(lines + lines2, labels + labels2, loc="upper left")
|
||||||
|
else:
|
||||||
|
plt.legend(loc="upper left")
|
||||||
|
|
||||||
|
plt.title("AMD TUF Power Log")
|
||||||
|
plt.xlabel("Time")
|
||||||
|
plt.ylabel("Power (Watts)")
|
||||||
|
plt.grid(True, alpha=0.3)
|
||||||
|
plt.xticks(rotation=45)
|
||||||
|
plt.tight_layout()
|
||||||
|
|
||||||
|
# --- Save ---
|
||||||
|
plt.savefig(OUTPUT_FILE, dpi=120)
|
||||||
|
print(f"✅ Saved graph: {OUTPUT_FILE}")
|
||||||
|
|
||||||
144
power_log.csv
144
power_log.csv
|
|
@ -336,3 +336,147 @@ timestamp,apu_w,gpu_w,total_w,apu_temp,gpu_temp
|
||||||
2025-11-05T18:25:39-05:00,64.01,9.00,73.01,74.0,67.0
|
2025-11-05T18:25:39-05:00,64.01,9.00,73.01,74.0,67.0
|
||||||
2025-11-05T18:25:40-05:00,12.23,9.00,21.23,71.0,67.0
|
2025-11-05T18:25:40-05:00,12.23,9.00,21.23,71.0,67.0
|
||||||
2025-11-05T18:25:41-05:00,4.06,9.00,13.06,71.0,67.0
|
2025-11-05T18:25:41-05:00,4.06,9.00,13.06,71.0,67.0
|
||||||
|
2025-11-05T18:31:45-05:00,46.25,9.00,55.25,71.0,67.0
|
||||||
|
2025-11-05T18:31:46-05:00,62.02,9.00,71.02,73.0,67.0
|
||||||
|
2025-11-05T18:31:47-05:00,46.16,9.00,55.16,71.0,67.0
|
||||||
|
2025-11-05T18:31:48-05:00,13.15,9.00,22.15,71.0,67.0
|
||||||
|
2025-11-05T18:31:49-05:00,9.05,10.00,19.05,72.0,67.0
|
||||||
|
2025-11-05T18:31:50-05:00,54.24,9.00,63.24,72.0,67.0
|
||||||
|
2025-11-05T18:31:51-05:00,45.03,9.00,54.03,71.0,67.0
|
||||||
|
2025-11-05T18:31:52-05:00,7.08,9.00,16.08,71.0,67.0
|
||||||
|
2025-11-05T18:31:53-05:00,1.09,9.00,10.09,71.0,67.0
|
||||||
|
2025-11-05T18:31:54-05:00,51.06,9.00,60.06,71.0,67.0
|
||||||
|
2025-11-05T18:31:55-05:00,1.06,9.00,10.06,73.0,67.0
|
||||||
|
2025-11-05T18:31:56-05:00,46.24,9.00,55.24,71.0,67.0
|
||||||
|
2025-11-05T18:31:57-05:00,61.11,9.00,70.11,71.0,67.0
|
||||||
|
2025-11-05T18:31:58-05:00,1.18,9.00,10.18,71.0,67.0
|
||||||
|
2025-11-05T18:31:59-05:00,48.09,9.00,57.09,71.0,67.0
|
||||||
|
2025-11-05T18:32:00-05:00,59.05,9.00,68.05,72.0,67.0
|
||||||
|
2025-11-05T18:32:01-05:00,2.02,9.00,11.02,71.0,67.0
|
||||||
|
2025-11-05T18:32:02-05:00,57.17,9.00,66.17,72.0,67.0
|
||||||
|
2025-11-05T18:32:03-05:00,65.03,9.00,74.03,72.0,67.0
|
||||||
|
2025-11-05T18:32:04-05:00,12.02,9.00,21.02,71.0,67.0
|
||||||
|
2025-11-05T18:32:05-05:00,62.02,9.00,71.02,72.0,67.0
|
||||||
|
2025-11-05T18:32:06-05:00,52.20,9.00,61.20,72.0,67.0
|
||||||
|
2025-11-05T18:32:07-05:00,63.20,9.00,72.20,71.0,67.0
|
||||||
|
2025-11-05T18:32:08-05:00,47.19,9.00,56.19,71.0,67.0
|
||||||
|
2025-11-05T18:32:09-05:00,49.22,9.00,58.22,71.0,67.0
|
||||||
|
2025-11-05T18:32:10-05:00,8.22,9.00,17.22,72.0,67.0
|
||||||
|
2025-11-05T18:32:11-05:00,3.16,9.00,12.16,71.0,67.0
|
||||||
|
2025-11-05T18:32:12-05:00,47.17,9.00,56.17,72.0,67.0
|
||||||
|
2025-11-05T18:32:13-05:00,51.12,9.00,60.12,71.0,67.0
|
||||||
|
2025-11-05T18:32:14-05:00,55.08,9.00,64.08,71.0,67.0
|
||||||
|
2025-11-05T18:32:16-05:00,63.14,9.00,72.14,71.0,67.0
|
||||||
|
2025-11-05T18:32:17-05:00,46.20,9.00,55.20,71.0,67.0
|
||||||
|
2025-11-05T18:32:18-05:00,8.25,9.00,17.25,71.0,67.0
|
||||||
|
2025-11-05T18:32:19-05:00,56.05,9.00,65.05,71.0,67.0
|
||||||
|
2025-11-05T18:32:20-05:00,6.24,9.00,15.24,71.0,67.0
|
||||||
|
2025-11-05T18:32:21-05:00,55.09,9.00,64.09,72.0,67.0
|
||||||
|
2025-11-05T18:32:22-05:00,1.17,9.00,10.17,71.0,67.0
|
||||||
|
2025-11-05T18:32:23-05:00,2.01,9.00,11.01,71.0,67.0
|
||||||
|
2025-11-05T18:32:24-05:00,50.10,9.00,59.10,72.0,67.0
|
||||||
|
2025-11-05T18:32:25-05:00,50.16,9.00,59.16,71.0,67.0
|
||||||
|
2025-11-05T18:32:26-05:00,44.09,9.00,53.09,75.0,67.0
|
||||||
|
2025-11-05T18:32:27-05:00,55.12,9.00,64.12,71.0,67.0
|
||||||
|
2025-11-05T18:32:28-05:00,61.03,9.00,70.03,71.0,67.0
|
||||||
|
2025-11-05T18:32:29-05:00,61.02,9.00,70.02,72.0,67.0
|
||||||
|
2025-11-05T18:32:30-05:00,2.19,9.00,11.19,71.0,67.0
|
||||||
|
2025-11-05T18:32:31-05:00,55.18,9.00,64.18,71.0,67.0
|
||||||
|
2025-11-05T18:32:32-05:00,4.17,9.00,13.17,72.0,67.0
|
||||||
|
2025-11-05T18:32:33-05:00,54.12,9.00,63.12,71.0,67.0
|
||||||
|
2025-11-05T18:32:34-05:00,1.21,9.00,10.21,72.0,67.0
|
||||||
|
2025-11-05T18:32:35-05:00,59.12,9.00,68.12,71.0,67.0
|
||||||
|
2025-11-05T18:32:36-05:00,0.15,9.00,9.15,71.0,67.0
|
||||||
|
2025-11-05T18:32:37-05:00,54.09,9.00,63.09,72.0,67.0
|
||||||
|
2025-11-05T18:32:38-05:00,3.15,9.00,12.15,72.0,67.0
|
||||||
|
2025-11-05T18:32:39-05:00,3.02,9.00,12.02,71.0,67.0
|
||||||
|
2025-11-05T18:32:40-05:00,51.08,9.00,60.08,71.0,67.0
|
||||||
|
2025-11-05T18:32:41-05:00,60.15,9.00,69.15,71.0,67.0
|
||||||
|
2025-11-05T18:32:42-05:00,60.02,9.00,69.02,71.0,67.0
|
||||||
|
2025-11-05T18:32:43-05:00,53.19,9.00,62.19,72.0,67.0
|
||||||
|
2025-11-05T18:32:44-05:00,55.24,9.00,64.24,71.0,67.0
|
||||||
|
2025-11-05T18:32:45-05:00,14.07,9.00,23.07,71.0,67.0
|
||||||
|
2025-11-05T18:32:46-05:00,64.09,9.00,73.09,71.0,67.0
|
||||||
|
2025-11-05T18:32:47-05:00,60.04,9.00,69.04,71.0,67.0
|
||||||
|
2025-11-05T18:32:48-05:00,58.24,9.00,67.24,72.0,67.0
|
||||||
|
2025-11-05T18:32:49-05:00,57.20,9.00,66.20,72.0,67.0
|
||||||
|
2025-11-05T18:32:50-05:00,61.25,9.00,70.25,72.0,67.0
|
||||||
|
2025-11-05T18:32:51-05:00,56.23,9.00,65.23,71.0,67.0
|
||||||
|
2025-11-05T18:32:52-05:00,47.19,9.00,56.19,71.0,67.0
|
||||||
|
2025-11-05T18:32:53-05:00,48.01,10.00,58.01,71.0,67.0
|
||||||
|
2025-11-05T18:32:54-05:00,5.09,10.00,15.09,71.0,67.0
|
||||||
|
2025-11-05T18:32:55-05:00,47.23,9.00,56.23,71.0,67.0
|
||||||
|
2025-11-05T18:32:56-05:00,59.01,9.00,68.01,71.0,67.0
|
||||||
|
2025-11-05T18:32:57-05:00,51.08,9.00,60.08,73.0,67.0
|
||||||
|
2025-11-05T18:32:58-05:00,54.16,9.00,63.16,71.0,67.0
|
||||||
|
2025-11-05T18:32:59-05:00,43.14,9.00,52.14,73.0,67.0
|
||||||
|
2025-11-05T18:33:00-05:00,65.03,9.00,74.03,72.0,67.0
|
||||||
|
2025-11-05T18:33:01-05:00,50.12,9.00,59.12,71.0,67.0
|
||||||
|
2025-11-05T18:33:02-05:00,59.22,9.00,68.22,72.0,67.0
|
||||||
|
2025-11-05T18:33:03-05:00,63.04,9.00,72.04,71.0,67.0
|
||||||
|
2025-11-05T18:33:04-05:00,2.03,9.00,11.03,71.0,67.0
|
||||||
|
2025-11-05T18:33:05-05:00,3.16,9.00,12.16,72.0,67.0
|
||||||
|
2025-11-05T18:33:06-05:00,47.11,9.00,56.11,72.0,67.0
|
||||||
|
2025-11-05T18:33:07-05:00,46.11,9.00,55.11,71.0,67.0
|
||||||
|
2025-11-05T18:33:08-05:00,50.13,9.00,59.13,70.0,67.0
|
||||||
|
2025-11-05T18:33:09-05:00,49.21,9.00,58.21,71.0,67.0
|
||||||
|
2025-11-05T18:33:10-05:00,55.09,9.00,64.09,71.0,67.0
|
||||||
|
2025-11-05T18:33:11-05:00,52.04,9.00,61.04,71.0,67.0
|
||||||
|
2025-11-05T18:33:12-05:00,44.10,9.00,53.10,71.0,67.0
|
||||||
|
2025-11-05T18:33:13-05:00,63.18,9.00,72.18,72.0,67.0
|
||||||
|
2025-11-05T18:33:14-05:00,64.16,9.00,73.16,72.0,67.0
|
||||||
|
2025-11-05T18:33:15-05:00,56.16,9.00,65.16,72.0,67.0
|
||||||
|
2025-11-05T18:33:16-05:00,50.03,9.00,59.03,71.0,67.0
|
||||||
|
2025-11-05T18:33:17-05:00,58.16,9.00,67.16,71.0,67.0
|
||||||
|
2025-11-05T18:33:18-05:00,5.11,9.00,14.11,72.0,67.0
|
||||||
|
2025-11-05T18:33:19-05:00,52.11,9.00,61.11,71.0,67.0
|
||||||
|
2025-11-05T18:33:20-05:00,47.19,9.00,56.19,71.0,67.0
|
||||||
|
2025-11-05T18:33:21-05:00,53.18,9.00,62.18,71.0,67.0
|
||||||
|
2025-11-05T18:33:22-05:00,1.07,9.00,10.07,70.0,67.0
|
||||||
|
2025-11-05T18:33:23-05:00,39.18,9.00,48.18,71.0,67.0
|
||||||
|
2025-11-05T18:33:24-05:00,16.07,9.00,25.07,71.0,67.0
|
||||||
|
2025-11-05T18:33:25-05:00,1.17,9.00,10.17,71.0,67.0
|
||||||
|
2025-11-05T18:33:26-05:00,48.07,9.00,57.07,70.0,67.0
|
||||||
|
2025-11-05T18:33:27-05:00,58.01,9.00,67.01,73.0,67.0
|
||||||
|
2025-11-05T18:33:28-05:00,0.13,9.00,9.13,71.0,67.0
|
||||||
|
2025-11-05T18:33:29-05:00,47.10,9.00,56.10,72.0,67.0
|
||||||
|
2025-11-05T18:33:30-05:00,59.08,9.00,68.08,72.0,67.0
|
||||||
|
2025-11-05T18:33:31-05:00,59.04,9.00,68.04,71.0,67.0
|
||||||
|
2025-11-05T18:33:32-05:00,5.06,9.00,14.06,71.0,67.0
|
||||||
|
2025-11-05T18:33:33-05:00,48.10,9.00,57.10,71.0,67.0
|
||||||
|
2025-11-05T18:33:34-05:00,1.19,9.00,10.19,72.0,67.0
|
||||||
|
2025-11-05T18:33:35-05:00,47.05,9.00,56.05,71.0,67.0
|
||||||
|
2025-11-05T18:33:36-05:00,4.09,9.00,13.09,74.0,67.0
|
||||||
|
2025-11-05T18:33:37-05:00,42.23,9.00,51.23,71.0,67.0
|
||||||
|
2025-11-05T18:33:39-05:00,10.05,9.00,19.05,71.0,67.0
|
||||||
|
2025-11-05T18:33:40-05:00,14.21,9.00,23.21,72.0,67.0
|
||||||
|
2025-11-05T18:33:41-05:00,5.16,9.00,14.16,71.0,67.0
|
||||||
|
2025-11-05T18:33:42-05:00,5.21,9.00,14.21,72.0,67.0
|
||||||
|
2025-11-05T18:33:43-05:00,64.05,9.00,73.05,71.0,67.0
|
||||||
|
2025-11-05T18:33:44-05:00,57.25,9.00,66.25,72.0,67.0
|
||||||
|
2025-11-05T18:33:45-05:00,11.05,9.00,20.05,71.0,67.0
|
||||||
|
2025-11-05T18:33:46-05:00,57.16,9.00,66.16,71.0,67.0
|
||||||
|
2025-11-05T18:33:47-05:00,47.22,9.00,56.22,71.0,67.0
|
||||||
|
2025-11-05T18:33:48-05:00,0.18,9.00,9.18,71.0,67.0
|
||||||
|
2025-11-05T18:33:49-05:00,57.19,9.00,66.19,72.0,67.0
|
||||||
|
2025-11-05T18:33:50-05:00,47.19,9.00,56.19,71.0,67.0
|
||||||
|
2025-11-05T18:33:51-05:00,48.20,9.00,57.20,71.0,67.0
|
||||||
|
2025-11-05T18:33:52-05:00,46.10,9.00,55.10,71.0,67.0
|
||||||
|
2025-11-05T18:33:53-05:00,7.09,9.00,16.09,72.0,67.0
|
||||||
|
2025-11-05T18:33:54-05:00,52.21,9.00,61.21,71.0,67.0
|
||||||
|
2025-11-05T18:33:55-05:00,45.17,9.00,54.17,71.0,67.0
|
||||||
|
2025-11-05T18:33:56-05:00,56.12,9.00,65.12,71.0,67.0
|
||||||
|
2025-11-05T18:33:57-05:00,61.07,9.00,70.07,71.0,67.0
|
||||||
|
2025-11-05T18:33:58-05:00,37.14,9.00,46.14,72.0,67.0
|
||||||
|
2025-11-05T18:33:59-05:00,5.22,9.00,14.22,71.0,67.0
|
||||||
|
2025-11-05T18:34:00-05:00,63.24,9.00,72.24,71.0,67.0
|
||||||
|
2025-11-05T18:34:01-05:00,55.05,10.00,65.05,71.0,67.0
|
||||||
|
2025-11-05T18:34:02-05:00,52.23,9.00,61.23,71.0,67.0
|
||||||
|
2025-11-05T18:34:03-05:00,44.17,9.00,53.17,72.0,67.0
|
||||||
|
2025-11-05T18:34:04-05:00,50.08,9.00,59.08,71.0,67.0
|
||||||
|
2025-11-05T18:34:05-05:00,58.01,9.00,67.01,72.0,67.0
|
||||||
|
2025-11-05T18:34:06-05:00,53.01,9.00,62.01,71.0,67.0
|
||||||
|
2025-11-05T18:34:07-05:00,7.06,9.00,16.06,71.0,67.0
|
||||||
|
2025-11-05T18:34:08-05:00,2.14,9.00,11.14,70.0,67.0
|
||||||
|
2025-11-05T18:34:09-05:00,48.09,9.00,57.09,70.0,67.0
|
||||||
|
2025-11-05T18:34:10-05:00,58.19,9.00,67.19,70.0,67.0
|
||||||
|
|
|
||||||
|
Loading…
Add table
Add a link
Reference in a new issue