File intel_pstate.patch of Package pm-profiler

intel_pstate driver has only "powersave" and "performance" governors. intel_pstate "powersave"
acts the same way as "ondemand" for the other drivers. Adjust code to set governor to
"powersave" when anything other than "performance" is requested.


--- pm-profiler-0.1_20111222/tools/enable-profile.orig	2011-12-22 08:36:52.000000000 +0100
+++ pm-profiler-0.1_20111222/tools/enable-profile	2015-09-24 12:47:58.501765806 +0200
@@ -33,8 +33,14 @@ if [ "$?" != "0" ]; then
 fi
 
 function cpufreq_governor {
-    for I in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
-	echo $CPUFREQ_GOVERNOR > $I
+    for I in /sys/devices/system/cpu/cpu[[:digit:]]*/cpufreq; do
+        Driver=`cat $I/scaling_driver`
+        # intel_pstate has no ondemand governor, powersave handles this just fine
+        if [ "$Driver" = "intel_pstate" -a "$CPUFREQ_GOVERNOR" != "performance" ]; then
+            echo powersave > $I/scaling_governor
+        else
+            echo $CPUFREQ_GOVERNOR > $I/scaling_governor
+        fi
     done
 }
 
@@ -111,5 +117,3 @@ echo $PROFILE > $STATEFILE
 
 
 exit 0
-
-#sed -e "s/CURRENT_PROFILE=\".*\"/CURRENT_PROFILE=\"$PROFILE\"/g" -i /etc/pm-profiler.conf
openSUSE Build Service is sponsored by