[lttng-dev] babeltrace and strictly sorting events

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Thu Mar 7 11:25:08 EST 2013


   Babeltrace sorts the events submitted to it from a variety of source files (multiple traces, each potentially with multiple domains, each potentially with multiple sources (for UST anyway), each potentially with multiple channels, each potentially with multiple CPU IDs) based on timestamps (babeltrace/lib/iterator.c's stream_compare).  This works fine, but what about the case where two events have strictly the same timestamp?  Within a single host, this can only happen if they have different CPU IDs.  It can also happen when merging traces from different hosts.  As it currently stands, stream_compare looks at the timestamps only, so the ordering in the aforementioned cases is undefined (left to the luck of the heap sort).

   I think stream_compare needs to also check for (s_a->parent.real_timestamp == s_b->parent.real_timestamp) and, in that case only, compare hosts (alphabetical ordering is as good as any), then CPU IDs (numerical ordering).  Obviously, this is a potentially expensive change since this function is called awfully often when babeltracing or lttngtopping large traces, so maybe the extra tests could be controlled by a command option (called --strict-ordering, say).

   Or is this so rare it's not worth bothering with?  In which case a small cautionary note in babeltrace's man pages would be enough (those man pages really ought to state that babeltrace's output is time-ordered; right now they don't mention this at all).

Daniel U. Thibault
R & D pour la défense Canada - Valcartier (RDDC Valcartier) / Defence R&D Canada - Valcartier (DRDC Valcartier)
Cyber sécurité pour les missions essentielles (CME) / Mission Critical Cyber Security (MCCS)
Protection des systèmes et contremesures (PSC) / Systems Protection & Countermeasures (SPC)
2459 route de la Bravoure
Québec, QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada / Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>



More information about the lttng-dev mailing list