diff options
author | lukefromdc <[email protected]> | 2017-03-22 23:41:56 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-04-02 21:18:15 +0200 |
commit | fbf54b2422909183d4698130408fa160b81e0d70 (patch) | |
tree | 6ecf8455b867cddf977b30a4665afe58fdb12e88 | |
parent | 4ecda53c28e45573d85deb8a0773286d225c0fa3 (diff) | |
download | mate-applets-fbf54b2422909183d4698130408fa160b81e0d70.tar.bz2 mate-applets-fbf54b2422909183d4698130408fa160b81e0d70.tar.xz |
cpufreq:set frequency on all cores
Still can be set to monitor any given core's speed but sets governor or userspace speed on all cores together
-rw-r--r-- | cpufreq/src/cpufreq-selector.c | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/cpufreq/src/cpufreq-selector.c b/cpufreq/src/cpufreq-selector.c index 58922d0c..59b3dabb 100644 --- a/cpufreq/src/cpufreq-selector.c +++ b/cpufreq/src/cpufreq-selector.c @@ -18,6 +18,7 @@ */ #include <config.h> +#include <sys/sysinfo.h> #ifdef HAVE_POLKIT #include <dbus/dbus-glib.h> @@ -173,16 +174,20 @@ cpufreq_selector_set_frequency_async (CPUFreqSelector *selector, guint cpu, guint frequency) { - SelectorAsyncData *data; + guint cores; + cores = get_nprocs() ; + for (cpu = 0; cpu < cores; cpu = cpu+1){ + SelectorAsyncData *data; - data = g_new0 (SelectorAsyncData, 1); + data = g_new0 (SelectorAsyncData, 1); - data->selector = selector; - data->call = FREQUENCY; - data->cpu = cpu; - data->frequency = frequency; + data->selector = selector; + data->call = FREQUENCY; + data->cpu = cpu; + data->frequency = frequency; - selector_set_frequency_async (data); + selector_set_frequency_async (data); + } } static void @@ -220,16 +225,20 @@ cpufreq_selector_set_governor_async (CPUFreqSelector *selector, guint cpu, const gchar *governor) { - SelectorAsyncData *data; + guint cores; + cores = get_nprocs() ; + for (cpu = 0; cpu < cores; cpu = cpu+1){ + SelectorAsyncData *data; - data = g_new0 (SelectorAsyncData, 1); + data = g_new0 (SelectorAsyncData, 1); - data->selector = selector; - data->call = GOVERNOR; - data->cpu = cpu; - data->governor = g_strdup (governor); + data->selector = selector; + data->call = GOVERNOR; + data->cpu = cpu; + data->governor = g_strdup (governor); - selector_set_governor_async (data); + selector_set_governor_async (data); + } } #else /* !HAVE_POLKIT */ static void @@ -262,11 +271,16 @@ cpufreq_selector_set_frequency_async (CPUFreqSelector *selector, guint cpu, guint frequency) { - gchar *args; + guint cores; + cores = get_nprocs() ; - args = g_strdup_printf ("-c %u -f %u", cpu, frequency); - cpufreq_selector_run_command (selector, args); - g_free (args); + for (cpu = 0; cpu < cores; cpu = cpu+1){ + gchar *args; + + args = g_strdup_printf ("-c %u -f %u", cpu, frequency); + cpufreq_selector_run_command (selector, args); + g_free (args); + } } void @@ -274,10 +288,14 @@ cpufreq_selector_set_governor_async (CPUFreqSelector *selector, guint cpu, const gchar *governor) { - gchar *args; - - args = g_strdup_printf ("-c %u -g %s", cpu, governor); - cpufreq_selector_run_command (selector, args); - g_free (args); + guint cores; + cores = get_nprocs() ; + for (cpu = 0; cpu < cores; cpu = cpu+1){ + gchar *args; + + args = g_strdup_printf ("-c %u -g %s", cpu, governor); + cpufreq_selector_run_command (selector, args); + g_free (args); + } } #endif /* HAVE_POLKIT */ |