Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11960791rwd; Thu, 22 Jun 2023 22:39:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4mup2g/PWPs1nGBd38s3Hlwy14wkbe9uWw4zgaeNppJoRH8L2ew+4K1J80DRsp59n+0N+l X-Received: by 2002:a17:90a:928b:b0:25c:2558:e208 with SMTP id n11-20020a17090a928b00b0025c2558e208mr13968992pjo.38.1687498784672; Thu, 22 Jun 2023 22:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687498784; cv=none; d=google.com; s=arc-20160816; b=DKP3tGnHSVXSmuIp30zCsfNJth1uefLnjIAinNZFCZKs4D076hh2mrzHDSIL/i9gWZ ADTDVPZ//y6AGEB3SEMcO7yB+K01rjahyeBFzHnHidBq6m74a5LH5DIfNws9ncMfZFFf CcwxGiAXquIFfBkyHaz7CPOK5oxY1ol6jv4k09BYEu35Wkc0qdRN2+N4/KaGUtlMU1Nj vbJw0IclDY2i0vG8t4iLw3pjmNOKP6Mz0osW4wgmgZiZ3TIpMuNvHxS6qOknCE3OSEjr 3qtBIeC/LSNXfLsAbhXXq+qxsnuKry6B7HnT1tKg53E/bYHNEC4duNrALIqXIxp0ttkt IVUw== 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 :cc:to:subject; bh=4AYEVZik9J9s9sxEYjvXWbxtCOW88hRQSDULMjpeoOU=; fh=YUnQLJG8dDiA7xSjQUkasVD1g800wih/L3Y9wtdGwNw=; b=GY+ieCrmWvqJKe8tqvTjphc5woFL8Xy8FFwTx5CoIToo7EAr2cTrcWjFU3F/LrPuvR RgmAZoJFPVeM4i/kY2nmoWivJuAcIdSqBp1vvqTtXS3k6nIc6FSgh7aF4AkXoa2oP1Ka EuNefdZRX2/tABzvKhK5pfJbV777M0mGQXYTPjc4KdyH1DRxgGHaJyQnwkiiy0+5Ja3D jiOzt3pDKFPYe2/f4gWsimQ6rDMD7kMoMBASnSleHxMFuBxK29nicm/5SQffI8alliXQ Gc9jupIE0MR4cLEH7Y6wANweIqHajFkOpkO6q11F08/gUosbukxv0yev9m4va4vLEc9W fXJg== 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 21-20020a17090a195500b002533ea2ad58si1226373pjh.140.2023.06.22.22.39.32; Thu, 22 Jun 2023 22:39:44 -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 S231472AbjFWF1U (ORCPT + 99 others); Fri, 23 Jun 2023 01:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbjFWF1S (ORCPT ); Fri, 23 Jun 2023 01:27:18 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8089A1FF7; Thu, 22 Jun 2023 22:27:16 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QnQj372FRz1GF2P; Fri, 23 Jun 2023 13:27:03 +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.27; Fri, 23 Jun 2023 13:27:12 +0800 Subject: Re: [PATCH RESEND v4 1/4] perf trace-event-info: Add tracepoint_id_to_name() helper To: Namhyung Kim CC: , , , , , , , , , , , References: <20230613033946.103515-1-yangjihong1@huawei.com> <20230613033946.103515-2-yangjihong1@huawei.com> From: Yang Jihong Message-ID: Date: Fri, 23 Jun 2023 13:27:12 +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: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.111.205] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 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/6/21 6:35, Namhyung Kim wrote: > Hello, > > On Mon, Jun 12, 2023 at 8:41 PM 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 >> Acked-by: Adrian Hunter >> --- >> 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..a7901f4a6654 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) >> +{ >> + struct tracepoint_path *path = tracepoint_id_to_path(config); >> + char *buf = NULL; >> + >> + if (path && asprintf(&buf, "%s:%s", path->system, path->name) > 0) >> + return buf; > > I think we need to call put_tracepoints_path() before return. Yes, here need to free tracepoints path, will fix in next version. Thanks, Yang