Bug #1033
openlttng load does not preserve event or channel ordering
0%
Description
lttng load
builds the channel and event lists as if they were entered using enable-channel
and enable-event
commands, in the order that they appear in the .lttng
file. Internally, these lists are built in stack-like fashion, each addition pushing the already-entered channels or events down and inserting the new channel or event at the head of the list. lttng save
, on the other hand, writes the channels and events to the .lttng
file in the same order that they appear in the internal lists, starting at each list's head. This means an lttng load
- lttng save
cycle will completely invert the channel and event ordering within the .lttng
file.
This normally matters little, but 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. A user that fine-tuned his .lttng
files in this way would understandably be upset that lttng load
inverts the order.
This can be fixed by having the lttng load
routine read each XML enumeration into a buffer, issuing the LTTng list-addition commands in last-to-first order. Since the XML enumerations in the .lttng
files are nested, recursion is required and the desired corrected behaviour can be achieved by having the list-addition commands appear in the popping phase of the recursion.
Note that domain ordering is preserved by lttng load
.