All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] intel-speed-select: Convert output to tables
@ 2019-09-23 13:16 Prarit Bhargava
  2019-09-23 13:16 ` [PATCH 1/2] intel-speed-select: Display turbo-ratio-limits as a table Prarit Bhargava
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Prarit Bhargava @ 2019-09-23 13:16 UTC (permalink / raw)
  To: platform-driver-x86; +Cc: linux-kernel, Prarit Bhargava, Srinivas Pandruvada

The turbo ratio limits and turbo frequencies add a large amount of
lines to the output.  The output can be truncated into human and
machine readable tables to reduce the number of lines of output.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Prarit Bhargava (2):
  intel-speed-select: Display turbo-ratio-limits as a table
  intel-speed-select: Display turbo frequencies in a table

 .../x86/intel-speed-select/isst-display.c     | 196 +++++++++---------
 1 file changed, 94 insertions(+), 102 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] intel-speed-select: Display turbo-ratio-limits as a table
  2019-09-23 13:16 [PATCH 0/2] intel-speed-select: Convert output to tables Prarit Bhargava
@ 2019-09-23 13:16 ` Prarit Bhargava
  2019-09-23 13:16 ` [PATCH 2/2] intel-speed-select: Display turbo frequencies in " Prarit Bhargava
  2019-09-23 18:18 ` [PATCH 0/2] intel-speed-select: Convert output to tables Srinivas Pandruvada
  2 siblings, 0 replies; 4+ messages in thread
From: Prarit Bhargava @ 2019-09-23 13:16 UTC (permalink / raw)
  To: platform-driver-x86; +Cc: linux-kernel, Prarit Bhargava, Srinivas Pandruvada

The output of the Turbo Ratio Limits is 75 lines long (each bucket has
3 lines and the headers).  This can be shrunk down into a table that is
easier to consume for both scripts and humans.

Display Turbo Ratio Limits in a table.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 .../x86/intel-speed-select/isst-display.c     | 86 ++++++++-----------
 1 file changed, 34 insertions(+), 52 deletions(-)

diff --git a/tools/power/x86/intel-speed-select/isst-display.c b/tools/power/x86/intel-speed-select/isst-display.c
index df4aa99c4e92..9b0ae0831a60 100644
--- a/tools/power/x86/intel-speed-select/isst-display.c
+++ b/tools/power/x86/intel-speed-select/isst-display.c
@@ -287,6 +287,28 @@ static void _isst_fact_display_information(int cpu, FILE *outf, int level,
 	format_and_print(outf, base_level + 2, header, value);
 }
 
+static void isst_turbo_ratio_limits(FILE *outf, char *header_name,
+				    int *active_cores,
+				    unsigned long long buckets_info,
+				    int base_level)
+{
+	char header[256];
+	int i;
+
+	snprintf(header, sizeof(header), header_name);
+	format_and_print(outf, base_level, header, NULL);
+	snprintf(header, sizeof(header),"%11s %8s %8s",
+		 "" , "core-count", "max_freq(MHz)");
+	format_and_print(outf, base_level + 1, header, NULL);
+
+	for (i = 0; i < 8; ++i) {
+		snprintf(header, sizeof (header), "bucket-%d %8lld %12d", i,
+			 (buckets_info >> (i * 8)) & 0xff,
+			 active_cores[i] * DISP_FREQ_MULTIPLIER);
+		format_and_print(outf, base_level + 1, header, NULL);
+	}
+}
+
 void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
 				   struct isst_pkg_ctdp *pkg_dev)
 {
@@ -365,58 +387,18 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
 		snprintf(value, sizeof(value), "%d", ctdp_level->t_proc_hot);
 		format_and_print(outf, base_level + 4, header, value);
 
-		snprintf(header, sizeof(header), "turbo-ratio-limits-sse");
-		format_and_print(outf, base_level + 4, header, NULL);
-		for (j = 0; j < 8; ++j) {
-			snprintf(header, sizeof(header), "bucket-%d", j);
-			format_and_print(outf, base_level + 5, header, NULL);
-
-			snprintf(header, sizeof(header), "core-count");
-			snprintf(value, sizeof(value), "%llu", (ctdp_level->buckets_info >> (j * 8)) & 0xff);
-			format_and_print(outf, base_level + 6, header, value);
-
-			snprintf(header, sizeof(header),
-				"max-turbo-frequency(MHz)");
-			snprintf(value, sizeof(value), "%d",
-				 ctdp_level->trl_sse_active_cores[j] *
-				  DISP_FREQ_MULTIPLIER);
-			format_and_print(outf, base_level + 6, header, value);
-		}
-		snprintf(header, sizeof(header), "turbo-ratio-limits-avx");
-		format_and_print(outf, base_level + 4, header, NULL);
-		for (j = 0; j < 8; ++j) {
-			snprintf(header, sizeof(header), "bucket-%d", j);
-			format_and_print(outf, base_level + 5, header, NULL);
-
-			snprintf(header, sizeof(header), "core-count");
-			snprintf(value, sizeof(value), "%llu", (ctdp_level->buckets_info >> (j * 8)) & 0xff);
-			format_and_print(outf, base_level + 6, header, value);
-
-			snprintf(header, sizeof(header),
-				"max-turbo-frequency(MHz)");
-			snprintf(value, sizeof(value), "%d",
-				 ctdp_level->trl_avx_active_cores[j] *
-				  DISP_FREQ_MULTIPLIER);
-			format_and_print(outf, base_level + 6, header, value);
-		}
-
-		snprintf(header, sizeof(header), "turbo-ratio-limits-avx512");
-		format_and_print(outf, base_level + 4, header, NULL);
-		for (j = 0; j < 8; ++j) {
-			snprintf(header, sizeof(header), "bucket-%d", j);
-			format_and_print(outf, base_level + 5, header, NULL);
-
-			snprintf(header, sizeof(header), "core-count");
-			snprintf(value, sizeof(value), "%llu", (ctdp_level->buckets_info >> (j * 8)) & 0xff);
-			format_and_print(outf, base_level + 6, header, value);
-
-			snprintf(header, sizeof(header),
-				"max-turbo-frequency(MHz)");
-			snprintf(value, sizeof(value), "%d",
-				 ctdp_level->trl_avx_512_active_cores[j] *
-				  DISP_FREQ_MULTIPLIER);
-			format_and_print(outf, base_level + 6, header, value);
-		}
+		isst_turbo_ratio_limits(outf, "turbo-ratio-limits-sse",
+					ctdp_level->trl_sse_active_cores,
+					ctdp_level->buckets_info,
+					base_level + 4);
+		isst_turbo_ratio_limits(outf, "turbo-ratio-limits-avx",
+					ctdp_level->trl_avx_active_cores,
+					ctdp_level->buckets_info,
+					base_level + 4);
+		isst_turbo_ratio_limits(outf, "turbo-ratio-limits-avx512",
+					ctdp_level->trl_avx_512_active_cores,
+					ctdp_level->buckets_info,
+					base_level + 4);
 		if (ctdp_level->pbf_support)
 			_isst_pbf_display_information(cpu, outf, i,
 						      &ctdp_level->pbf_info,
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] intel-speed-select: Display turbo frequencies in a table
  2019-09-23 13:16 [PATCH 0/2] intel-speed-select: Convert output to tables Prarit Bhargava
  2019-09-23 13:16 ` [PATCH 1/2] intel-speed-select: Display turbo-ratio-limits as a table Prarit Bhargava
@ 2019-09-23 13:16 ` Prarit Bhargava
  2019-09-23 18:18 ` [PATCH 0/2] intel-speed-select: Convert output to tables Srinivas Pandruvada
  2 siblings, 0 replies; 4+ messages in thread
From: Prarit Bhargava @ 2019-09-23 13:16 UTC (permalink / raw)
  To: platform-driver-x86; +Cc: linux-kernel, Prarit Bhargava, Srinivas Pandruvada

The output of turbo frequencies is also long (each bucket has
3 lines and the headers).  This can be shrunk down into a table that is
easier to consume for both scripts and humans.

Display the turbo and clip frequencies in a table.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 .../x86/intel-speed-select/isst-display.c     | 116 ++++++++++--------
 1 file changed, 63 insertions(+), 53 deletions(-)

diff --git a/tools/power/x86/intel-speed-select/isst-display.c b/tools/power/x86/intel-speed-select/isst-display.c
index 9b0ae0831a60..16843e0f78f0 100644
--- a/tools/power/x86/intel-speed-select/isst-display.c
+++ b/tools/power/x86/intel-speed-select/isst-display.c
@@ -213,6 +213,52 @@ static void _isst_pbf_display_information(int cpu, FILE *outf, int level,
 	format_and_print(outf, disp_level + 1, header, value);
 }
 
+static void _isst_fact_display_frequencies(FILE *outf, int fact_avx, int level,
+					   char *description, int bucket,
+					   int core_count, int sse,
+					   int avx, int avx512)
+{
+	char header[256];
+	int ret;
+	void *header_ptr;
+	int header_size;
+
+	header_ptr = header;
+	if (core_count > 0)
+		ret = snprintf(header_ptr, sizeof(header), "%s%d %6d ",
+			       description, bucket, core_count);
+	else
+		ret = snprintf(header_ptr, sizeof(header), "%s%6s ",
+			       description, "-");
+
+
+	header_ptr += ret;
+	header_size = header_ptr - (void *) header;
+	if (fact_avx & 0x01)
+		ret = snprintf(header_ptr, header_size, "%12d ",
+			       sse * DISP_FREQ_MULTIPLIER);
+	else
+		ret = snprintf(header_ptr, header_size, "%12s ", "- ");
+
+	header_ptr += ret;
+	header_size = header_ptr - (void *) header;
+	if (fact_avx & 0x02)
+		ret = snprintf(header_ptr, header_size, "%12d ",
+			       avx * DISP_FREQ_MULTIPLIER);
+	else
+		ret = snprintf(header_ptr, header_size, "%12s ", "- ");
+
+	header_ptr += ret;
+	header_size = header_ptr - (void *) header;
+	if (fact_avx & 0x04)
+		ret = snprintf(header_ptr, header_size, "%12d",
+			       avx512 * DISP_FREQ_MULTIPLIER);
+	else
+		ret = snprintf(header_ptr, header_size, "%12s", "-");
+
+	format_and_print(outf, level + 1, header, NULL);
+}
+
 static void _isst_fact_display_information(int cpu, FILE *outf, int level,
 					   int fact_bucket, int fact_avx,
 					   struct isst_fact_info *fact_info,
@@ -220,11 +266,14 @@ static void _isst_fact_display_information(int cpu, FILE *outf, int level,
 {
 	struct isst_fact_bucket_info *bucket_info = fact_info->bucket_info;
 	char header[256];
-	char value[256];
 	int j;
 
 	snprintf(header, sizeof(header), "speed-select-turbo-freq");
 	format_and_print(outf, base_level, header, NULL);
+	snprintf(header, sizeof(header),"%11s %s %s %s %s",
+		 "", "core-count", "max-sse(MHz)" , "max-avx2(MHz)", "max-avx512(MHz)");
+	format_and_print(outf, base_level + 1, header, NULL);
+
 	for (j = 0; j < ISST_FACT_MAX_BUCKETS; ++j) {
 		if (fact_bucket != 0xff && fact_bucket != j)
 			continue;
@@ -232,59 +281,20 @@ static void _isst_fact_display_information(int cpu, FILE *outf, int level,
 		if (!bucket_info[j].high_priority_cores_count)
 			break;
 
-		snprintf(header, sizeof(header), "bucket-%d", j);
-		format_and_print(outf, base_level + 1, header, NULL);
-
-		snprintf(header, sizeof(header), "high-priority-cores-count");
-		snprintf(value, sizeof(value), "%d",
-			 bucket_info[j].high_priority_cores_count);
-		format_and_print(outf, base_level + 2, header, value);
-
-		if (fact_avx & 0x01) {
-			snprintf(header, sizeof(header),
-				 "high-priority-max-frequency(MHz)");
-			snprintf(value, sizeof(value), "%d",
-				 bucket_info[j].sse_trl * DISP_FREQ_MULTIPLIER);
-			format_and_print(outf, base_level + 2, header, value);
-		}
-
-		if (fact_avx & 0x02) {
-			snprintf(header, sizeof(header),
-				 "high-priority-max-avx2-frequency(MHz)");
-			snprintf(value, sizeof(value), "%d",
-				 bucket_info[j].avx_trl * DISP_FREQ_MULTIPLIER);
-			format_and_print(outf, base_level + 2, header, value);
-		}
-
-		if (fact_avx & 0x04) {
-			snprintf(header, sizeof(header),
-				 "high-priority-max-avx512-frequency(MHz)");
-			snprintf(value, sizeof(value), "%d",
-				 bucket_info[j].avx512_trl *
-					 DISP_FREQ_MULTIPLIER);
-			format_and_print(outf, base_level + 2, header, value);
-		}
+		_isst_fact_display_frequencies(
+			outf, fact_avx, base_level + 1, "bucket-", j,
+			bucket_info[j].high_priority_cores_count,
+			bucket_info[j].sse_trl,
+			bucket_info[j].avx_trl,
+			bucket_info[j].avx512_trl);
 	}
-	snprintf(header, sizeof(header),
-		 "speed-select-turbo-freq-clip-frequencies");
-	format_and_print(outf, base_level + 1, header, NULL);
-	snprintf(header, sizeof(header), "low-priority-max-frequency(MHz)");
-	snprintf(value, sizeof(value), "%d",
-		 fact_info->lp_clipping_ratio_license_sse *
-			 DISP_FREQ_MULTIPLIER);
-	format_and_print(outf, base_level + 2, header, value);
-	snprintf(header, sizeof(header),
-		 "low-priority-max-avx2-frequency(MHz)");
-	snprintf(value, sizeof(value), "%d",
-		 fact_info->lp_clipping_ratio_license_avx2 *
-			 DISP_FREQ_MULTIPLIER);
-	format_and_print(outf, base_level + 2, header, value);
-	snprintf(header, sizeof(header),
-		 "low-priority-max-avx512-frequency(MHz)");
-	snprintf(value, sizeof(value), "%d",
-		 fact_info->lp_clipping_ratio_license_avx512 *
-			 DISP_FREQ_MULTIPLIER);
-	format_and_print(outf, base_level + 2, header, value);
+
+	_isst_fact_display_frequencies(
+			outf, fact_avx, base_level + 1, "clip-freq", 1,
+			-1, /* no core-count */
+			fact_info->lp_clipping_ratio_license_sse,
+			fact_info->lp_clipping_ratio_license_avx2,
+			fact_info->lp_clipping_ratio_license_avx512);
 }
 
 static void isst_turbo_ratio_limits(FILE *outf, char *header_name,
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] intel-speed-select: Convert output to tables
  2019-09-23 13:16 [PATCH 0/2] intel-speed-select: Convert output to tables Prarit Bhargava
  2019-09-23 13:16 ` [PATCH 1/2] intel-speed-select: Display turbo-ratio-limits as a table Prarit Bhargava
  2019-09-23 13:16 ` [PATCH 2/2] intel-speed-select: Display turbo frequencies in " Prarit Bhargava
@ 2019-09-23 18:18 ` Srinivas Pandruvada
  2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Pandruvada @ 2019-09-23 18:18 UTC (permalink / raw)
  To: Prarit Bhargava, platform-driver-x86, Andy Shevchenko; +Cc: linux-kernel

On Mon, 2019-09-23 at 09:16 -0400, Prarit Bhargava wrote:
> The turbo ratio limits and turbo frequencies add a large amount of
> lines to the output.  The output can be truncated into human and
> machine readable tables to reduce the number of lines of output.
> 
Unfortunately this breaks json output. The idea is that the software
should be able to parse json output using available json libraries and
consume information, without developing complex parser.
For example:
#intel-speed-select -o out.json -f json perf-profile info
Copy paste contents of out.json in any online json editor/tools, itshouldn't give error. 

Thanks,
Srinivas


> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> 
> Prarit Bhargava (2):
>   intel-speed-select: Display turbo-ratio-limits as a table
>   intel-speed-select: Display turbo frequencies in a table
> 
>  .../x86/intel-speed-select/isst-display.c     | 196 +++++++++-------
> --
>  1 file changed, 94 insertions(+), 102 deletions(-)
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-23 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 13:16 [PATCH 0/2] intel-speed-select: Convert output to tables Prarit Bhargava
2019-09-23 13:16 ` [PATCH 1/2] intel-speed-select: Display turbo-ratio-limits as a table Prarit Bhargava
2019-09-23 13:16 ` [PATCH 2/2] intel-speed-select: Display turbo frequencies in " Prarit Bhargava
2019-09-23 18:18 ` [PATCH 0/2] intel-speed-select: Convert output to tables Srinivas Pandruvada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.