aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2017-01-11 10:16:04 -0500
committerShuah Khan <shuahkh@osg.samsung.com>2017-01-19 12:30:28 -0500
commit4da39ceb269cee9f96815a54f97931a7e59f9e7f (patch)
tree327d936c899ed5cd7488f84c5358419364399ee9
parent99c21f6d004d07667d7345e56e44a5b805e1dfa9 (diff)
cpupower: Restore format of frequency-info limit
The intel_pstate kselftest expects that the output of `cpupower frequency-info -l | tail -1 | awk ' { print $1 } '` to get frequency limits. This does not work after the following two changes. - 562e5f1a3: rework the "cpupower frequency-info" command (Jacob Tanenbaum) removed parsable limit output - ce512b840: Do not analyse offlined cpus (Thomas Renninger) added newline to break limit parsing more This change preserves human readable output if wanted as well as parsable output for scripts/tests. Cc: Thomas Renninger <trenn@suse.com> Cc: "Shreyas B. Prabhu" <shreyas@linux.vnet.ibm.com> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: linux-pm@vger.kernel.org Signed-off-by: Stafford Horne <shorne@gmail.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
-rw-r--r--tools/power/cpupower/utils/cpufreq-info.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index 590d12a25f6e..3e701f0e9c14 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -285,20 +285,24 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human)
285 285
286/* --hwlimits / -l */ 286/* --hwlimits / -l */
287 287
288static int get_hardware_limits(unsigned int cpu) 288static int get_hardware_limits(unsigned int cpu, unsigned int human)
289{ 289{
290 unsigned long min, max; 290 unsigned long min, max;
291 291
292 printf(_(" hardware limits: "));
293 if (cpufreq_get_hardware_limits(cpu, &min, &max)) { 292 if (cpufreq_get_hardware_limits(cpu, &min, &max)) {
294 printf(_("Not Available\n")); 293 printf(_("Not Available\n"));
295 return -EINVAL; 294 return -EINVAL;
296 } 295 }
297 296
298 print_speed(min); 297 if (human) {
299 printf(" - "); 298 printf(_(" hardware limits: "));
300 print_speed(max); 299 print_speed(min);
301 printf("\n"); 300 printf(" - ");
301 print_speed(max);
302 printf("\n");
303 } else {
304 printf("%lu %lu\n", min, max);
305 }
302 return 0; 306 return 0;
303} 307}
304 308
@@ -456,7 +460,7 @@ static void debug_output_one(unsigned int cpu)
456 get_related_cpus(cpu); 460 get_related_cpus(cpu);
457 get_affected_cpus(cpu); 461 get_affected_cpus(cpu);
458 get_latency(cpu, 1); 462 get_latency(cpu, 1);
459 get_hardware_limits(cpu); 463 get_hardware_limits(cpu, 1);
460 464
461 freqs = cpufreq_get_available_frequencies(cpu); 465 freqs = cpufreq_get_available_frequencies(cpu);
462 if (freqs) { 466 if (freqs) {
@@ -622,7 +626,7 @@ int cmd_freq_info(int argc, char **argv)
622 ret = get_driver(cpu); 626 ret = get_driver(cpu);
623 break; 627 break;
624 case 'l': 628 case 'l':
625 ret = get_hardware_limits(cpu); 629 ret = get_hardware_limits(cpu, human);
626 break; 630 break;
627 case 'w': 631 case 'w':
628 ret = get_freq_hardware(cpu, human); 632 ret = get_freq_hardware(cpu, human);
@@ -639,7 +643,6 @@ int cmd_freq_info(int argc, char **argv)
639 } 643 }
640 if (ret) 644 if (ret)
641 return ret; 645 return ret;
642 printf("\n");
643 } 646 }
644 return ret; 647 return ret;
645} 648}