[Xfce4-commits] <xfce4-cpufreq-plugin:master> Show max performance value by default when using intel pstate driver.

Harald Judt noreply at xfce.org
Tue Aug 20 20:44:01 CEST 2013


Updating branch refs/heads/master
         to 1b7dfa6c25ac8d684f7530e52ca43375c30ff8b4 (commit)
       from 92adcd259c605d8f5256ca20c2d639c4e3c6cfc8 (commit)

commit 1b7dfa6c25ac8d684f7530e52ca43375c30ff8b4
Author: Harald Judt <h.judt at gmx.at>
Date:   Tue Aug 20 20:39:16 2013 +0200

    Show max performance value by default when using intel pstate driver.

 panel-plugin/xfce4-cpufreq-linux.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/xfce4-cpufreq-linux.c b/panel-plugin/xfce4-cpufreq-linux.c
index 585028b..23fbcef 100644
--- a/panel-plugin/xfce4-cpufreq-linux.c
+++ b/panel-plugin/xfce4-cpufreq-linux.c
@@ -458,9 +458,22 @@ cpufreq_linux_init (void)
 	if (cpuFreq->cpus == NULL)
 		return FALSE;
 
-	if (g_file_test ("/sys/devices/system/cpu/intel_pstate", G_FILE_TEST_EXISTS))
-		return cpufreq_cpu_intel_pstate_read ();
-	else if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq",
+	if (g_file_test ("/sys/devices/system/cpu/intel_pstate", G_FILE_TEST_EXISTS)) {
+		gboolean ret = cpufreq_cpu_intel_pstate_read ();
+
+		/* Tools like i7z show the current real frequency using the
+		   current maximum performance. Assuming this is the proper
+		   way to do it, let's choose the maximum per default. Most
+		   CPUs nowadays have more than one core anyway, so there will
+		   not be much use in showing a single core's performance
+		   value. Besides, it's not very likely the user wants to
+		   follow values for 4 or 8 cores per second. */
+		if (ret && cpuFreq->options->show_warning) {
+			cpuFreq->options->show_cpu = CPU_MAX;
+			cpuFreq->options->show_warning = FALSE;
+		}
+		return ret;
+	} else if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq",
 						  G_FILE_TEST_EXISTS))
 		return cpufreq_cpu_read_sysfs ();
 	else if (g_file_test ("/proc/cpufreq", G_FILE_TEST_EXISTS))


More information about the Xfce4-commits mailing list