Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2109692ybk; Mon, 11 May 2020 12:08:31 -0700 (PDT) X-Google-Smtp-Source: APiQypI13MgPcKc6T/AV7uEye4WRCpEq7YKAdGJYZn5yp29rfZFo6n7rC+U0wZ3Uz8KtUwwqzNxr X-Received: by 2002:a17:906:29c4:: with SMTP id y4mr14590423eje.95.1589224111588; Mon, 11 May 2020 12:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589224111; cv=none; d=google.com; s=arc-20160816; b=S5158KKCCpRtqXeB509mG1FQt6sXj73hAAHm2PF+uvMilF499g8T9Z70Vj4LxlX8Rf 6ep8ulR6r85TO2FSdYDQ76C6L0bJ7FEpmDR7LIuE1tg9QB5p2KQZJcffqfKkXiKBpvgT xQ5cW8K4mwP/sEzvKIge1FnnReKwWGPbmwp8yFHF/C9xuFSPp4L7K8pNuKQMVZPW9UKM k65etB4YhOmq1T3ZOOnpwDHdYEB0e1yoO+jXfnUlgjVyVfISV/yCplXRIcrBOdWDQ0mi t1kFLOssUYFSLJwZIGhTgOUfOk7S3cQMGdNFTo/ZhKiJcSbz6SYDDjCc4lEegwWxrC9f 6/9g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=oqf/KDuLojDbfB1GjtcgpUnIV6apc16crSMVbd9O8A4=; b=Rknw9YOuHR+eVCo1RZHzr/2BG5Q8eTzF/JxlEl0xWn9JWE61XsSYZ59opnf6IaEmax Cy8XoKM8hR/aPSkWQdl1rDymsrA9wwBBoFVoaGckBbSWaRtLunUa6wv9hczVkomD5LEu qeuOLr/NXe8jantTlKUGBYqo/4OXHE8htgX5VMFAo9/XdetW/sEAfU8nks4oD8UbKiVj 9AyfMMwmOUe5Z9NPf1AVL2qDJMYvthkPeEu++6fk+nE4GAeYbtQtrRbHz8MTqS9BUaTg D5tUL5KtDQ9tcis0GPArHf/V4GXPqSa7Y0IvyKViXy2WrMBFE5+EShP2g6xn2SUzDTs0 ZLpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hF3HkiCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b9si4413494eja.138.2020.05.11.12.08.06; Mon, 11 May 2020 12:08:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hF3HkiCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731312AbgEKTGi (ORCPT + 99 others); Mon, 11 May 2020 15:06:38 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29058 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731246AbgEKTGh (ORCPT ); Mon, 11 May 2020 15:06:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589223996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=oqf/KDuLojDbfB1GjtcgpUnIV6apc16crSMVbd9O8A4=; b=hF3HkiCxEokQvbcfLJFHOnWB065PxvenqNv4KUTlHwLFXk7zj2jbh0Q8MejIyZ7uWE5JkW rN1Ww5mIJEx543IDDhZ/EYSA/5IW5ksRkUNU8yiEI/q0fOUeGMSi70pdJXUAhIIwGaL4zc ng1d9emnZ9NVhTmBOVeoFvVpHKAllz8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-108-Ee0psfbIP7-P37Lvb-TSBw-1; Mon, 11 May 2020 15:06:34 -0400 X-MC-Unique: Ee0psfbIP7-P37Lvb-TSBw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1F6F8005AD; Mon, 11 May 2020 19:06:33 +0000 (UTC) Received: from prarit.bos.redhat.com (prarit-guest.7a2m.lab.eng.bos.redhat.com [10.16.222.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3A539CB9; Mon, 11 May 2020 19:06:32 +0000 (UTC) From: Prarit Bhargava To: linux-kernel@vger.kernel.org Cc: Prarit Bhargava , Srinivas Pandruvada , platform-driver-x86@vger.kernel.org Subject: [PATCH] intel-speed-select: Fix json perf-profile output output Date: Mon, 11 May 2020 15:06:28 -0400 Message-Id: <20200511190628.25661-1-prarit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 'intel-speed-select -f json perf-profile get-lock-status' command outputs the package, die, and cpu data as separate fields. ex) "package-0": { "die-0": { "cpu-0": { Commit 74062363f855 ("tools/power/x86/intel-speed-select: Avoid duplicate Package strings for json") prettied this output so that it is a single line for some json output commands and the same should be done for other commands. Output package, die, and cpu info in a single line when using json output. Signed-off-by: Prarit Bhargava Cc: Srinivas Pandruvada Cc: platform-driver-x86@vger.kernel.org --- .../x86/intel-speed-select/isst-display.c | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/tools/power/x86/intel-speed-select/isst-display.c b/tools/power/x86/intel-speed-select/isst-display.c index f6e2ce181123..e105fece47b6 100644 --- a/tools/power/x86/intel-speed-select/isst-display.c +++ b/tools/power/x86/intel-speed-select/isst-display.c @@ -316,21 +316,31 @@ void isst_ctdp_display_core_info(int cpu, FILE *outf, char *prefix, { char header[256]; char value[256]; + int level = 1; + + if (out_format_is_json()) { + snprintf(header, sizeof(header), "package-%d:die-%d:cpu-%d", + get_physical_package_id(cpu), get_physical_die_id(cpu), + cpu); + format_and_print(outf, level++, header, NULL); + } else { + snprintf(header, sizeof(header), "package-%d", + get_physical_package_id(cpu)); + format_and_print(outf, level++, header, NULL); + snprintf(header, sizeof(header), "die-%d", + get_physical_die_id(cpu)); + format_and_print(outf, level++, header, NULL); + snprintf(header, sizeof(header), "cpu-%d", cpu); + format_and_print(outf, level++, header, NULL); + } - snprintf(header, sizeof(header), "package-%d", - get_physical_package_id(cpu)); - format_and_print(outf, 1, header, NULL); - snprintf(header, sizeof(header), "die-%d", get_physical_die_id(cpu)); - format_and_print(outf, 2, header, NULL); - snprintf(header, sizeof(header), "cpu-%d", cpu); - format_and_print(outf, 3, header, NULL); if (str0 && !val) snprintf(value, sizeof(value), "%s", str0); else if (str1 && val) snprintf(value, sizeof(value), "%s", str1); else snprintf(value, sizeof(value), "%u", val); - format_and_print(outf, 4, prefix, value); + format_and_print(outf, level, prefix, value); format_and_print(outf, 1, NULL, NULL); } -- 2.18.4