From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] LTTng specialized probes
Date: Wed, 8 Oct 2008 22:43:22 -0400 [thread overview]
Message-ID: <20081009024322.GC16931@Krystal> (raw)
In-Reply-To: <33307c790810080906k3314b0b6ib7e565f29c0848dc@mail.gmail.com>
* Martin Bligh (mbligh at google.com) wrote:
> > Has anyone thought of / tried out some caching mechanism for this task?
> > I mean, scan the format string once (I don't think it will change during
> > runtime... :->), save somewhere that it expects n bytes of
> > to-be-serialized data on the caller's stack and then get away with only
> > copying those over into the trace buffer on succeeding marker hits?
>
> Is it crazy to think of this as "everyone registers a print function", and
> we just provide a default print function that takes a string that people
> can use if they are not concerned with efficiency? Possibly with a different
> macro header if need be to hide it.
>
Yes, that's how I see it, just from the opposite end : I first aim to
provide a generic fallback so it's easy to use and leave the ability to
connect a specialized function to serialize the information when
performance matters.
> Another random thought ... was talking with Michael and Jiaying here about
> the markers, and it seemed one of the performance / complexity issues
> was the necessity to call multiple tracers from one marker (disclaimer:
> I haven't had the time to look at this in any detail, sorry, so please forgive
> if this totally misses something ...). Would it be possible to always just have
> one thing attached to the marker - this would be optimal for the common case.
> In the event that we do need multiple tracers attached, we could simply make
> the one thing attached to the marker a multiplexor that called a list of tracers
> (transparently).
This kind of optimization is already in the marker infrastructure : if
there is a single probe connected, a single callback is called and no
iteration is required on the probe function pointer array. This is not
done in the tracepoints however because this involves either another
level of function call (but we don't care in the case of markers because
we already have to do a va_start on the var args, which involves having
a first function level) or to spill mode code at the instrumentation
site. I have tried to keep the tracepoint code very compact at the
kernel instrumentation site by putting small optimized loop which
iterates on every connected marker.
The problem is that as soon as we add special-cases to optimize for
specific single-probe scenario, we have to spill more code at the kernel
instrumentation site, and if we do that, the kernel developers will
strongly oppose.
>
> I expect this would reduce complexity and speed up the common case, at the
> expense of a little performance in the uncommon case. Though all of this
> is fairly second-hand, so maybe is not useful ;-( Sorry, buried in
> Google-specific
> stuff right now.
>
Well, the tradeoff here is mostly to try to keep the instrumentation
that we put in the kernel code as small as possible in terms of
instruction cache hit which is opposed to any kind of tricky
optimization we would like to do to make some common cases faster when
tracing is enabled.
One thing we could do that might help making performance better is this:
We create a DEFINE_MARKER(name, string) and a get_marker_struct(name).
Those will permit to have the exact same thing the current markers give
us (declaring an event name, associate an ID to it and declare its
parameters). However, this would not imply any function call like what
markers currently require. By doing this, we could put the optimized
"type-specific" code which writes the data into the trace buffers
directly in the tracepoint probe and therefore skip two function calls,
which should make performance much better.
Mathieu
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next prev parent reply other threads:[~2008-10-09 2:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5df78e1d0809231814i4b9b98eeyfb9746e5dbb9eb72@mail.gmail.com>
[not found] ` <20080924072503.GA15570@bolzano.suse.de>
[not found] ` <532480950809240032t644448f7lc4fdc0dffca69b9@mail.gmail.com>
2008-10-06 14:11 ` Mathieu Desnoyers
2008-10-06 15:14 ` Martin Bligh
2008-10-06 15:26 ` Mathieu Desnoyers
2008-10-06 15:37 ` Martin Bligh
2008-10-06 15:56 ` Mathieu Desnoyers
2008-10-06 17:55 ` Jiaying Zhang
2008-10-06 17:55 ` Jiaying Zhang
2008-10-06 17:55 ` Jiaying Zhang
[not found] ` <5df78e1d0810071116i2e9790cdx8d5854dbfa50cfaf@mail.gmail.com>
2008-10-07 21:28 ` Michael Davidson
2008-10-07 21:28 ` Michael Davidson
2008-10-07 21:28 ` Michael Davidson
2008-10-08 0:07 ` Mathieu Desnoyers
2008-10-08 15:56 ` Jan Kiszka
2008-10-08 15:56 ` Jan Kiszka
2008-10-08 15:56 ` Jan Kiszka
2008-10-08 16:06 ` Martin Bligh
2008-10-09 2:43 ` Mathieu Desnoyers [this message]
2008-10-09 2:24 ` Mathieu Desnoyers
2008-10-09 2:24 ` Mathieu Desnoyers
2008-10-09 2:24 ` Mathieu Desnoyers
2008-10-09 3:04 ` Michael Davidson
2008-10-09 3:04 ` Michael Davidson
2008-10-09 3:04 ` Michael Davidson
2008-10-09 15:28 ` Mathieu Desnoyers
2008-10-09 15:39 ` Martin Bligh
2008-10-09 16:15 ` Mathieu Desnoyers
2008-10-09 16:28 ` Martin Bligh
2008-10-09 16:55 ` Mathieu Desnoyers
2008-10-08 0:26 ` Mathieu Desnoyers
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=20081009024322.GC16931@Krystal \
--to=compudj@krystal.dyndns.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