From: Yang Jihong <yangjihong1@huawei.com>
To: Adrian Hunter <adrian.hunter@intel.com>, <peterz@infradead.org>,
<mingo@redhat.com>, <acme@kernel.org>, <mark.rutland@arm.com>,
<alexander.shishkin@linux.intel.com>, <jolsa@kernel.org>,
<namhyung@kernel.org>, <irogers@google.com>,
<anshuman.khandual@arm.com>, <jesussanp@google.com>,
<linux-perf-users@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] perf trace-event-info: Add tracepoint_id_to_name() helper
Date: Wed, 10 May 2023 16:09:37 +0800 [thread overview]
Message-ID: <6d03b9cc-31c8-37c3-3e82-504be8712dee@huawei.com> (raw)
In-Reply-To: <07770bac-cbeb-170e-b3c1-d0276d4ffef3@intel.com>
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@huawei.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
next prev parent reply other threads:[~2023-05-10 8:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 12:29 [PATCH 0/4] perf tools: Add printing perf_event_attr `config` and `id` symbol in perf_event_attr__fprintf() Yang Jihong
2023-04-19 12:29 ` [PATCH 1/4] perf trace-event-info: Add tracepoint_id_to_name() helper Yang Jihong
2023-05-10 7:48 ` Adrian Hunter
2023-05-10 8:09 ` Yang Jihong [this message]
2023-04-19 12:29 ` [PATCH 2/4] perf tools: Extend PRINT_ATTRf to support printing of members with a value of 0 Yang Jihong
2023-04-19 12:29 ` [PATCH 3/4] perf tools: Add printing perf_event_attr->type symbol in perf_event_attr__fprintf() Yang Jihong
2023-05-10 8:32 ` Adrian Hunter
2023-05-10 15:51 ` Adrian Hunter
2023-05-11 7:42 ` Yang Jihong
2023-04-19 12:29 ` [PATCH 4/4] perf tools: Add printing perf_event_attr->config " Yang Jihong
2023-05-10 7:22 ` [PATCH 0/4] perf tools: Add printing perf_event_attr `config` and `id` " Yang Jihong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d03b9cc-31c8-37c3-3e82-504be8712dee@huawei.com \
--to=yangjihong1@huawei.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=irogers@google.com \
--cc=jesussanp@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®