Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4377358pxa; Mon, 10 Aug 2020 07:46:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziEL8fjf1A8vN+aZyhyyLZQoKc3ajtqP42Fb6Xjo+46J+EGijN078wdKxOYwIZxlhBw8ln X-Received: by 2002:a17:906:c799:: with SMTP id cw25mr23284292ejb.439.1597070815559; Mon, 10 Aug 2020 07:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597070815; cv=none; d=google.com; s=arc-20160816; b=duQDi37FkW3Vl4rkqOqtOaXotiAbRCIyUO3MfNTtdh9iDo5epQotgrTA5yTvy9zGlt RkeIF1Oe8IAhL9sTyEQk17jPTi6saXAfPnmvgM3XHrxqj5cdH6VIrSa7AEJFKtkrDCeA ehZE4F+kNjJMNQypy+XImrAlEUmhn+ZII3G+bdqxm1zwyX7Ng5Aymx6AkVtEVjWXA8yp tZk0cNs3jrjW7ZquPofjW847wtckBGtrktl6kkQo28qT0kOn2pI9ikPrpWhw+ScsoQ6r pLwFUIgREkJKhqjC4Q4ErgkzivH4LwAKYs6X6loWBFP/l1WebH7R3tofqV5IL7IyBnOK IfCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=JcBLOi3neeT1lIyBo7PfatBN0vwuswVUL6Gsq5h2/Cs=; b=KuDvVaFghZARHUD8m6A8kWHTXa/c5aZNDiTvfQSuFtpEmQz3vsGFguSOsXjS/1Xj6h JzdrbkNOG5SqWAeaclh27ZkVu2kFvcdeiSzUgQzzyFljR+aDcShQfcXKNJh+XNO10mKr MYriyDOTlA43eNTBGDNT3YUQMyl1Kzy9Ndsui8gX2/I9YVvF7wVsgwFD7mo7sFqFyH7q bITanC1pv4ZmyH3bLsfelJ4Tn73enk5568ElY35Xgk3BjAVOx9yDnQTd5VqhtmzHh/vp nIfwFOY3iiq3puWW86ENL3ln/lV3w8uSk4x8OIBhQ19TvcOMx+iIQPCNNQZxzHjQXGCK CcxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LEEGvy6z; 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 c12si10878382ejz.120.2020.08.10.07.46.32; Mon, 10 Aug 2020 07:46:55 -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=LEEGvy6z; 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 S1726845AbgHJOnp (ORCPT + 99 others); Mon, 10 Aug 2020 10:43:45 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:51202 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726111AbgHJOnp (ORCPT ); Mon, 10 Aug 2020 10:43:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597070623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=JcBLOi3neeT1lIyBo7PfatBN0vwuswVUL6Gsq5h2/Cs=; b=LEEGvy6zhcsqoN2Adc8Src4DEHEO0UojZX+T87T06rPZSAHcggjYODVth23Q6U0UeQREsN hIuNoyY2XGNcTD4gyAoqDzM2rOl/uye9qy/gpoIqUWT4BQNKygTd8qJb/x8mPypndagtmm QUH6UyLoi3lZvwhE4clSt+McAwX4m4U= 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-249-ZtPwwEoJN0mE3uY2kLDSqg-1; Mon, 10 Aug 2020 10:43:41 -0400 X-MC-Unique: ZtPwwEoJN0mE3uY2kLDSqg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E04A659; Mon, 10 Aug 2020 14:43:40 +0000 (UTC) Received: from dba62.ml3.eng.bos.redhat.com (dba62.ml3.eng.bos.redhat.com [10.19.176.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8063079CF3; Mon, 10 Aug 2020 14:43:40 +0000 (UTC) From: David Arcari To: linux-pm@vger.kernel.org Cc: David Arcari , Len Brown , linux-kernel@vger.kernel.org Subject: [PATCH] tools/power turbostat: fix output formatting for ACPI CST enumeration Date: Mon, 10 Aug 2020 10:43:30 -0400 Message-Id: <20200810144330.75613-1-darcari@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org turbostat formatting is broken with ACPI CST for enumeration. The problem is that the CX_ACPI% is eight characters long which does not work with tab formatting. One simple solution is to remove the underbar from the state name such that C1_ACPI will be displayed as C1ACPI. Signed-off-by: David Arcari Cc: Len Brown Cc: linux-kernel@vger.kernel.org --- tools/power/x86/turbostat/turbostat.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 33b370865d16..5f074879cc0a 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -3474,6 +3474,20 @@ int has_config_tdp(unsigned int family, unsigned int model) } } +static void +remove_underbar(char *s) +{ + char *to = s; + + while (*s) { + if (*s != '_') + *to++ = *s; + s++; + } + + *to = 0; +} + static void dump_cstate_pstate_config_info(unsigned int family, unsigned int model) { @@ -3559,6 +3573,8 @@ dump_sysfs_cstate_config(void) *sp = '\0'; fclose(input); + remove_underbar(name_buf); + sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc", base_cpu, state); input = fopen(path, "r"); @@ -5597,6 +5613,8 @@ void probe_sysfs(void) *sp = '%'; *(sp + 1) = '\0'; + remove_underbar(name_buf); + fclose(input); sprintf(path, "cpuidle/state%d/time", state); @@ -5624,6 +5642,8 @@ void probe_sysfs(void) *sp = '\0'; fclose(input); + remove_underbar(name_buf); + sprintf(path, "cpuidle/state%d/usage", state); if (is_deferred_skip(name_buf)) -- 2.27.0