#!/bin/bash
# Quick GPU load test to see if GPU boosts under auto mode
echo "=== PRE-LOAD ==="
HWMON=$(find /sys/class/drm/card0/device/hwmon -maxdepth 1 -name 'hwmon*' | head -1)
cat "$HWMON/freq1_input"
cat /sys/class/drm/card0/device/pp_dpm_sclk

echo "=== STARTING GPU LOAD (vulkaninfo stress) ==="
# Run a simple compute load - just spam vulkaninfo
for i in $(seq 1 5); do
  vulkaninfo --summary >/dev/null 2>&1 &
done

# Try a GPU shader compilation workload with glslang if available
if command -v glslangValidator &>/dev/null; then
  echo "using glslang for load..."
fi

sleep 2
echo "=== DURING LOAD ==="
cat "$HWMON/freq1_input"
cat /sys/class/drm/card0/device/pp_dpm_sclk
cat "$HWMON/temp1_input"
echo "^temp mC"
cat "$HWMON/power1_input" 2>/dev/null || cat "$HWMON/power1_average" 2>/dev/null
echo "^power uW"

wait
sleep 1
echo "=== POST LOAD ==="
cat "$HWMON/freq1_input"
cat /sys/class/drm/card0/device/pp_dpm_sclk
