Skip to content

Instantly share code, notes, and snippets.

@nottux
Last active September 10, 2019 19:58
Show Gist options
  • Save nottux/f59fe53ae9eacd1c8c09b21202df638d to your computer and use it in GitHub Desktop.
Save nottux/f59fe53ae9eacd1c8c09b21202df638d to your computer and use it in GitHub Desktop.
dpm utilities
{sudo password here} {device number here} {.wav file here} {temperature degree here} {screenshot directory}
To watch temperature:
#old_one:
while true;do a=$(echo {sudo password here}|sudo -S cat /sys/kernel/debug/dri/{device number here}/amdgpu_pm_info|grep Temperature|tr -d ' GPUTmpratueC:');echo $a;cat /sys/class/drm/card{device number here}/device/power_dpm_force_performance_level;if [ $a -gt {temperature degree here} -a $a -ne 511 ];then aplay --device=pulse {.wav file here};else echo cool;fi;sleep 5;done
#New one:
while true;do a=$(echo {sudo password here}|sudo -S cat /sys/kernel/debug/dri/{device number here}/amdgpu_pm_info|grep Temperature|tr -d ' GPUTmpratueC:');echo $a;cat /sys/class/drm/card{device number here}/device/power_dpm_force_performance_level;if [ $a -gt {temperature degree here} -a $a -ne 511 -a $(cat /sys/class/drm/card{device number here}/device/power_dpm_force_performance_level) != auto ];then echo {sudo password here}|sudo -S su -c 'echo auto>/sys/class/drm/card{device number here}/device/power_dpm_force_performance_level';aplay --device=pulse {.wav file here};echo gpu set to auto;else echo cool;fi;sleep 5;done
To change dpm:
sh -c "echo {sudo password here}|sudo -S su -c 'if [ $(cat /sys/class/drm/card{device number here}/device/power_dpm_force_performance_level) != "high" ];then echo high>/sys/class/drm/card{device number here}/device/power_dpm_force_performance_level;else echo low>/sys/class/drm/card{device number here}/device/power_dpm_force_performance_level;fi'"
To change dpm to auto:
sh -c "echo {sudo password here}|sudo -S su -c 'if [ $(cat /sys/class/drm/card{device number here}/device/power_dpm_force_performance_level) != "auto" ];then echo auto>/sys/class/drm/card{device number here}/device/power_dpm_force_performance_level;fi'"
To set governer to "performance":
echo {sudo password here}|sudo -S su -c 'echo performance|tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor'
To enable boosting:
echo {sudo password here}|sudo -S su -c 'echo 1|tee /sys/devices/system/cpu/cpufreq/boost'
To take screenshot with scrot (requires date and scrot):
sh -c 'scrot /dev/shm/scrotshot.png;mv /dev/shm/scrotshot.png {screenshot directory}/$(date +%Y-%m-%d_%H:%M:%S:%N).png'
@nottux
Copy link
Author

nottux commented Sep 2, 2019

added -a $a -ne 511 to remove accidental beep after exiting a vulkan application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment