lkml.org 
[lkml]   [2023]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/4] perf trace-event-info: Add tracepoint_id_to_name() helper
From
Date
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 <yangjihong1@huawei.com>
>> ---
>> 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

\
 
 \ /
  Last update: 2023-05-15 10:43    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog