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
) {
165 int compare_streams(const bt_stream
*left_stream
, const bt_stream
*right_stream
)
168 const char *left_stream_name
, *right_stream_name
,
169 *left_stream_class_name
, *right_stream_class_name
;
170 const bt_stream_class
*left_stream_class
, *right_stream_class
;
173 * No need to compare stream id as it was checked earlier and if we are
174 * here it means they are identical or both absent.
176 BT_ASSERT_DBG(bt_stream_get_id(left_stream
) ==
177 bt_stream_get_id(right_stream
));
179 /* Compare stream name. */
180 left_stream_name
= bt_stream_get_name(left_stream
);
181 right_stream_name
= bt_stream_get_name(right_stream
);
183 if (left_stream_name
&& right_stream_name
) {
184 ret
= strcmp(left_stream_name
, right_stream_name
);
188 } else if (!left_stream_name
&& right_stream_name
) {
191 } else if (left_stream_name
&& !right_stream_name
) {
196 left_stream_class
= bt_stream_borrow_class_const(left_stream
);
197 right_stream_class
= bt_stream_borrow_class_const(right_stream
);
200 * No need to compare stream class id as it was checked earlier and if
201 * we are here it means they are identical.
203 BT_ASSERT_DBG(bt_stream_class_get_id(left_stream_class
) ==
204 bt_stream_class_get_id(right_stream_class
));
206 /* Compare stream class name. */
207 left_stream_class_name
= bt_stream_class_get_name(left_stream_class
);
208 right_stream_class_name
= bt_stream_class_get_name(right_stream_class
);
210 if (left_stream_class_name
&& right_stream_class_name
) {
211 ret
= strcmp(left_stream_class_name
, right_stream_class_name
);
215 } else if (!left_stream_class_name
&& right_stream_class_name
) {
218 } else if (left_stream_class_name
&& !right_stream_class_name
) {
223 /* Compare stream class automatic event class id assignment. */
224 if (bt_stream_class_assigns_automatic_event_class_id(left_stream_class
) &&
225 !bt_stream_class_assigns_automatic_event_class_id(right_stream_class
)) {
228 } else if (!bt_stream_class_assigns_automatic_event_class_id(left_stream_class
) &&
229 bt_stream_class_assigns_automatic_event_class_id(right_stream_class
)) {
234 /* Compare stream class automatic stream id assignment. */
235 if (bt_stream_class_assigns_automatic_stream_id(left_stream_class
) &&
236 !bt_stream_class_assigns_automatic_stream_id(right_stream_class
)) {
239 } else if (!bt_stream_class_assigns_automatic_stream_id(left_stream_class
) &&
240 bt_stream_class_assigns_automatic_stream_id(right_stream_class
)) {
245 /* Compare stream class support of discarded events. */
246 if (bt_stream_class_supports_discarded_events(left_stream_class
) &&
247 !bt_stream_class_supports_discarded_events(right_stream_class
)) {
250 } else if (!bt_stream_class_supports_discarded_events(left_stream_class
) &&
251 bt_stream_class_supports_discarded_events(right_stream_class
)) {
256 /* Compare stream class discarded events default clock snapshot. */
257 if (bt_stream_class_discarded_events_have_default_clock_snapshots(left_stream_class
) &&
258 !bt_stream_class_discarded_events_have_default_clock_snapshots(right_stream_class
)) {
261 } else if (!bt_stream_class_discarded_events_have_default_clock_snapshots(left_stream_class
) &&
262 bt_stream_class_discarded_events_have_default_clock_snapshots(right_stream_class
)) {
267 /* Compare stream class support of packets. */
268 if (bt_stream_class_supports_packets(left_stream_class
) &&
269 !bt_stream_class_supports_packets(right_stream_class
)) {
272 } else if (!bt_stream_class_supports_packets(left_stream_class
) &&
273 bt_stream_class_supports_packets(right_stream_class
)) {
278 if (!bt_stream_class_supports_packets(left_stream_class
)) {
279 /* Skip all packet related checks. */
284 * Compare stream class presence of discarded packets beginning default
287 if (bt_stream_class_packets_have_beginning_default_clock_snapshot(left_stream_class
) &&
288 !bt_stream_class_packets_have_beginning_default_clock_snapshot(right_stream_class
)) {
291 } else if (!bt_stream_class_packets_have_beginning_default_clock_snapshot(left_stream_class
) &&
292 bt_stream_class_packets_have_beginning_default_clock_snapshot(right_stream_class
)) {
298 * Compare stream class presence of discarded packets end default clock
301 if (bt_stream_class_packets_have_end_default_clock_snapshot(left_stream_class
) &&
302 !bt_stream_class_packets_have_end_default_clock_snapshot(right_stream_class
)) {
305 } else if (!bt_stream_class_packets_have_end_default_clock_snapshot(left_stream_class
) &&
306 bt_stream_class_packets_have_end_default_clock_snapshot(right_stream_class
)) {
311 /* Compare stream class support of discarded packets. */
312 if (bt_stream_class_supports_discarded_packets(left_stream_class
) &&
313 !bt_stream_class_supports_discarded_packets(right_stream_class
)) {
316 } else if (!bt_stream_class_supports_discarded_packets(left_stream_class
) &&
317 bt_stream_class_supports_discarded_packets(right_stream_class
)) {
322 /* Compare stream class discarded packets default clock snapshot. */
323 if (bt_stream_class_discarded_packets_have_default_clock_snapshots(left_stream_class
) &&
324 !bt_stream_class_discarded_packets_have_default_clock_snapshots(right_stream_class
)) {
327 } else if (!bt_stream_class_discarded_packets_have_default_clock_snapshots(left_stream_class
) &&
328 bt_stream_class_discarded_packets_have_default_clock_snapshots(right_stream_class
)) {
338 int compare_clock_snapshots_and_clock_classes(const bt_clock_snapshot
*left_cs
,
339 const bt_clock_snapshot
*right_cs
)
342 uint64_t left_freq
, right_freq
, left_prec
, right_prec
;
343 uint64_t left_cs_value
, right_cs_value
;
344 const bt_clock_class
*left_clock_class
, *right_clock_class
;
345 const char *left_clock_class_name
, *right_clock_class_name
;
346 left_cs_value
= bt_clock_snapshot_get_value(left_cs
);
347 right_cs_value
= bt_clock_snapshot_get_value(right_cs
);
348 bt_uuid left_clock_class_uuid
, right_clock_class_uuid
;
350 ret
= left_cs_value
- right_cs_value
;
355 left_clock_class
= bt_clock_snapshot_borrow_clock_class_const(left_cs
);
356 right_clock_class
= bt_clock_snapshot_borrow_clock_class_const(right_cs
);
358 left_clock_class_uuid
= bt_clock_class_get_uuid(left_clock_class
);
359 right_clock_class_uuid
= bt_clock_class_get_uuid(right_clock_class
);
361 if (left_clock_class_uuid
&& !right_clock_class_uuid
) {
364 } else if (!left_clock_class_uuid
&& right_clock_class_uuid
) {
367 } else if (left_clock_class_uuid
&& right_clock_class_uuid
) {
368 ret
= bt_uuid_compare(left_clock_class_uuid
,
369 right_clock_class_uuid
);
376 left_clock_class_name
= bt_clock_class_get_name(left_clock_class
);
377 right_clock_class_name
= bt_clock_class_get_name(right_clock_class
);
379 if (left_clock_class_name
&& !right_clock_class_name
) {
382 } else if (!left_clock_class_name
&& right_clock_class_name
) {
385 } else if (left_clock_class_name
&& right_clock_class_name
) {
386 ret
= strcmp(left_clock_class_name
, right_clock_class_name
);
392 left_freq
= bt_clock_class_get_frequency(left_clock_class
);
393 right_freq
= bt_clock_class_get_frequency(right_clock_class
);
395 ret
= right_freq
- left_freq
;
400 left_prec
= bt_clock_class_get_precision(left_clock_class
);
401 right_prec
= bt_clock_class_get_precision(right_clock_class
);
403 ret
= right_prec
- left_prec
;
413 const bt_stream
*borrow_stream(const bt_message
*msg
)
415 bt_message_type msg_type
= bt_message_get_type(msg
);
416 const bt_stream
*stream
= NULL
;
417 const bt_packet
*packet
= NULL
;
418 const bt_event
*event
= NULL
;
421 case BT_MESSAGE_TYPE_STREAM_BEGINNING
:
422 stream
= bt_message_stream_beginning_borrow_stream_const(msg
);
424 case BT_MESSAGE_TYPE_STREAM_END
:
425 stream
= bt_message_stream_end_borrow_stream_const(msg
);
427 case BT_MESSAGE_TYPE_PACKET_BEGINNING
:
428 packet
= bt_message_packet_beginning_borrow_packet_const(msg
);
429 stream
= bt_packet_borrow_stream_const(packet
);
431 case BT_MESSAGE_TYPE_PACKET_END
:
432 packet
= bt_message_packet_end_borrow_packet_const(msg
);
433 stream
= bt_packet_borrow_stream_const(packet
);
435 case BT_MESSAGE_TYPE_EVENT
:
436 event
= bt_message_event_borrow_event_const(msg
);
437 stream
= bt_event_borrow_stream_const(event
);
439 case BT_MESSAGE_TYPE_DISCARDED_EVENTS
:
440 stream
= bt_message_discarded_events_borrow_stream_const(msg
);
442 case BT_MESSAGE_TYPE_DISCARDED_PACKETS
:
443 stream
= bt_message_discarded_packets_borrow_stream_const(msg
);
445 case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY
:
456 const bt_trace
*borrow_trace(const bt_message
*msg
)
458 const bt_trace
*trace
= NULL
;
459 const bt_stream
*stream
= NULL
;
461 stream
= borrow_stream(msg
);
463 trace
= bt_stream_borrow_trace_const(stream
);
470 int compare_messages_by_trace_name(struct messages_to_compare
*msgs
)
473 const char *left_trace_name
= NULL
, *right_trace_name
= NULL
;
475 if (msgs
->left
.trace
&& !msgs
->right
.trace
) {
480 if (!msgs
->left
.trace
&& msgs
->right
.trace
) {
485 if (!msgs
->left
.trace
&& !msgs
->right
.trace
) {
490 left_trace_name
= bt_trace_get_name(msgs
->left
.trace
);
491 right_trace_name
= bt_trace_get_name(msgs
->right
.trace
);
493 if (left_trace_name
&& !right_trace_name
) {
498 if (!left_trace_name
&& right_trace_name
) {
503 if (!left_trace_name
&& !right_trace_name
) {
508 ret
= strcmp(left_trace_name
, right_trace_name
);
514 int compare_messages_by_trace_uuid(struct messages_to_compare
*msgs
)
517 bt_uuid left_trace_uuid
= NULL
, right_trace_uuid
= NULL
;
519 if (msgs
->left
.trace
&& !msgs
->right
.trace
) {
524 if (!msgs
->left
.trace
&& msgs
->right
.trace
) {
529 if (!msgs
->left
.trace
&& !msgs
->right
.trace
) {
534 left_trace_uuid
= bt_trace_get_uuid(msgs
->left
.trace
);
535 right_trace_uuid
= bt_trace_get_uuid(msgs
->right
.trace
);
537 if (left_trace_uuid
&& !right_trace_uuid
) {
542 if (!left_trace_uuid
&& right_trace_uuid
) {
547 if (!left_trace_uuid
&& !right_trace_uuid
) {
552 ret
= bt_uuid_compare(left_trace_uuid
, right_trace_uuid
);
558 int compare_messages_by_stream_class_id(struct messages_to_compare
*msgs
)
561 uint64_t left_stream_class_id
= 0, right_stream_class_id
= 0;
563 if (msgs
->left
.stream
&& !msgs
->right
.stream
) {
568 if (!msgs
->left
.stream
&& msgs
->right
.stream
) {
573 if (!msgs
->left
.stream
&& !msgs
->right
.stream
) {
578 left_stream_class_id
= bt_stream_class_get_id(
579 bt_stream_borrow_class_const(msgs
->left
.stream
));
581 right_stream_class_id
= bt_stream_class_get_id(
582 bt_stream_borrow_class_const(msgs
->right
.stream
));
584 if (left_stream_class_id
== right_stream_class_id
) {
589 ret
= (left_stream_class_id
< right_stream_class_id
) ? -1 : 1;
596 int compare_messages_by_stream_id(struct messages_to_compare
*msgs
)
599 uint64_t left_stream_id
= 0, right_stream_id
= 0;
601 if (msgs
->left
.stream
&& !msgs
->right
.stream
) {
606 if (!msgs
->left
.stream
&& msgs
->right
.stream
) {
611 if (!msgs
->left
.stream
&& !msgs
->right
.stream
) {
616 left_stream_id
= bt_stream_get_id(msgs
->left
.stream
);
617 right_stream_id
= bt_stream_get_id(msgs
->right
.stream
);
619 if (left_stream_id
== right_stream_id
) {
624 ret
= (left_stream_id
< right_stream_id
) ? -1 : 1;
631 int compare_messages_same_type(struct messages_to_compare
*msgs
)
636 * Both messages are of the same type, we must compare characterics of
637 * the messages such as the attributes of the event in a event message.
639 BT_ASSERT_DBG(bt_message_get_type(msgs
->left
.msg
) ==
640 bt_message_get_type(msgs
->right
.msg
));
642 switch (bt_message_get_type(msgs
->left
.msg
)) {
643 case BT_MESSAGE_TYPE_STREAM_BEGINNING
:
645 case BT_MESSAGE_TYPE_STREAM_END
:
647 case BT_MESSAGE_TYPE_PACKET_BEGINNING
:
649 case BT_MESSAGE_TYPE_PACKET_END
:
650 ret
= compare_streams(msgs
->left
.stream
, msgs
->right
.stream
);
656 case BT_MESSAGE_TYPE_EVENT
:
658 const bt_event
*left_event
, *right_event
;
659 left_event
= bt_message_event_borrow_event_const(msgs
->left
.msg
);
660 right_event
= bt_message_event_borrow_event_const(msgs
->right
.msg
);
662 ret
= compare_events(left_event
, right_event
);
667 ret
= compare_streams(msgs
->left
.stream
, msgs
->right
.stream
);
673 case BT_MESSAGE_TYPE_DISCARDED_EVENTS
:
675 const bt_stream_class
*left_stream_class
;
676 bt_property_availability left_event_count_avail
,
677 right_event_count_avail
;
678 uint64_t left_event_count
, right_event_count
;
681 * Compare streams first to check if there is a
682 * mismatch about discarded event related configuration
683 * in the stream class.
685 ret
= compare_streams(msgs
->left
.stream
, msgs
->right
.stream
);
690 left_stream_class
= bt_stream_borrow_class_const(msgs
->left
.stream
);
691 if (bt_stream_class_discarded_events_have_default_clock_snapshots(
692 left_stream_class
)) {
693 const bt_clock_snapshot
*left_beg_cs
=
694 bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(msgs
->left
.msg
);
695 const bt_clock_snapshot
*right_beg_cs
=
696 bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(msgs
->right
.msg
);
697 const bt_clock_snapshot
*left_end_cs
=
698 bt_message_discarded_events_borrow_end_default_clock_snapshot_const(msgs
->left
.msg
);
699 const bt_clock_snapshot
*right_end_cs
=
700 bt_message_discarded_events_borrow_end_default_clock_snapshot_const(msgs
->right
.msg
);
702 ret
= compare_clock_snapshots_and_clock_classes(
703 left_beg_cs
, right_beg_cs
);
708 ret
= compare_clock_snapshots_and_clock_classes(
709 left_end_cs
, right_end_cs
);
715 left_event_count_avail
=
716 bt_message_discarded_events_get_count(
717 msgs
->left
.msg
, &left_event_count
);
718 right_event_count_avail
=
719 bt_message_discarded_events_get_count(
720 msgs
->right
.msg
, &right_event_count
);
721 if (left_event_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
722 right_event_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
723 ret
= left_event_count
- right_event_count
;
727 } else if (left_event_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
728 right_event_count_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
) {
731 } else if (left_event_count_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
&&
732 right_event_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
739 case BT_MESSAGE_TYPE_DISCARDED_PACKETS
:
741 const bt_stream_class
*left_stream_class
;
742 bt_property_availability left_packet_count_avail
,
743 right_packet_count_avail
;
744 uint64_t left_packet_count
, right_packet_count
;
747 * Compare streams first to check if there is a
748 * mismatch about discarded packets related
749 * configuration in the stream class.
751 ret
= compare_streams(msgs
->left
.stream
, msgs
->right
.stream
);
756 left_stream_class
= bt_stream_borrow_class_const(msgs
->left
.stream
);
758 if (bt_stream_class_discarded_packets_have_default_clock_snapshots(
759 left_stream_class
)) {
760 const bt_clock_snapshot
*left_beg_cs
=
761 bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(msgs
->left
.msg
);
762 const bt_clock_snapshot
*right_beg_cs
=
763 bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(msgs
->right
.msg
);
764 const bt_clock_snapshot
*left_end_cs
=
765 bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(msgs
->left
.msg
);
766 const bt_clock_snapshot
*right_end_cs
=
767 bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(msgs
->right
.msg
);
769 ret
= compare_clock_snapshots_and_clock_classes(
770 left_beg_cs
, right_beg_cs
);
775 ret
= compare_clock_snapshots_and_clock_classes(
776 left_end_cs
, right_end_cs
);
782 left_packet_count_avail
= bt_message_discarded_packets_get_count(
783 msgs
->left
.msg
, &left_packet_count
);
784 right_packet_count_avail
= bt_message_discarded_packets_get_count(
785 msgs
->right
.msg
, &right_packet_count
);
786 if (left_packet_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
787 right_packet_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
788 ret
= left_packet_count
- right_packet_count
;
792 } else if (left_packet_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
&&
793 right_packet_count_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
) {
796 } else if (left_packet_count_avail
== BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
&&
797 right_packet_count_avail
== BT_PROPERTY_AVAILABILITY_AVAILABLE
) {
804 case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY
:
806 const bt_clock_snapshot
*left_cs
=
807 bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(msgs
->left
.msg
);
808 const bt_clock_snapshot
*right_cs
=
809 bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(msgs
->right
.msg
);
811 ret
= compare_clock_snapshots_and_clock_classes(
827 int common_muxing_compare_messages(const bt_message
*left_msg
,
828 const bt_message
*right_msg
)
831 struct messages_to_compare msgs
;
833 BT_ASSERT_DBG(left_msg
!= right_msg
);
835 msgs
.left
.msg
= left_msg
;
836 msgs
.left
.trace
= borrow_trace(left_msg
);
837 msgs
.left
.stream
= borrow_stream(left_msg
);
839 msgs
.right
.msg
= right_msg
;
840 msgs
.right
.trace
= borrow_trace(right_msg
);
841 msgs
.right
.stream
= borrow_stream(right_msg
);
843 /* Same timestamp: compare trace UUIDs. */
844 ret
= compare_messages_by_trace_uuid(&msgs
);
849 /* Same timestamp and trace UUID: compare trace names. */
850 ret
= compare_messages_by_trace_name(&msgs
);
856 * Same timestamp, trace name, and trace UUID: compare stream class
859 ret
= compare_messages_by_stream_class_id(&msgs
);
865 * Same timestamp, trace name, trace UUID, and stream class ID: compare
868 ret
= compare_messages_by_stream_id(&msgs
);
873 if (bt_message_get_type(msgs
.left
.msg
) !=
874 bt_message_get_type(msgs
.right
.msg
)) {
876 * The messages are of different type, we order (arbitrarily)
877 * in the following way:
878 * SB < PB < EV < DE < MI < PE < DP < SE
880 ret
= compare_messages_by_type(&msgs
);
885 /* The messages are of the same type. */
886 ret
= compare_messages_same_type(&msgs
);