summaryrefslogtreecommitdiff
path: root/tools/power/cpupower/utils/cpuidle-set.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-11-11 23:22:56 (GMT)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-11-11 23:22:56 (GMT)
commitf57ab32a843690fe7431ebb3a2f461e689a2e3c7 (patch)
treeb1316569e599668d1dd028297b569fe2ef75f651 /tools/power/cpupower/utils/cpuidle-set.c
parentf6f18a261c1748973e9aac529ed81bb4abd9f120 (diff)
parent89ba7d8c22acb43e318ca1c82e25c8b75ef7a7b2 (diff)
downloadlinux-f57ab32a843690fe7431ebb3a2f461e689a2e3c7.tar.xz
Merge branch 'pm-tools'
* pm-tools: Creating a common structure initialization pattern for struct option cpupower: Enable disabled Cstates if they are below max latency cpupower: Remove debug message when using cpupower idle-set -D switch cpupower: cpupower monitor reports uninitialized values for offline cpus tools/power turbostat: bugfix: print MAX_NON_TURBO_RATIO tools/power turbostat: simplify Bzy_MHz calculation
Diffstat (limited to 'tools/power/cpupower/utils/cpuidle-set.c')
-rw-r--r--tools/power/cpupower/utils/cpuidle-set.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/tools/power/cpupower/utils/cpuidle-set.c b/tools/power/cpupower/utils/cpuidle-set.c
index d45d8d7..d6b6ae4 100644
--- a/tools/power/cpupower/utils/cpuidle-set.c
+++ b/tools/power/cpupower/utils/cpuidle-set.c
@@ -13,15 +13,11 @@
#include "helpers/sysfs.h"
static struct option info_opts[] = {
- { .name = "disable",
- .has_arg = required_argument, .flag = NULL, .val = 'd'},
- { .name = "enable",
- .has_arg = required_argument, .flag = NULL, .val = 'e'},
- { .name = "disable-by-latency",
- .has_arg = required_argument, .flag = NULL, .val = 'D'},
- { .name = "enable-all",
- .has_arg = no_argument, .flag = NULL, .val = 'E'},
- { },
+ {"disable", required_argument, NULL, 'd'},
+ {"enable", required_argument, NULL, 'e'},
+ {"disable-by-latency", required_argument, NULL, 'D'},
+ {"enable-all", no_argument, NULL, 'E'},
+ { },
};
@@ -148,14 +144,21 @@ int cmd_idle_set(int argc, char **argv)
(cpu, idlestate);
state_latency = sysfs_get_idlestate_latency
(cpu, idlestate);
- printf("CPU: %u - idlestate %u - state_latency: %llu - latency: %llu\n",
- cpu, idlestate, state_latency, latency);
- if (disabled == 1 || latency > state_latency)
+ if (disabled == 1) {
+ if (latency > state_latency){
+ ret = sysfs_idlestate_disable
+ (cpu, idlestate, 0);
+ if (ret == 0)
+ printf(_("Idlestate %u enabled on CPU %u\n"), idlestate, cpu);
+ }
continue;
- ret = sysfs_idlestate_disable
- (cpu, idlestate, 1);
- if (ret == 0)
+ }
+ if (latency <= state_latency){
+ ret = sysfs_idlestate_disable
+ (cpu, idlestate, 1);
+ if (ret == 0)
printf(_("Idlestate %u disabled on CPU %u\n"), idlestate, cpu);
+ }
}
break;
case 'E':