Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1716587rwd; Mon, 15 May 2023 01:53:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ71cCVigC6NuNHkzFk+WhtghXk9N4xp59xtGUQU0D5ib3RdzT/uBpNlKoIk2CHMw54lZguZ X-Received: by 2002:a05:6a00:1787:b0:627:6328:79f1 with SMTP id s7-20020a056a00178700b00627632879f1mr48231251pfg.34.1684140813382; Mon, 15 May 2023 01:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684140813; cv=none; d=google.com; s=arc-20160816; b=rptm1aurmCd4NkzTyPU0aKECigQYN4vO8lUhgpUF5nAO9KEYSu9E374Dv+iKlG/4/9 6kb8Lzid1jHKpulvknpZWnv344nRJO9+1kFrmuUe+Qd2z7BZb0e93tTTu5EvJaQlSRx6 M/ExlIZD3FU3wC1TLAK1axJYvm4dZ4qnDFiJHf3ZFDFxnza230QB8MB8eSC2KZEFM5W4 WzdFmAEw8qvev0zxT50TROCPa6EdJ0R6z455GHtyB5geQruLboidI7Swf8yCESvs52Nf T6i1JipVsnTpdIDjNMu0C5WFXzs9rjdh31405p55CIc+el6HEdDu885Rl576yo/H9lmd BtZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=hxPFhJ/SUNgiYIUq7M6TQ3mNYmU04LKtuvlOVJok3eM=; b=w9j96IP2mlQey2HN0mf6rZu0+ps512AUnINSKLNNcR/U7020hI47zdVAbNFLEmprDV PvnIyN5idx1xptTovwV54LKVH7AB5+JMDPAQI4yvkkp/0MlZPPEKSveEs0pZx3iGc/xV 659pV6f4BmCjWToy8F62jIKlmgmhxTy97CppwWP1AXnN7WTs/UnhUcCzp5RYlcCjs20g Hq+eU8jUzGDtAkJvU+9ZKiuSdXG3uoZJcBlkt/rGa/nckZRyG2BPnHJIvMwrpADuKss7 hKxKK14XvabLXkJ6iHIlt7FbPAvWQldmzJDw2DLA5sc1pPhOFDfPTcc/X9op7ta5uWuh ddqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a636e02000000b00530b1dec2desi5445845pgc.601.2023.05.15.01.53.19; Mon, 15 May 2023 01:53:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237438AbjEOImf (ORCPT + 99 others); Mon, 15 May 2023 04:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237142AbjEOIm1 (ORCPT ); Mon, 15 May 2023 04:42:27 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7985EC; Mon, 15 May 2023 01:42:25 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QKXq73GrszLq1c; Mon, 15 May 2023 16:39:31 +0800 (CST) Received: from [10.67.111.205] (10.67.111.205) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 15 May 2023 16:42:23 +0800 Subject: Re: [PATCH v2 1/4] perf trace-event-info: Add tracepoint_id_to_name() helper To: Adrian Hunter , , , , , , , , , , , , References: <20230511075154.240163-1-yangjihong1@huawei.com> <20230511075154.240163-2-yangjihong1@huawei.com> <14f09d56-d4f1-8602-6a98-5588cbef8c81@intel.com> From: Yang Jihong Message-ID: <6955e0df-5835-e79b-2ba4-cddc3bb7c976@huawei.com> Date: Mon, 15 May 2023 16:42:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <14f09d56-d4f1-8602-6a98-5588cbef8c81@intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.111.205] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On 2023/5/12 18:33, Adrian Hunter wrote: > On 11/05/23 10:51, Yang Jihong wrote: >> Add tracepoint_id_to_name() helper to search for the trace events directory >> by given event id and return the corresponding tracepoint. >> >> Signed-off-by: Yang Jihong >> --- >> tools/perf/util/trace-event-info.c | 11 +++++++++++ >> tools/perf/util/trace-event.h | 6 ++++++ >> 2 files changed, 17 insertions(+) >> >> diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c >> index c24b3a15e319..a5c65cb02a28 100644 >> --- a/tools/perf/util/trace-event-info.c >> +++ b/tools/perf/util/trace-event-info.c >> @@ -466,6 +466,17 @@ static struct tracepoint_path *tracepoint_id_to_path(u64 config) >> return NULL; >> } >> >> +char *tracepoint_id_to_name(u64 config) >> +{ >> + char *buf = NULL; >> + struct tracepoint_path *path = tracepoint_id_to_path(config); > > It is considered slightly nicer to put local declarations > in descending order of line length. i.e. OK, will fix in v3. > > struct tracepoint_path *path = tracepoint_id_to_path(config); > char *buf = NULL; > >> + >> + if ((path != NULL) && (asprintf(&buf, "%s:%s", path->system, path->name) > 0)) > > The parentheses are unnecessary and kernel style tends to avoid "!= NULL" > i.e. OK, will fix in v3. Thanks, Yang