Skip to content

Instantly share code, notes, and snippets.

@tpruzina
Created November 28, 2018 17:13
Show Gist options
  • Save tpruzina/1f58ae12033d044ab72e995a4b57c129 to your computer and use it in GitHub Desktop.
Save tpruzina/1f58ae12033d044ab72e995a4b57c129 to your computer and use it in GitHub Desktop.
Print a CSV formatted graph of nvidia perf stats just after the GPU was put under load ( nvidia pwr bug, https://i.imgur.com/I6QHcyp.png )
#!/bin/bash
BENCH=glxspheres64
SPIN_TIME=10
OUT_CSV=$(mktemp)
export __GL_SYNC_TO_VBLANK=0
${BENCH} &> /dev/null &
PID=$!
sleep $SPIN_TIME
kill $(jobs -rp)
wait $(jobs -rp) 2>/dev/null
echo "SECONDS,CORE_FREQ,MEM_FREQ,PERF_STATE,POWER_USED,POWER_LIMIT,MEMORY_USED, MEMORY" | tee ${OUT_CSV}
for t in $(seq 0 50)
do
CORE_MEM_FQS=$(nvidia-settings -t -q GPUCurrentClockFreqs 2>/dev/null | head -n 1)
PERF_PU_PL_MU_MM=$(nvidia-smi |
grep -o 'P.*W.*W.*MiB' |
grep -o '[0-9,\w]*' |
tr '\n' ',')
echo "${t},${CORE_MEM_FQS},${PERF_PU_PL_MU_MM::-1}" | tee -a ${OUT_CSV}
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment