From: Steven Rostedt <rostedt@goodmis.org>
To: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH 1/2] tools/lib/traceevent: make libtraceevent thread safe
Date: Tue, 11 Dec 2018 12:29:17 -0500 [thread overview]
Message-ID: <20181211122917.742b586e@gandalf.local.home> (raw)
In-Reply-To: <20181205092200.2291-2-tstoyanov@vmware.com>
On Wed, 5 Dec 2018 09:22:12 +0000
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
> @@ -3499,19 +3500,19 @@ struct tep_event *tep_find_event(struct tep_handle *pevent, int id)
> * @sys. If @sys is NULL the first event with @name is returned.
> */
> struct tep_event *
> -tep_find_event_by_name(struct tep_handle *pevent,
> +tep_find_event_by_name(struct tep_handle *tep,
> const char *sys, const char *name)
> {
> - struct tep_event *event;
> int i;
> + struct tep_event *event = NULL;
> + struct tep_event *event_cache = get_thread_local_event_by_name(tep, name, sys);
BTW, I modified this to keep with the "upside down christmas tree"
method. That is, instead of:
int i;
struct tep_event *event = NULL;
struct tep_event *event_cache = get_thread_local_event_by_name(tep, name, sys);
I made it:
struct tep_event *event_cache = get_thread_local_event_by_name(tep, name, sys);
struct tep_event *event = NULL;
int i;
to make it look better, and some kernel developers (as well as the perf
developers) require that for declarations.
-- Steve
>
> - if (pevent->last_event &&
> - strcmp(pevent->last_event->name, name) == 0 &&
> - (!sys || strcmp(pevent->last_event->system, sys) == 0))
> - return pevent->last_event;
> + /* Check cache first */
> + if (event_cache)
> + return event_cache;
>
> - for (i = 0; i < pevent->nr_events; i++) {
> - event = pevent->events[i];
> + for (i = 0; i < tep->nr_events; i++) {
> + event = tep->events[i];
> if (strcmp(event->name, name) == 0) {
> if (!sys)
> break;
next prev parent reply other threads:[~2018-12-11 17:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 9:22 [PATCH 0/2] convert traceevent into a thread safe library Tzvetomir Stoyanov
2018-12-05 9:22 ` [PATCH 1/2] tools/lib/traceevent: make libtraceevent thread safe Tzvetomir Stoyanov
2018-12-11 16:56 ` Steven Rostedt
2018-12-11 17:29 ` Steven Rostedt [this message]
2018-12-05 9:22 ` [PATCH 2/2] tools/lib/traceevent: make few libtraceevent internal variables to be per thread Tzvetomir Stoyanov
-- strict thread matches above, loose matches on Subject: below --
2018-11-30 13:13 [PATCH 0/2] convert traceevent into a thread safe library Tzvetomir Stoyanov
2018-11-30 13:13 ` [PATCH 1/2] tools/lib/traceevent: make libtraceevent thread safe Tzvetomir Stoyanov
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=20181211122917.742b586e@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tstoyanov@vmware.com \
/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;
as well as URLs for NNTP newsgroup(s).