From: Steven Rostedt <rostedt@goodmis.org>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: linux-trace-users@vger.kernel.org
Subject: Re: Trace event filtering
Date: Thu, 13 Jun 2019 14:02:20 -0400 [thread overview]
Message-ID: <20190613140220.2316ff77@gandalf.local.home> (raw)
In-Reply-To: <CAM_iQpU9SQPoZnwfdmOECftDPt99HLe4NX-b_JaCk1oRLYZB_g@mail.gmail.com>
On Thu, 13 Jun 2019 10:43:22 -0700
Cong Wang <xiyou.wangcong@gmail.com> wrote:
> Hi, all
Hi Cong,
>
> I have a simple question about filters in libtraceevent. It looks like
> libtraceevent parses and matches filters in user-space, but kernel
> already implements filtering in kernel-space which is better because
> it should prevent events from generating, if not matched. So why
> doesn't libtraceevent use kernel filters?
The libtraceevent library is made to process the data after it has been
recorded. It is not the library for use of starting the recording,
hence there's no reason to make it use kernel filtering.
>
> I am trying to filter out non-error block_rq_complete events, clearly
> I don't want to see rasdaemon woken up every time for error==0 case,
> which is literally all the time.
You can do that by this:
echo 'error != 0' > /sys/kernel/tracing/events/block/block_rq_complete/filter
Note, trace-cmd does this, and we are working on making a libftrace.so
(hopefully it will be out this year) that will allow you to do this
easily from any application.
>
> BTW, the user-space filters have slightly different syntax with
> kernel-space filters, at least the regex matching looks slightly
> different to me.
Yes, the parsing in the kernel is very limited, but for userspace, we
have the regex (man regex) at our disposal, that the kernel does not
have. Thus, we use that powerful engine. Unfortunately, that means that
the kernel and the userspace filtering will be different.
>
> Am I miss anything here?
Did that answer all your questions?
-- Steve
next prev parent reply other threads:[~2019-06-13 18:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 17:43 Trace event filtering Cong Wang
2019-06-13 18:02 ` Steven Rostedt [this message]
2019-06-13 18:33 ` Cong Wang
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=20190613140220.2316ff77@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-users@vger.kernel.org \
--cc=xiyou.wangcong@gmail.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).