Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp831536ybn; Tue, 24 Sep 2019 10:09:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0bPzqYe+fbTjTtQ81bSkYzez4qly5QO/oJq7fq8/xP6zvgU9gVRm07pbTRW6fgru+JjQZ X-Received: by 2002:a17:906:564b:: with SMTP id v11mr3384852ejr.225.1569344983133; Tue, 24 Sep 2019 10:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569344983; cv=none; d=google.com; s=arc-20160816; b=Tf62h+lOtGqNJcs0qv9O6HrSpQJqoT22OpX7xt0CXTWZpMYxZq34HYCi/n0ucHeL4P Ci+md5CVbH+SDtUz0Q3HMxIn4PdHcakOPzqFLx2d+cKBKhj6JPiQCP5ENhJzOxjH3yBv BwHGAKBrFYnn7qdHe0pKV52j0OcgBaDYfpEKMyB/RsJDNUHY64qSPVJzixt5MbNam0T5 9i0I5mpdzGOE+uLnv+TeZyJAPF7oa8E45pAqUOOblGs9wFR6LJCiQ/e3Ex0QXjTGX4uB DoQiFNvy9xDGSygdeSMjCP17EgoX33YQ3hktJ6AgXHaZd1RZj/kUK3fMVXZmYdUekBKg l68g== 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=axNEa4irlfk4tnKPRG2bFEJg3FJgil10JXbKFLaDsys=; b=c6kByPkPP1UuTugUKPXGf55GgdD5LqlZgBIZaE8822otqN7IqaN9EnxxWg1KRasbP6 nv93ncLumjbIFryyeulAMUUyJcVNbmY16Hj47K2qaclbmDGM7+Og7cc0nA6TDOfNlIoA OvIh+xp3oKzZmtCVXvt3dQ8ptHel0gZIXwcn/KTlVV9OPf4buGMPe9eHW85NEPHUCQi5 c/ZlhILkQqKVGiwZhVJlC+9pxzauWA1K0DHITYqEAsRZDY+ybKRCERlnqE7R7JebwZQo IhyU3UXcglO6Xef2pppZHtMKQ2ePFJILzfLuJDWylWaEqO8WihedpG1aj3ab5zvUljJu KkKQ== 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 ci22si1239947ejb.162.2019.09.24.10.09.19; Tue, 24 Sep 2019 10:09:43 -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 S2439556AbfIWNQs (ORCPT + 99 others); Mon, 23 Sep 2019 09:16:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57076 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405137AbfIWNQs (ORCPT ); Mon, 23 Sep 2019 09:16:48 -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 7D209356DC; Mon, 23 Sep 2019 13:16:47 +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 DE68460C63; Mon, 23 Sep 2019 13:16:44 +0000 (UTC) From: Prarit Bhargava To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Prarit Bhargava , Srinivas Pandruvada Subject: [PATCH 1/2] intel-speed-select: Display turbo-ratio-limits as a table Date: Mon, 23 Sep 2019 09:16:37 -0400 Message-Id: <20190923131638.6668-2-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.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 23 Sep 2019 13:16:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Srinivas Pandruvada --- .../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