2 * SPDX-License-Identifier: MIT
4 * Copyright 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
7 #include <babeltrace2/babeltrace.h>
13 #include "common/assert.h"
14 #include "common/common.h"
15 #include "common/macros.h"
16 #include "common/uuid.h"
20 struct message_to_compare
{
21 const bt_message
*msg
;
22 const bt_trace
*trace
;
23 const bt_stream
*stream
;
26 struct messages_to_compare
{
27 struct message_to_compare left
;
28 struct message_to_compare right
;
32 int message_type_weight(const bt_message_type msg_type
)
37 case BT_MESSAGE_TYPE_STREAM_BEGINNING
:
40 case BT_MESSAGE_TYPE_PACKET_BEGINNING
:
43 case BT_MESSAGE_TYPE_EVENT
:
46 case BT_MESSAGE_TYPE_DISCARDED_EVENTS
:
49 case BT_MESSAGE_TYPE_PACKET_END
:
52 case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY
:
55 case BT_MESSAGE_TYPE_DISCARDED_PACKETS
:
58 case BT_MESSAGE_TYPE_STREAM_END
:
69 * Compare 2 messages to order them in a deterministic way based on their
71 * Returns -1 is left message must go first
72 * Returns 1 is right message must go first
75 int compare_messages_by_type(struct messages_to_compare
*msgs
)
77 bt_message_type left_msg_type
= bt_message_get_type(msgs
->left
.msg
);
78 bt_message_type right_msg_type
= bt_message_get_type(msgs
->right
.msg
);
80 return message_type_weight(right_msg_type
) -
81 message_type_weight(left_msg_type
);
85 int compare_events(const bt_event
*left_event
, const bt_event
*right_event
)
88 const bt_event_class
*left_event_class
, *right_event_class
;
89 uint64_t left_event_class_id
, right_event_class_id
;
90 const char *left_event_class_name
, *right_event_class_name
,
91 *left_event_class_emf_uri
, *right_event_class_emf_uri
;
92 bt_event_class_log_level left_event_class_log_level
, right_event_class_log_level
;
93 bt_property_availability left_log_level_avail
, right_log_level_avail
;
95 left_event_class
= bt_event_borrow_class_const(left_event
);
96 right_event_class
= bt_event_borrow_class_const(right_event
);
98 left_event_class_id
= bt_event_class_get_id(left_event_class
);
99 right_event_class_id
= bt_event_class_get_id(right_event_class
);
101 if (left_event_class_id
> right_event_class_id
) {
104 } else if (left_event_class_id
< right_event_class_id
) {
109 left_event_class_name
= bt_event_class_get_name(left_event_class
);
110 right_event_class_name
= bt_event_class_get_name(right_event_class
);
111 if (left_event_class_name
&& right_event_class_name
) {
112 ret
= strcmp(left_event_class_name
, right_event_class_name
);
116 } else if (!left_event_class_name
&& right_event_class_name
) {
119 } else if (left_event_class_name
&& !right_event_class_name
) {
124 left_log_level_avail
= bt_event_class_get_log_level(left_event_class
,
125 &left_event_class_log_level
);
126 right_log_level_avail
= bt_event_class_get_log_level(right_event_class
,
127 &right_event_class_log_level
);
129 if (left_log_level_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
130 right_log_level_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
131 ret
= left_event_class_log_level
- right_event_class_log_level
;
135 } else if (left_log_level_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
136 right_log_level_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
) {
139 } else if (left_log_level_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
&&
140 right_log_level_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
145 left_event_class_emf_uri
= bt_event_class_get_emf_uri(left_event_class
);
146 right_event_class_emf_uri
= bt_event_class_get_emf_uri(right_event_class
);
147 if (left_event_class_emf_uri
&& right_event_class_emf_uri
) {
148 ret
= strcmp(left_event_class_emf_uri
, right_event_class_emf_uri
);
152 } else if (!left_event_class_emf_uri
&& right_event_class_emf_uri
) {
155 } else if (left_event_class_emf_uri
&& !right_event_class_emf_uri
) {
166 int compare_clock_classes(const bt_clock_class
*left_cc
,
167 const bt_clock_class
*right_cc
)
170 const char *left_clock_class_name
, *right_clock_class_name
;
171 bt_uuid left_clock_class_uuid
, right_clock_class_uuid
;
172 uint64_t left_freq
, right_freq
, left_prec
, right_prec
;
174 left_clock_class_uuid
= bt_clock_class_get_uuid(left_cc
);
175 right_clock_class_uuid
= bt_clock_class_get_uuid(right_cc
);
177 if (left_clock_class_uuid
&& !right_clock_class_uuid
) {
180 } else if (!left_clock_class_uuid
&& right_clock_class_uuid
) {
183 } else if (left_clock_class_uuid
&& right_clock_class_uuid
) {
184 ret
= bt_uuid_compare(left_clock_class_uuid
,
185 right_clock_class_uuid
);
192 left_clock_class_name
= bt_clock_class_get_name(left_cc
);
193 right_clock_class_name
= bt_clock_class_get_name(right_cc
);
195 if (left_clock_class_name
&& !right_clock_class_name
) {
198 } else if (!left_clock_class_name
&& right_clock_class_name
) {
201 } else if (left_clock_class_name
&& right_clock_class_name
) {
202 ret
= strcmp(left_clock_class_name
, right_clock_class_name
);
208 left_freq
= bt_clock_class_get_frequency(left_cc
);
209 right_freq
= bt_clock_class_get_frequency(right_cc
);
211 ret
= right_freq
- left_freq
;
216 left_prec
= bt_clock_class_get_precision(left_cc
);
217 right_prec
= bt_clock_class_get_precision(right_cc
);
219 ret
= right_prec
- left_prec
;
229 int compare_streams(const bt_stream
*left_stream
, const bt_stream
*right_stream
)
232 const char *left_stream_name
, *right_stream_name
,
233 *left_stream_class_name
, *right_stream_class_name
;
234 const bt_stream_class
*left_stream_class
, *right_stream_class
;
237 * No need to compare stream id as it was checked earlier and if we are
238 * here it means they are identical or both absent.
240 BT_ASSERT_DBG(bt_stream_get_id(left_stream
) ==
241 bt_stream_get_id(right_stream
));
243 /* Compare stream name. */
244 left_stream_name
= bt_stream_get_name(left_stream
);
245 right_stream_name
= bt_stream_get_name(right_stream
);
247 if (left_stream_name
&& right_stream_name
) {
248 ret
= strcmp(left_stream_name
, right_stream_name
);
252 } else if (!left_stream_name
&& right_stream_name
) {
255 } else if (left_stream_name
&& !right_stream_name
) {
260 left_stream_class
= bt_stream_borrow_class_const(left_stream
);
261 right_stream_class
= bt_stream_borrow_class_const(right_stream
);
264 * No need to compare stream class id as it was checked earlier and if
265 * we are here it means they are identical.
267 BT_ASSERT_DBG(bt_stream_class_get_id(left_stream_class
) ==
268 bt_stream_class_get_id(right_stream_class
));
270 /* Compare stream class name. */
271 left_stream_class_name
= bt_stream_class_get_name(left_stream_class
);
272 right_stream_class_name
= bt_stream_class_get_name(right_stream_class
);
274 if (left_stream_class_name
&& right_stream_class_name
) {
275 ret
= strcmp(left_stream_class_name
, right_stream_class_name
);
279 } else if (!left_stream_class_name
&& right_stream_class_name
) {
282 } else if (left_stream_class_name
&& !right_stream_class_name
) {
287 /* Compare stream class automatic event class id assignment. */
288 if (bt_stream_class_assigns_automatic_event_class_id(left_stream_class
) &&
289 !bt_stream_class_assigns_automatic_event_class_id(right_stream_class
)) {
292 } else if (!bt_stream_class_assigns_automatic_event_class_id(left_stream_class
) &&
293 bt_stream_class_assigns_automatic_event_class_id(right_stream_class
)) {
298 /* Compare stream class automatic stream id assignment. */
299 if (bt_stream_class_assigns_automatic_stream_id(left_stream_class
) &&
300 !bt_stream_class_assigns_automatic_stream_id(right_stream_class
)) {
303 } else if (!bt_stream_class_assigns_automatic_stream_id(left_stream_class
) &&
304 bt_stream_class_assigns_automatic_stream_id(right_stream_class
)) {
309 /* Compare stream class support of discarded events. */
310 if (bt_stream_class_supports_discarded_events(left_stream_class
) &&
311 !bt_stream_class_supports_discarded_events(right_stream_class
)) {
314 } else if (!bt_stream_class_supports_discarded_events(left_stream_class
) &&
315 bt_stream_class_supports_discarded_events(right_stream_class
)) {
320 /* Compare stream class discarded events default clock snapshot. */
321 if (bt_stream_class_discarded_events_have_default_clock_snapshots(left_stream_class
) &&
322 !bt_stream_class_discarded_events_have_default_clock_snapshots(right_stream_class
)) {
325 } else if (!bt_stream_class_discarded_events_have_default_clock_snapshots(left_stream_class
) &&
326 bt_stream_class_discarded_events_have_default_clock_snapshots(right_stream_class
)) {
331 /* Compare stream class support of packets. */
332 if (bt_stream_class_supports_packets(left_stream_class
) &&
333 !bt_stream_class_supports_packets(right_stream_class
)) {
336 } else if (!bt_stream_class_supports_packets(left_stream_class
) &&
337 bt_stream_class_supports_packets(right_stream_class
)) {
342 if (!bt_stream_class_supports_packets(left_stream_class
)) {
343 /* Skip all packet related checks. */
348 * Compare stream class presence of discarded packets beginning default
351 if (bt_stream_class_packets_have_beginning_default_clock_snapshot(left_stream_class
) &&
352 !bt_stream_class_packets_have_beginning_default_clock_snapshot(right_stream_class
)) {
355 } else if (!bt_stream_class_packets_have_beginning_default_clock_snapshot(left_stream_class
) &&
356 bt_stream_class_packets_have_beginning_default_clock_snapshot(right_stream_class
)) {
362 * Compare stream class presence of discarded packets end default clock
365 if (bt_stream_class_packets_have_end_default_clock_snapshot(left_stream_class
) &&
366 !bt_stream_class_packets_have_end_default_clock_snapshot(right_stream_class
)) {
369 } else if (!bt_stream_class_packets_have_end_default_clock_snapshot(left_stream_class
) &&
370 bt_stream_class_packets_have_end_default_clock_snapshot(right_stream_class
)) {
375 /* Compare stream class support of discarded packets. */
376 if (bt_stream_class_supports_discarded_packets(left_stream_class
) &&
377 !bt_stream_class_supports_discarded_packets(right_stream_class
)) {
380 } else if (!bt_stream_class_supports_discarded_packets(left_stream_class
) &&
381 bt_stream_class_supports_discarded_packets(right_stream_class
)) {
386 /* Compare stream class discarded packets default clock snapshot. */
387 if (bt_stream_class_discarded_packets_have_default_clock_snapshots(left_stream_class
) &&
388 !bt_stream_class_discarded_packets_have_default_clock_snapshots(right_stream_class
)) {
391 } else if (!bt_stream_class_discarded_packets_have_default_clock_snapshots(left_stream_class
) &&
392 bt_stream_class_discarded_packets_have_default_clock_snapshots(right_stream_class
)) {
402 int compare_clock_snapshots(const bt_clock_snapshot
*left_cs
,
403 const bt_clock_snapshot
*right_cs
)
405 uint64_t left_cs_value
= bt_clock_snapshot_get_value(left_cs
);
406 uint64_t right_cs_value
= bt_clock_snapshot_get_value(right_cs
);
408 return left_cs_value
- right_cs_value
;
412 const bt_stream
*borrow_stream(const bt_message
*msg
)
414 bt_message_type msg_type
= bt_message_get_type(msg
);
415 const bt_stream
*stream
= NULL
;
416 const bt_packet
*packet
= NULL
;
417 const bt_event
*event
= NULL
;
420 case BT_MESSAGE_TYPE_STREAM_BEGINNING
:
421 stream
= bt_message_stream_beginning_borrow_stream_const(msg
);
423 case BT_MESSAGE_TYPE_STREAM_END
:
424 stream
= bt_message_stream_end_borrow_stream_const(msg
);
426 case BT_MESSAGE_TYPE_PACKET_BEGINNING
:
427 packet
= bt_message_packet_beginning_borrow_packet_const(msg
);
428 stream
= bt_packet_borrow_stream_const(packet
);
430 case BT_MESSAGE_TYPE_PACKET_END
:
431 packet
= bt_message_packet_end_borrow_packet_const(msg
);
432 stream
= bt_packet_borrow_stream_const(packet
);
434 case BT_MESSAGE_TYPE_EVENT
:
435 event
= bt_message_event_borrow_event_const(msg
);
436 stream
= bt_event_borrow_stream_const(event
);
438 case BT_MESSAGE_TYPE_DISCARDED_EVENTS
:
439 stream
= bt_message_discarded_events_borrow_stream_const(msg
);
441 case BT_MESSAGE_TYPE_DISCARDED_PACKETS
:
442 stream
= bt_message_discarded_packets_borrow_stream_const(msg
);
444 case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY
:
455 const bt_trace
*borrow_trace(const bt_message
*msg
)
457 const bt_trace
*trace
= NULL
;
458 const bt_stream
*stream
= NULL
;
460 stream
= borrow_stream(msg
);
462 trace
= bt_stream_borrow_trace_const(stream
);
469 int compare_messages_by_trace_name(struct messages_to_compare
*msgs
)
472 const char *left_trace_name
= NULL
, *right_trace_name
= NULL
;
474 if (msgs
->left
.trace
&& !msgs
->right
.trace
) {
479 if (!msgs
->left
.trace
&& msgs
->right
.trace
) {
484 if (!msgs
->left
.trace
&& !msgs
->right
.trace
) {
489 left_trace_name
= bt_trace_get_name(msgs
->left
.trace
);
490 right_trace_name
= bt_trace_get_name(msgs
->right
.trace
);
492 if (left_trace_name
&& !right_trace_name
) {
497 if (!left_trace_name
&& right_trace_name
) {
502 if (!left_trace_name
&& !right_trace_name
) {
507 ret
= strcmp(left_trace_name
, right_trace_name
);
513 int compare_messages_by_trace_uuid(struct messages_to_compare
*msgs
)
516 bt_uuid left_trace_uuid
= NULL
, right_trace_uuid
= NULL
;
518 if (msgs
->left
.trace
&& !msgs
->right
.trace
) {
523 if (!msgs
->left
.trace
&& msgs
->right
.trace
) {
528 if (!msgs
->left
.trace
&& !msgs
->right
.trace
) {
533 left_trace_uuid
= bt_trace_get_uuid(msgs
->left
.trace
);
534 right_trace_uuid
= bt_trace_get_uuid(msgs
->right
.trace
);
536 if (left_trace_uuid
&& !right_trace_uuid
) {
541 if (!left_trace_uuid
&& right_trace_uuid
) {
546 if (!left_trace_uuid
&& !right_trace_uuid
) {
551 ret
= bt_uuid_compare(left_trace_uuid
, right_trace_uuid
);
557 int compare_messages_by_stream_class_id(struct messages_to_compare
*msgs
)
560 uint64_t left_stream_class_id
= 0, right_stream_class_id
= 0;
562 if (msgs
->left
.stream
&& !msgs
->right
.stream
) {
567 if (!msgs
->left
.stream
&& msgs
->right
.stream
) {
572 if (!msgs
->left
.stream
&& !msgs
->right
.stream
) {
577 left_stream_class_id
= bt_stream_class_get_id(
578 bt_stream_borrow_class_const(msgs
->left
.stream
));
580 right_stream_class_id
= bt_stream_class_get_id(
581 bt_stream_borrow_class_const(msgs
->right
.stream
));
583 if (left_stream_class_id
== right_stream_class_id
) {
588 ret
= (left_stream_class_id
< right_stream_class_id
) ? -1 : 1;
595 int compare_messages_by_stream_id(struct messages_to_compare
*msgs
)
598 uint64_t left_stream_id
= 0, right_stream_id
= 0;
600 if (msgs
->left
.stream
&& !msgs
->right
.stream
) {
605 if (!msgs
->left
.stream
&& msgs
->right
.stream
) {
610 if (!msgs
->left
.stream
&& !msgs
->right
.stream
) {
615 left_stream_id
= bt_stream_get_id(msgs
->left
.stream
);
616 right_stream_id
= bt_stream_get_id(msgs
->right
.stream
);
618 if (left_stream_id
== right_stream_id
) {
623 ret
= (left_stream_id
< right_stream_id
) ? -1 : 1;
630 int compare_messages_same_type(struct messages_to_compare
*msgs
)
635 * Both messages are of the same type, we must compare characterics of
636 * the messages such as the attributes of the event in a event message.
638 BT_ASSERT_DBG(bt_message_get_type(msgs
->left
.msg
) ==
639 bt_message_get_type(msgs
->right
.msg
));
641 switch (bt_message_get_type(msgs
->left
.msg
)) {
642 case BT_MESSAGE_TYPE_STREAM_BEGINNING
:
644 case BT_MESSAGE_TYPE_STREAM_END
:
646 case BT_MESSAGE_TYPE_PACKET_BEGINNING
:
648 case BT_MESSAGE_TYPE_PACKET_END
:
649 ret
= compare_streams(msgs
->left
.stream
, msgs
->right
.stream
);
655 case BT_MESSAGE_TYPE_EVENT
:
657 const bt_event
*left_event
, *right_event
;
658 left_event
= bt_message_event_borrow_event_const(msgs
->left
.msg
);
659 right_event
= bt_message_event_borrow_event_const(msgs
->right
.msg
);
661 ret
= compare_events(left_event
, right_event
);
666 ret
= compare_streams(msgs
->left
.stream
, msgs
->right
.stream
);
672 case BT_MESSAGE_TYPE_DISCARDED_EVENTS
:
674 const bt_stream_class
*left_stream_class
;
675 bt_property_availability left_event_count_avail
,
676 right_event_count_avail
;
677 uint64_t left_event_count
, right_event_count
;
680 * Compare streams first to check if there is a
681 * mismatch about discarded event related configuration
682 * in the stream class.
684 ret
= compare_streams(msgs
->left
.stream
, msgs
->right
.stream
);
689 left_stream_class
= bt_stream_borrow_class_const(msgs
->left
.stream
);
690 if (bt_stream_class_discarded_events_have_default_clock_snapshots(
691 left_stream_class
)) {
692 const bt_clock_snapshot
*left_beg_cs
=
693 bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(msgs
->left
.msg
);
694 const bt_clock_snapshot
*right_beg_cs
=
695 bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(msgs
->right
.msg
);
696 const bt_clock_snapshot
*left_end_cs
=
697 bt_message_discarded_events_borrow_end_default_clock_snapshot_const(msgs
->left
.msg
);
698 const bt_clock_snapshot
*right_end_cs
=
699 bt_message_discarded_events_borrow_end_default_clock_snapshot_const(msgs
->right
.msg
);
701 ret
= compare_clock_snapshots(left_beg_cs
, right_beg_cs
);
706 ret
= compare_clock_snapshots(left_end_cs
, right_end_cs
);
711 ret
= compare_clock_classes(
712 bt_clock_snapshot_borrow_clock_class_const(left_beg_cs
),
713 bt_clock_snapshot_borrow_clock_class_const(right_beg_cs
));
719 left_event_count_avail
=
720 bt_message_discarded_events_get_count(
721 msgs
->left
.msg
, &left_event_count
);
722 right_event_count_avail
=
723 bt_message_discarded_events_get_count(
724 msgs
->right
.msg
, &right_event_count
);
725 if (left_event_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
726 right_event_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
727 ret
= left_event_count
- right_event_count
;
731 } else if (left_event_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
732 right_event_count_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
) {
735 } else if (left_event_count_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
&&
736 right_event_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
743 case BT_MESSAGE_TYPE_DISCARDED_PACKETS
:
745 const bt_stream_class
*left_stream_class
;
746 bt_property_availability left_packet_count_avail
,
747 right_packet_count_avail
;
748 uint64_t left_packet_count
, right_packet_count
;
751 * Compare streams first to check if there is a
752 * mismatch about discarded packets related
753 * configuration in the stream class.
755 ret
= compare_streams(msgs
->left
.stream
, msgs
->right
.stream
);
760 left_stream_class
= bt_stream_borrow_class_const(msgs
->left
.stream
);
762 if (bt_stream_class_discarded_packets_have_default_clock_snapshots(
763 left_stream_class
)) {
764 const bt_clock_snapshot
*left_beg_cs
=
765 bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(msgs
->left
.msg
);
766 const bt_clock_snapshot
*right_beg_cs
=
767 bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(msgs
->right
.msg
);
768 const bt_clock_snapshot
*left_end_cs
=
769 bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(msgs
->left
.msg
);
770 const bt_clock_snapshot
*right_end_cs
=
771 bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(msgs
->right
.msg
);
773 ret
= compare_clock_snapshots(left_beg_cs
, right_beg_cs
);
778 ret
= compare_clock_snapshots(left_end_cs
, right_end_cs
);
783 ret
= compare_clock_classes(
784 bt_clock_snapshot_borrow_clock_class_const(left_beg_cs
),
785 bt_clock_snapshot_borrow_clock_class_const(right_beg_cs
));
791 left_packet_count_avail
= bt_message_discarded_packets_get_count(
792 msgs
->left
.msg
, &left_packet_count
);
793 right_packet_count_avail
= bt_message_discarded_packets_get_count(
794 msgs
->right
.msg
, &right_packet_count
);
795 if (left_packet_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
796 right_packet_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
797 ret
= left_packet_count
- right_packet_count
;
801 } else if (left_packet_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
802 right_packet_count_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
) {
805 } else if (left_packet_count_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
&&
806 right_packet_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
813 case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY
:
815 const bt_clock_snapshot
*left_cs
=
816 bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(msgs
->left
.msg
);
817 const bt_clock_snapshot
*right_cs
=
818 bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(msgs
->right
.msg
);
820 ret
= compare_clock_snapshots(left_cs
, right_cs
);
825 ret
= compare_clock_classes(
826 bt_clock_snapshot_borrow_clock_class_const(left_cs
),
827 bt_clock_snapshot_borrow_clock_class_const(right_cs
));
842 int common_muxing_compare_messages(const bt_message
*left_msg
,
843 const bt_message
*right_msg
)
846 struct messages_to_compare msgs
;
848 BT_ASSERT_DBG(left_msg
!= right_msg
);
850 msgs
.left
.msg
= left_msg
;
851 msgs
.left
.trace
= borrow_trace(left_msg
);
852 msgs
.left
.stream
= borrow_stream(left_msg
);
854 msgs
.right
.msg
= right_msg
;
855 msgs
.right
.trace
= borrow_trace(right_msg
);
856 msgs
.right
.stream
= borrow_stream(right_msg
);
858 /* Same timestamp: compare trace UUIDs. */
859 ret
= compare_messages_by_trace_uuid(&msgs
);
864 /* Same timestamp and trace UUID: compare trace names. */
865 ret
= compare_messages_by_trace_name(&msgs
);
871 * Same timestamp, trace name, and trace UUID: compare stream class
874 ret
= compare_messages_by_stream_class_id(&msgs
);
880 * Same timestamp, trace name, trace UUID, and stream class ID: compare
883 ret
= compare_messages_by_stream_id(&msgs
);
888 if (bt_message_get_type(msgs
.left
.msg
) !=
889 bt_message_get_type(msgs
.right
.msg
)) {
891 * The messages are of different type, we order (arbitrarily)
892 * in the following way:
893 * SB < PB < EV < DE < MI < PE < DP < SE
895 ret
= compare_messages_by_type(&msgs
);
900 /* The messages are of the same type. */
901 ret
= compare_messages_same_type(&msgs
);