Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp833960ybn; Tue, 24 Sep 2019 10:11:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3lKfjhpquBJkQIKe2Y/hL+bA3N8t/QN4AI1wAAo79NjBQacbxpLb6ElscCI2UGS/3O29r X-Received: by 2002:adf:ec44:: with SMTP id w4mr3303925wrn.251.1569345113211; Tue, 24 Sep 2019 10:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569345113; cv=none; d=google.com; s=arc-20160816; b=DLyc0defcrvdtrHufK/dHdVAuVTbDlpgPDjj/7E4MUsFXmxssIaRqoFxp8EFTre04A 2uI//TJYYHIvqW8wtnMW2tH0Nn18eAv8RaHBPMtLuAJQLcHEn4N1KfCvNPm32k4xwY/0 UtPtLuxMDnML2Ug+K+FFe4jh1zBWAIX/LW79RmMrJuyZaywrHprIt4yh+snShp6PAmG4 Aj/ETXlQiQchKT44HmZR6SHcMxd52NDeIF2kFAikZJPR9LBNmhGCNo9fi0o92e3THorH jLvzfboU3m8P0ZPs8IKH9u9FcE6sSXbnoBYOGfmA9R0ftQCshMa3xfbYYnbrJwDzuiZ8 aSZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HicwEH9rlq6+qGjf7QAuIWovxrWax3+YEyg/YIjEaXg=; b=Pi2HgQs8U8kQpkhLxG/7ZC2Y1+dtbxh/KNcZPEOJeILKUo/b8/IH+e/hkWESkbjqLq RWvFmoQOKQ4oBdYMBgu6Rtf63odQlmYcM0YUSpNh6cwHcps7Kahq2dG1/Lp20lDa470o Dgerqb+Z8VmFthTUICIjY0Y/AVOoyXKbCPY2hk1Q84bQE3xIvhfBIGo96yYxpeMul6x3 7yW9iUrB5ahwpbrM8z0NiG3IHptX4qRMeW4nVns9fWLhraCcSHq8/Lm46DE7vWphIffa llqo7jci8URHe2MieXUd01FBX+14BF7wu4sxHbGDDcZUEd/7LQsz0C3zHXqOx8mkCB5r 4S5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b33si1574016edc.265.2019.09.24.10.11.29; Tue, 24 Sep 2019 10:11:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439744AbfIWNQt (ORCPT + 99 others); Mon, 23 Sep 2019 09:16:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37086 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407227AbfIWNQt (ORCPT ); Mon, 23 Sep 2019 09:16:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C6C210C093E; Mon, 23 Sep 2019 13:16:48 +0000 (UTC) Received: from prarit.bos.redhat.com (prarit-guest.khw1.lab.eng.bos.redhat.com [10.16.200.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F5DA60BFB; Mon, 23 Sep 2019 13:16:47 +0000 (UTC) From: Prarit Bhargava To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Prarit Bhargava , Srinivas Pandruvada Subject: [PATCH 2/2] intel-speed-select: Display turbo frequencies in a table Date: Mon, 23 Sep 2019 09:16:38 -0400 Message-Id: <20190923131638.6668-3-prarit@redhat.com> In-Reply-To: <20190923131638.6668-1-prarit@redhat.com> References: <20190923131638.6668-1-prarit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Mon, 23 Sep 2019 13:16:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Srinivas Pandruvada --- .../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