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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 716C5C19F2D for ; Tue, 9 Aug 2022 19:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IKsJO1wOGFobgxK7fwaGUHuxPoRlxFIUInHVUI4nJFw=; b=AZvmLZouoKVYM1 mFoYwOyXnH6PZUgH55NVZ6/h5vjc5WLiO/TwFIdxc1eHoYiS9ZHbbO+KTs5etV3lTzfVXjn/ejcnL wGwbvjT60g7rTrLXp8LXnnTBgB2VvP4EYafAz87QS9hnBGmUbkLK5GtgHJeglWlKXZRSBVobZTpeC 71WiGcJFkj+t0lBoTW9iontOYM6vI6haMdvSfOWbxP14V5HdN8gj80ginYNI694VsI8sB9quDpc7h Oletyf0JUGzCZOaV2JKstNSPNUNwmFzSaVGDrW/xznz/DdoP2UoG97vzWWuB7c2qr30joXFMihOiS fAQ4XvSxlc3r3mdxIYYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLV2r-005ugf-Jb; Tue, 09 Aug 2022 19:37:41 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLV2o-005uex-QV for linux-arm-kernel@bombadil.infradead.org; Tue, 09 Aug 2022 19:37:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=CKotihRU40QaoCi6WGT0rWE3/ijR05HK5zJrxqWXBjY=; b=soOrby8glAE0UFiaW6slmgm6/R 2F/zh6FMzGyqXqxlg5hyNwocjj7lvQP6SVqf2o8lkAQ/o2QawVxqbuE8HpkLlrZQZ85At3HAndZDe 6Ly5w6xSuIPC9ejaVzL7ssAqp2+Q/nnToifVwOqgN7PVi8f/j8U4CL7Cig7ohFnqDf/JNAQ7UeFt9 4ARZCBim0veXSNoBqXYVt9USf++gZ/gDpUFZaXMzHbJh2N1LSM8xE54EqIRrgWAf9RYlOJyvDTn8n 86NCwjUBhwQUnqJUsVm+5EzhRUExhl93TBOy2iFeIQ2mHW0oqW7XiIbtT3ir3kJCaUowUqg/OEPtf s1Rah5PA==; Received: from [187.19.239.32] (helo=quaco.ghostprotocols.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLV2n-00FmqL-9o; Tue, 09 Aug 2022 19:37:37 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C6BC94035A; Tue, 9 Aug 2022 16:37:34 -0300 (-03) Date: Tue, 9 Aug 2022 16:37:34 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , Zhengjun Xing , Ravi Bangoria , Kan Liang , Adrian Hunter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH v4 02/17] perf jevents: Simplify generation of C-string Message-ID: References: <20220804221816.1802790-1-irogers@google.com> <20220804221816.1802790-3-irogers@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220804221816.1802790-3-irogers@google.com> X-Url: http://acmel.wordpress.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Em Thu, Aug 04, 2022 at 03:18:01PM -0700, Ian Rogers escreveu: > Previous implementation wanted variable order and '(null)' string output > to match the C implementation. The '(null)' string output was a > quirk/bug and so there is no need to carry it forward. Thanks, applied. - Arnaldo > Signed-off-by: Ian Rogers > --- > tools/perf/pmu-events/jevents.py | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py > index 5b72048d50da..cdfa4e0e7557 100755 > --- a/tools/perf/pmu-events/jevents.py > +++ b/tools/perf/pmu-events/jevents.py > @@ -203,7 +203,7 @@ class JsonEvent: > """Representation of the event as a C struct initializer.""" > > def attr_string(attr: str, value: str) -> str: > - return '\t.%s = \"%s\",\n' % (attr, value) > + return f'\t.{attr} = \"{value}\",\n' > > def str_if_present(self, attr: str) -> str: > if not getattr(self, attr): > @@ -211,17 +211,11 @@ class JsonEvent: > return attr_string(attr, getattr(self, attr)) > > s = '{\n' > - for attr in ['name', 'event']: > - s += str_if_present(self, attr) > - if self.desc is not None: > - s += attr_string('desc', self.desc) > - else: > - s += attr_string('desc', '(null)') > - s += str_if_present(self, 'compat') > s += f'\t.topic = "{topic_local}",\n' > for attr in [ > - 'long_desc', 'pmu', 'unit', 'perpkg', 'aggr_mode', 'metric_expr', > - 'metric_name', 'metric_group', 'deprecated', 'metric_constraint' > + 'aggr_mode', 'compat', 'deprecated', 'desc', 'event', 'long_desc', > + 'metric_constraint', 'metric_expr', 'metric_group', 'metric_name', > + 'name', 'perpkg', 'pmu', 'unit' > ]: > s += str_if_present(self, attr) > s += '},\n' > -- > 2.37.1.559.g78731f0fdb-goog -- - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel