From: Tzvetomir Stoyanov <tstoyanov@vmware.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH 1/2] trace-cmd: remove parsing_failures APIs from libtraceevent
Date: Wed, 17 Apr 2019 13:55:58 +0000 [thread overview]
Message-ID: <CACqStockaqQu_7mn5L-+8=65wPSKPFVwh+2ChqAuV5PZoVA3Ug@mail.gmail.com> (raw)
In-Reply-To: <20190417091922.1e4c5f19@gandalf.local.home>
On Wed, Apr 17, 2019 at 4:19 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 17 Apr 2019 09:10:26 +0000
> Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
>
> Let's not add this. Instead add a "parsing_failures" to the
> > > tracecmd_input handle, and add:
> > >
> > > int tracecmd_get_parsing_failures(struct tracecmd_input *handle)
> > > {
> > > return handle->parsing_failures;
> > > }
> > >
> > I hesitated if to add new API, or use additional parameter to the
> > existing functions.
> > The reason for this change is to remove "parsing_failures" from
> > traceevent library,
> > that's why I decided not to move it to trace-cmd library. Using new
> > library API is nicer,
> > I can reimplement it in this way, but we may have the same concerns
> > when trace-cmd
> > library comes out.
> >
>
> That's a valid concern, but there is a difference between the
> libtraceevent and libftrace (or whatever we decide to name it ;-)
>
> The trace-cmd code will be a higher level library on top of
> libtraceevent. The main difference is that the trace-cmd code has
> algorithms that deal with the counter but the tep code did not. We
> incorrectly added that counter to the tep code only because a higher
> layer needed it. The tep layer did not understand the context of that
> counter.
>
> My concern with the counter in the tep code was that it was at the
> wrong level. That is, the tep code had no processing for that counter.
> To put it a different way, the tep code did not understand the context
> of the counter. We had to add API to set and reset that counter, which
> was a clear indication that the tep library shouldn't be the one to
> store it.
>
> Now at the trace-cmd code level (libftrace), it most definitely
> understands the context of that counter. Thus the counter should be
> stored at that level. We didn't need to add APIs to the trace-cmd code
> to reset that counter, or increment it. Because the trace-cmd library
> knows the context of the counter. That's how one knows if the library
> should store the counter or not.
>
> Let's make the parsing_failures part of the tracecmd_input handler and
> it will simplify this patch quite a bit.
>
> Does that make sense?
>
Yes, it makes sense. I'll prepare the next version of the patch.
> -- Steve
>
>
> > > > +{
> > > > + return _tracecmd_read_headers(handle, parsing_failures);
> > > > +}
> > > > +
> > >
> > > [..]
> > >
> > > > diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
> > > > index 52fa1bd..fe116cc 100644
> > > > --- a/tracecmd/trace-read.c
> > > > +++ b/tracecmd/trace-read.c
> > > > @@ -1417,6 +1417,7 @@ void trace_report (int argc, char **argv)
> > > > unsigned long long tsoffset = 0;
> > > > unsigned long long ts2secs = 0;
> > > > unsigned long long ts2sc;
> > > > + int parsing_failures;
> > > > int show_stat = 0;
> > > > int show_funcs = 0;
> > > > int show_endian = 0;
> > > > @@ -1714,10 +1715,10 @@ void trace_report (int argc, char **argv)
> > > > tracecmd_print_events(handle, print_event);
> > > > return;
> > > > }
> > > > -
> > > > - ret = tracecmd_read_headers(handle);
> > > > + parsing_failures = 0;
> > > > + ret = tracecmd_read_headers_failures(handle, &parsing_failures);
> > >
> > > Here we should do:
> > >
> > > ret = tracecmd_read_headers(handle);
> > >
> > > > if (check_event_parsing) {
> > > > - if (ret || tep_get_parsing_failures(pevent))
> > >
> > > if (ret || tracecmd_get_parsing_failures(handle))
> > >
> > > -- Steve
> > >
> > > > + if (ret || parsing_failures)
> > > > exit(EINVAL);
> > > > else
> > > > exit(0);
> > >
> >
> >
>
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
prev parent reply other threads:[~2019-04-17 13:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 12:58 [PATCH 1/2] trace-cmd: remove parsing_failures APIs from libtraceevent Tzvetomir Stoyanov
2019-04-15 12:58 ` [PATCH 2/2] trace-cmd: exit the application if runs in "filter test" mode Tzvetomir Stoyanov
2019-04-16 22:48 ` [PATCH 1/2] trace-cmd: remove parsing_failures APIs from libtraceevent Steven Rostedt
2019-04-17 9:10 ` Tzvetomir Stoyanov
2019-04-17 13:19 ` Steven Rostedt
2019-04-17 13:55 ` Tzvetomir Stoyanov [this message]
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='CACqStockaqQu_7mn5L-+8=65wPSKPFVwh+2ChqAuV5PZoVA3Ug@mail.gmail.com' \
--to=tstoyanov@vmware.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).