mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: Shuah Khan <shuah@kernel.org>, Darren Hart <dvhart@linux.intel.com>
Cc: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stafford Horne <shorne@gmail.com>,
	Thomas Renninger <trenn@suse.com>,
	"Shreyas B. Prabhu" <shreyas@linux.vnet.ibm.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-pm@vger.kernel.org
Subject: [PATCH v2 2/6] cpupower: Restore format of frequency-info limit
Date: Thu, 12 Jan 2017 00:11:15 +0900	[thread overview]
Message-ID: <aa5a9bd71838802d6410155295796fec9214928d.1484146515.git.shorne@gmail.com> (raw)
In-Reply-To: <cover.1484147115.git.shorne@gmail.com>
In-Reply-To: <cover.1484146515.git.shorne@gmail.com>

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>
---
 tools/power/cpupower/utils/cpufreq-info.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index 590d12a..3e701f0 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)
 
 /* --hwlimits / -l */
 
-static int get_hardware_limits(unsigned int cpu)
+static int get_hardware_limits(unsigned int cpu, unsigned int human)
 {
 	unsigned long min, max;
 
-	printf(_("  hardware limits: "));
 	if (cpufreq_get_hardware_limits(cpu, &min, &max)) {
 		printf(_("Not Available\n"));
 		return -EINVAL;
 	}
 
-	print_speed(min);
-	printf(" - ");
-	print_speed(max);
-	printf("\n");
+	if (human) {
+		printf(_("  hardware limits: "));
+		print_speed(min);
+		printf(" - ");
+		print_speed(max);
+		printf("\n");
+	} else {
+		printf("%lu %lu\n", min, max);
+	}
 	return 0;
 }
 
@@ -456,7 +460,7 @@ static void debug_output_one(unsigned int cpu)
 	get_related_cpus(cpu);
 	get_affected_cpus(cpu);
 	get_latency(cpu, 1);
-	get_hardware_limits(cpu);
+	get_hardware_limits(cpu, 1);
 
 	freqs = cpufreq_get_available_frequencies(cpu);
 	if (freqs) {
@@ -622,7 +626,7 @@ int cmd_freq_info(int argc, char **argv)
 			ret = get_driver(cpu);
 			break;
 		case 'l':
-			ret = get_hardware_limits(cpu);
+			ret = get_hardware_limits(cpu, human);
 			break;
 		case 'w':
 			ret = get_freq_hardware(cpu, human);
@@ -639,7 +643,6 @@ int cmd_freq_info(int argc, char **argv)
 		}
 		if (ret)
 			return ret;
-		printf("\n");
 	}
 	return ret;
 }
-- 
2.9.3

  parent reply	other threads:[~2017-01-11 15:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 15:11 [PATCH v2 0/6] Selftests fixes for futex and intel_pstate Stafford Horne
2017-01-11 15:11 ` [PATCH v2 1/6] selftests/futex: Add stdio used for logging Stafford Horne
     [not found] ` <cover.1484146515.git.shorne@gmail.com>
2017-01-11 15:11   ` Stafford Horne [this message]
2017-01-11 15:20     ` [PATCH v2 2/6] cpupower: Restore format of frequency-info limit Stafford Horne
2017-01-11 15:11 ` [PATCH v2 2/6] selftests/futex: Add headers to makefile dependencies Stafford Horne
2017-01-11 15:16 ` [PATCH v2 3/6] cpupower: Restore format of frequency-info limit Stafford Horne
2017-01-11 15:16 ` [PATCH v2 4/6] selftests/intel_pstate: Fix warning on loop index overflow Stafford Horne
2017-01-11 15:16 ` [PATCH v2 5/6] selftests/intel_pstate: Update makefile to match new style Stafford Horne
2017-01-11 15:16 ` [PATCH v2 6/6] selftests: Add intel_pstate to TARGETS Stafford Horne
2017-01-19 17:35 ` [PATCH v2 0/6] Selftests fixes for futex and intel_pstate Shuah Khan
2017-01-19 22:42   ` Stafford Horne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa5a9bd71838802d6410155295796fec9214928d.1484146515.git.shorne@gmail.com \
    --to=shorne@gmail.com \
    --cc=bamvor.zhangjian@linaro.org \
    --cc=dvhart@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=shreyas@linux.vnet.ibm.com \
    --cc=shuah@kernel.org \
    --cc=trenn@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®