From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B391C433E1 for ; Tue, 18 Aug 2020 13:17:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA372206B5 for ; Tue, 18 Aug 2020 13:17:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MMIVJnuN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726583AbgHRNR5 (ORCPT ); Tue, 18 Aug 2020 09:17:57 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44810 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726353AbgHRNRz (ORCPT ); Tue, 18 Aug 2020 09:17:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597756673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F0uI96kuUyz81rQQhwBKLrJwcZelZomkWIsH60DHRcU=; b=MMIVJnuNUQJVYMP0Yu7s2CzYFJnWphHJOTq1F+xGcL8HR3LyhLqzF40168jRg94dWq7Qzp U6ynYPaZE4rb3i+gk/UgVes/55EWrHXGlqwqDzXwd4NhH5oz3bcLF/3CMhG2kd1LV2GJhT nXpRmnuneyafP/RIUBhT/YdAa9Uwae4= 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-414-6tH6VciYN8G9RuEwLPJ1Eg-1; Tue, 18 Aug 2020 09:17:51 -0400 X-MC-Unique: 6tH6VciYN8G9RuEwLPJ1Eg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EDC58100CECC; Tue, 18 Aug 2020 13:17:49 +0000 (UTC) Received: from darcari.bos.csb (ovpn-114-148.rdu2.redhat.com [10.10.114.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93E9426327; Tue, 18 Aug 2020 13:17:49 +0000 (UTC) Subject: Re: [PATCH] tools/power turbostat: fix output formatting for ACPI CST enumeration To: linux-pm@vger.kernel.org Cc: Len Brown , linux-kernel@vger.kernel.org References: <20200810144330.75613-1-darcari@redhat.com> From: David Arcari Organization: Red Hat Message-ID: Date: Tue, 18 Aug 2020 09:17:49 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200810144330.75613-1-darcari@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Just want to make sure that this doesn't get lost. Please let me know if you feel there is a better approach. Thanks, -Dave On 8/10/20 10:43 AM, David Arcari wrote: > 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)) >