https://bugs.lttng.org/https://bugs.lttng.org/themes/lttng/favicon/a.ico?14249722912016-07-20T22:42:50ZLTTng bugs repositoryLTTng-tools - Bug #1033: lttng load does not preserve event or channel orderinghttps://bugs.lttng.org/issues/1033?journal_id=30662016-07-20T22:42:50ZJérémie Galarneaujeremie.galarneau@efficios.com
<ul></ul><p>I'm not sure what you mean by "it should be noted that an event list (for instance) can be optimized against lookup by ensuring the most-frequently requested events appear at the head of the list."</p>
<p>Do you mean improving the tracers' performance by ordering the events in a particular way?</p> LTTng-tools - Bug #1033: lttng load does not preserve event or channel orderinghttps://bugs.lttng.org/issues/1033?journal_id=30712016-07-21T13:07:58ZDaniel U. Thibaultdaniel.thibault@drdc-rddc.gc.ca
<ul></ul><p>Yes. Suppose 90% of my events are of a certain type and are assigned to a certain channel while the remaining 10% are spread across a dozen or so other channels. If the majority event's channel is the first in the channel list, every lookup for that channel will terminate faster than if it is at the end of the list. That's just a few instruction cycles, but every little bit helps sometimes.</p>
<p>If the channel were looked up every time the event occurs, it would mean large savings, but I don't think that's how LTTng works (I suspect the session daemon looks up the event type once at session start and sets up the tracepoint providers so they have the channel pointer in persistent memory). It may be more important in user-space, where events can register and unregister repeatedly during a session.</p>
<p>The annoyance of having the channel list invert with every session load/save cycle would also cause problems during trace analysis, as the babeltrace API recovers channel IDs and not channel names: a user creating a collection of several sessions, some of which are using an inverted channel list with respect to the other sessions, would be puzzled by the changing channel IDs (TRACE_PACKET_HEADER stream_id) of his events.</p> LTTng-tools - Bug #1033: lttng load does not preserve event or channel orderinghttps://bugs.lttng.org/issues/1033?journal_id=30792016-08-03T18:46:12ZJérémie Galarneaujeremie.galarneau@efficios.com
<ul></ul><p>Daniel U. Thibault wrote:</p>
<blockquote>
<p>Yes. Suppose 90% of my events are of a certain type and are assigned to a certain channel while the remaining 10% are spread across a dozen or so other channels. If the majority event's channel is the first in the channel list, every lookup for that channel will terminate faster than if it is at the end of the list. That's just a few instruction cycles, but every little bit helps sometimes.</p>
</blockquote>
<p>I will need to see the difference in a benchmark to justify changing this on the grounds of performance concerns. I'm not convinced that it makes a noticeable difference in practice, but I'm open to being proven wrong.</p>
<blockquote>
<p>If the channel were looked up every time the event occurs, it would mean large savings, but I don't think that's how LTTng works (I suspect the session daemon looks up the event type once at session start and sets up the tracepoint providers so they have the channel pointer in persistent memory). It may be more important in user-space, where events can register and unregister repeatedly during a session.</p>
</blockquote>
<p>There are no such look-ups happening at run-time, as you pointed out.</p>
<blockquote>
<p>The annoyance of having the channel list invert with every session load/save cycle would also cause problems during trace analysis, as the babeltrace API recovers channel IDs and not channel names: a user creating a collection of several sessions, some of which are using an inverted channel list with respect to the other sessions, would be puzzled by the changing channel IDs (TRACE_PACKET_HEADER stream_id) of his events.</p>
</blockquote>
<p>There should indeed be a way to recover a human-readable channel name (or stream name, in CTF parlance). However, the tracer offers no guarantee that channel IDs will be preserved from one session to the next. The fact that this id is generated in such a "predictable" way is an implementation detail that is not guaranteed to remain unchanged in the future.</p> LTTng-tools - Bug #1033: lttng load does not preserve event or channel orderinghttps://bugs.lttng.org/issues/1033?journal_id=30822016-08-03T19:01:56ZDaniel U. Thibaultdaniel.thibault@drdc-rddc.gc.ca
<ul></ul><p>Jérémie Galarneau wrote:</p>
<blockquote>
<p>Daniel U. Thibault wrote:</p>
<blockquote>
<p>The annoyance of having the channel list invert with every session load/save cycle would also cause problems during trace analysis, as the babeltrace API recovers channel IDs and not channel names: a user creating a collection of several sessions, some of which are using an inverted channel list with respect to the other sessions, would be puzzled by the changing channel IDs (TRACE_PACKET_HEADER stream_id) of his events.</p>
</blockquote>
<p>There should indeed be a way to recover a human-readable channel name (or stream name, in CTF parlance). However, the tracer offers no guarantee that channel IDs will be preserved from one session to the next. The fact that this id is generated in such a "predictable" way is an implementation detail that is not guaranteed to remain unchanged in the future.</p>
</blockquote>
<p>Until the babeltrace API offers a way of recovering the channel names, the users have no choice but to fall back on channel IDs. We're just lucky that (for now) the IDs are generated predictably. It's true one should not rely on this, but right now one can't do it any other way.</p>