[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d03b9cc-31c8-37c3-3e82-504be8712dee@huawei.com>
Date: Wed, 10 May 2023 16:09:37 +0800
From: Yang Jihong <yangjihong1@...wei.com>
To: Adrian Hunter <adrian.hunter@...el.com>, <peterz@...radead.org>,
<mingo@...hat.com>, <acme@...nel.org>, <mark.rutland@....com>,
<alexander.shishkin@...ux.intel.com>, <jolsa@...nel.org>,
<namhyung@...nel.org>, <irogers@...gle.com>,
<anshuman.khandual@....com>, <jesussanp@...gle.com>,
<linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/4] perf trace-event-info: Add tracepoint_id_to_name()
helper
Hello,
On 2023/5/10 15:48, Adrian Hunter wrote:
> On 19/04/23 15:29, 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 <yangjihong1@...wei.com>
>> ---
>> tools/perf/util/trace-event-info.c | 13 +++++++++++++
>> tools/perf/util/trace-event.h | 6 ++++++
>> 2 files changed, 19 insertions(+)
>>
>> diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
>> index c24b3a15e319..79907caaf0ca 100644
>> --- a/tools/perf/util/trace-event-info.c
>> +++ b/tools/perf/util/trace-event-info.c
>> @@ -466,6 +466,19 @@ static struct tracepoint_path *tracepoint_id_to_path(u64 config)
>> return NULL;
>> }
>>
>> +char *tracepoint_id_to_name(u64 config)
>> +{
>> + char buf[MAX_EVENT_LENGTH];
>> + struct tracepoint_path *path = NULL;
>
> Initializer should be tracepoint_id_to_path(config) i.e.
>
OK, will fix in next version.
> struct tracepoint_path *path = tracepoint_id_to_path(config);
>
>> +
>> + path = tracepoint_id_to_path(config);
>> + if (path == NULL)
>> + return NULL;
>> +
>> + snprintf(buf, sizeof(buf), "%s:%s", path->system, path->name);
>
> asprintf() can be used then buf and strdup() are not needed.
>
OK, will fix in next version.
Thanks for correcting.
Thanks,
Yang
Powered by blists - more mailing lists