4 * Babeltrace CTF Text Output Plugin Event Printing
6 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 * Copyright 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 #include <babeltrace/babeltrace.h>
31 #include <babeltrace/bitfield-internal.h>
32 #include <babeltrace/common-internal.h>
33 #include <babeltrace/compat/time-internal.h>
38 #define NSEC_PER_SEC 1000000000LL
40 #define COLOR_NAME BT_COMMON_COLOR_BOLD
41 #define COLOR_FIELD_NAME BT_COMMON_COLOR_FG_CYAN
42 #define COLOR_RST BT_COMMON_COLOR_RESET
43 #define COLOR_STRING_VALUE BT_COMMON_COLOR_BOLD
44 #define COLOR_NUMBER_VALUE BT_COMMON_COLOR_BOLD
45 #define COLOR_ENUM_MAPPING_NAME BT_COMMON_COLOR_BOLD
46 #define COLOR_UNKNOWN BT_COMMON_COLOR_BOLD BT_COMMON_COLOR_FG_RED
47 #define COLOR_EVENT_NAME BT_COMMON_COLOR_BOLD BT_COMMON_COLOR_FG_MAGENTA
48 #define COLOR_TIMESTAMP BT_COMMON_COLOR_BOLD BT_COMMON_COLOR_FG_YELLOW
51 const char *rem_(const char *str
)
60 int64_t real_timestamp
; /* Relative to UNIX epoch. */
61 uint64_t clock_value
; /* In cycles. */
65 enum bt_component_status
print_field(struct pretty_component
*pretty
,
66 struct bt_ctf_field
*field
, bool print_names
,
67 GQuark
*filters_fields
, int filter_array_len
);
70 void print_name_equal(struct pretty_component
*pretty
, const char *name
)
72 if (pretty
->use_colors
) {
73 g_string_append_printf(pretty
->string
, "%s%s%s = ", COLOR_NAME
,
76 g_string_append_printf(pretty
->string
, "%s = ", name
);
81 void print_field_name_equal(struct pretty_component
*pretty
, const char *name
)
83 if (pretty
->use_colors
) {
84 g_string_append_printf(pretty
->string
, "%s%s%s = ",
85 COLOR_FIELD_NAME
, name
, COLOR_RST
);
87 g_string_append_printf(pretty
->string
, "%s = ", name
);
92 void print_timestamp_cycles(struct pretty_component
*pretty
,
93 struct bt_ctf_clock_class
*clock_class
,
94 struct bt_ctf_event
*event
)
97 struct bt_ctf_clock_value
*clock_value
;
100 clock_value
= bt_ctf_event_get_clock_value(event
, clock_class
);
102 g_string_append(pretty
->string
, "????????????????????");
106 ret
= bt_ctf_clock_value_get_value(clock_value
, &cycles
);
109 // TODO: log, this is unexpected
110 g_string_append(pretty
->string
, "Error");
114 g_string_append_printf(pretty
->string
, "%020" PRIu64
, cycles
);
116 if (pretty
->last_cycles_timestamp
!= -1ULL) {
117 pretty
->delta_cycles
= cycles
- pretty
->last_cycles_timestamp
;
119 pretty
->last_cycles_timestamp
= cycles
;
123 void print_timestamp_wall(struct pretty_component
*pretty
,
124 struct bt_ctf_clock_value
*clock_value
)
127 int64_t ts_nsec
= 0; /* add configurable offset */
128 int64_t ts_sec
= 0; /* add configurable offset */
129 uint64_t ts_sec_abs
, ts_nsec_abs
;
133 g_string_append(pretty
->string
, "??:??:??.?????????");
137 ret
= bt_ctf_clock_value_get_value_ns_from_epoch(clock_value
, &ts_nsec
);
139 // TODO: log, this is unexpected
140 g_string_append(pretty
->string
, "Error");
144 if (pretty
->last_real_timestamp
!= -1ULL) {
145 pretty
->delta_real_timestamp
= ts_nsec
- pretty
->last_real_timestamp
;
148 pretty
->last_real_timestamp
= ts_nsec
;
149 ts_sec
+= ts_nsec
/ NSEC_PER_SEC
;
150 ts_nsec
= ts_nsec
% NSEC_PER_SEC
;
152 if (ts_sec
>= 0 && ts_nsec
>= 0) {
155 ts_nsec_abs
= ts_nsec
;
156 } else if (ts_sec
> 0 && ts_nsec
< 0) {
158 ts_sec_abs
= ts_sec
- 1;
159 ts_nsec_abs
= NSEC_PER_SEC
+ ts_nsec
;
160 } else if (ts_sec
== 0 && ts_nsec
< 0) {
163 ts_nsec_abs
= -ts_nsec
;
164 } else if (ts_sec
< 0 && ts_nsec
> 0) {
166 ts_sec_abs
= -(ts_sec
+ 1);
167 ts_nsec_abs
= NSEC_PER_SEC
- ts_nsec
;
168 } else if (ts_sec
< 0 && ts_nsec
== 0) {
170 ts_sec_abs
= -ts_sec
;
171 ts_nsec_abs
= ts_nsec
;
172 } else { /* (ts_sec < 0 && ts_nsec < 0) */
174 ts_sec_abs
= -ts_sec
;
175 ts_nsec_abs
= -ts_nsec
;
178 if (!pretty
->options
.clock_seconds
) {
180 time_t time_s
= (time_t) ts_sec_abs
;
182 if (is_negative
&& !pretty
->negative_timestamp_warning_done
) {
184 fprintf(stderr
, "[warning] Fallback to [sec.ns] to print negative time value. Use --clock-seconds.\n");
185 pretty
->negative_timestamp_warning_done
= true;
189 if (!pretty
->options
.clock_gmt
) {
192 res
= bt_localtime_r(&time_s
, &tm
);
195 fprintf(stderr
, "[warning] Unable to get localtime.\n");
201 res
= bt_gmtime_r(&time_s
, &tm
);
204 fprintf(stderr
, "[warning] Unable to get gmtime.\n");
208 if (pretty
->options
.clock_date
) {
212 /* Print date and time */
213 res
= strftime(timestr
, sizeof(timestr
),
217 fprintf(stderr
, "[warning] Unable to print ascii time.\n");
221 g_string_append(pretty
->string
, timestr
);
224 /* Print time in HH:MM:SS.ns */
225 g_string_append_printf(pretty
->string
,
226 "%02d:%02d:%02d.%09" PRIu64
, tm
.tm_hour
, tm
.tm_min
,
227 tm
.tm_sec
, ts_nsec_abs
);
231 g_string_append_printf(pretty
->string
, "%s%" PRId64
".%09" PRIu64
,
232 is_negative
? "-" : "", ts_sec_abs
, ts_nsec_abs
);
238 enum bt_component_status
print_event_timestamp(struct pretty_component
*pretty
,
239 struct bt_ctf_event
*event
,
240 struct bt_clock_class_priority_map
*cc_prio_map
,
243 bool print_names
= pretty
->options
.print_header_field_names
;
244 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
245 struct bt_ctf_stream
*stream
= NULL
;
246 struct bt_ctf_stream_class
*stream_class
= NULL
;
247 struct bt_ctf_trace
*trace
= NULL
;
248 struct bt_ctf_clock_class
*clock_class
= NULL
;
250 stream
= bt_ctf_event_get_stream(event
);
252 ret
= BT_COMPONENT_STATUS_ERROR
;
256 stream_class
= bt_ctf_stream_get_class(stream
);
258 ret
= BT_COMPONENT_STATUS_ERROR
;
261 trace
= bt_ctf_stream_class_get_trace(stream_class
);
263 ret
= BT_COMPONENT_STATUS_ERROR
;
267 if (bt_clock_class_priority_map_get_clock_class_count(cc_prio_map
) == 0) {
268 /* No clock class: skip the timestamp without an error */
273 bt_clock_class_priority_map_get_highest_priority_clock_class(
276 ret
= BT_COMPONENT_STATUS_ERROR
;
281 print_name_equal(pretty
, "timestamp");
283 g_string_append(pretty
->string
, "[");
285 if (pretty
->use_colors
) {
286 g_string_append(pretty
->string
, COLOR_TIMESTAMP
);
288 if (pretty
->options
.print_timestamp_cycles
) {
289 print_timestamp_cycles(pretty
, clock_class
, event
);
291 struct bt_ctf_clock_value
*clock_value
=
292 bt_ctf_event_get_clock_value(event
, clock_class
);
294 print_timestamp_wall(pretty
, clock_value
);
297 if (pretty
->use_colors
) {
298 g_string_append(pretty
->string
, COLOR_RST
);
302 g_string_append(pretty
->string
, "] ");
304 if (pretty
->options
.print_delta_field
) {
306 g_string_append(pretty
->string
, ", ");
307 print_name_equal(pretty
, "delta");
309 g_string_append(pretty
->string
, "(");
311 if (pretty
->options
.print_timestamp_cycles
) {
312 if (pretty
->delta_cycles
== -1ULL) {
313 g_string_append(pretty
->string
,
314 "+??????????\?\?) "); /* Not a trigraph. */
316 g_string_append_printf(pretty
->string
,
317 "+%012" PRIu64
, pretty
->delta_cycles
);
320 if (pretty
->delta_real_timestamp
!= -1ULL) {
321 uint64_t delta_sec
, delta_nsec
, delta
;
323 delta
= pretty
->delta_real_timestamp
;
324 delta_sec
= delta
/ NSEC_PER_SEC
;
325 delta_nsec
= delta
% NSEC_PER_SEC
;
326 g_string_append_printf(pretty
->string
,
327 "+%" PRIu64
".%09" PRIu64
,
328 delta_sec
, delta_nsec
);
330 g_string_append(pretty
->string
, "+?.?????????");
334 g_string_append(pretty
->string
, ") ");
337 *start_line
= !print_names
;
342 bt_put(stream_class
);
348 enum bt_component_status
print_event_header(struct pretty_component
*pretty
,
349 struct bt_ctf_event
*event
,
350 struct bt_clock_class_priority_map
*cc_prio_map
)
352 bool print_names
= pretty
->options
.print_header_field_names
;
353 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
354 struct bt_ctf_event_class
*event_class
= NULL
;
355 struct bt_ctf_stream_class
*stream_class
= NULL
;
356 struct bt_ctf_trace
*trace_class
= NULL
;
359 event_class
= bt_ctf_event_get_class(event
);
361 ret
= BT_COMPONENT_STATUS_ERROR
;
364 stream_class
= bt_ctf_event_class_get_stream_class(event_class
);
366 ret
= BT_COMPONENT_STATUS_ERROR
;
369 trace_class
= bt_ctf_stream_class_get_trace(stream_class
);
371 ret
= BT_COMPONENT_STATUS_ERROR
;
374 ret
= print_event_timestamp(pretty
, event
, cc_prio_map
,
375 &pretty
->start_line
);
376 if (ret
!= BT_COMPONENT_STATUS_OK
) {
379 if (pretty
->options
.print_trace_field
) {
382 name
= bt_ctf_trace_get_name(trace_class
);
384 if (!pretty
->start_line
) {
385 g_string_append(pretty
->string
, ", ");
388 print_name_equal(pretty
, "trace");
391 g_string_append(pretty
->string
, name
);
394 g_string_append(pretty
->string
, " ");
398 if (pretty
->options
.print_trace_hostname_field
) {
399 struct bt_value
*hostname_str
;
401 hostname_str
= bt_ctf_trace_get_environment_field_value_by_name(trace_class
,
406 if (!pretty
->start_line
) {
407 g_string_append(pretty
->string
, ", ");
410 print_name_equal(pretty
, "trace:hostname");
412 if (bt_value_string_get(hostname_str
, &str
)
413 == BT_VALUE_STATUS_OK
) {
414 g_string_append(pretty
->string
, str
);
416 bt_put(hostname_str
);
420 if (pretty
->options
.print_trace_domain_field
) {
421 struct bt_value
*domain_str
;
423 domain_str
= bt_ctf_trace_get_environment_field_value_by_name(trace_class
,
428 if (!pretty
->start_line
) {
429 g_string_append(pretty
->string
, ", ");
432 print_name_equal(pretty
, "trace:domain");
433 } else if (dom_print
) {
434 g_string_append(pretty
->string
, ":");
436 if (bt_value_string_get(domain_str
, &str
)
437 == BT_VALUE_STATUS_OK
) {
438 g_string_append(pretty
->string
, str
);
444 if (pretty
->options
.print_trace_procname_field
) {
445 struct bt_value
*procname_str
;
447 procname_str
= bt_ctf_trace_get_environment_field_value_by_name(trace_class
,
452 if (!pretty
->start_line
) {
453 g_string_append(pretty
->string
, ", ");
456 print_name_equal(pretty
, "trace:procname");
457 } else if (dom_print
) {
458 g_string_append(pretty
->string
, ":");
460 if (bt_value_string_get(procname_str
, &str
)
461 == BT_VALUE_STATUS_OK
) {
462 g_string_append(pretty
->string
, str
);
464 bt_put(procname_str
);
468 if (pretty
->options
.print_trace_vpid_field
) {
469 struct bt_value
*vpid_value
;
471 vpid_value
= bt_ctf_trace_get_environment_field_value_by_name(trace_class
,
476 if (!pretty
->start_line
) {
477 g_string_append(pretty
->string
, ", ");
480 print_name_equal(pretty
, "trace:vpid");
481 } else if (dom_print
) {
482 g_string_append(pretty
->string
, ":");
484 if (bt_value_integer_get(vpid_value
, &value
)
485 == BT_VALUE_STATUS_OK
) {
486 g_string_append_printf(pretty
->string
, "(%" PRId64
")", value
);
492 if (pretty
->options
.print_loglevel_field
) {
493 static const char *log_level_names
[] = {
494 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY
] = "TRACE_EMERG",
495 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT
] = "TRACE_ALERT",
496 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL
] = "TRACE_CRIT",
497 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR
] = "TRACE_ERR",
498 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING
] = "TRACE_WARNING",
499 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE
] = "TRACE_NOTICE",
500 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO
] = "TRACE_INFO",
501 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM
] = "TRACE_DEBUG_SYSTEM",
502 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM
] = "TRACE_DEBUG_PROGRAM",
503 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS
] = "TRACE_DEBUG_PROCESS",
504 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE
] = "TRACE_DEBUG_MODULE",
505 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT
] = "TRACE_DEBUG_UNIT",
506 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION
] = "TRACE_DEBUG_FUNCTION",
507 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE
] = "TRACE_DEBUG_LINE",
508 [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG
] = "TRACE_DEBUG",
510 enum bt_ctf_event_class_log_level log_level
;
511 const char *log_level_str
= NULL
;
513 log_level
= bt_ctf_event_class_get_log_level(event_class
);
514 assert(log_level
!= BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN
);
515 if (log_level
!= BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED
) {
516 log_level_str
= log_level_names
[log_level
];
520 if (!pretty
->start_line
) {
521 g_string_append(pretty
->string
, ", ");
524 print_name_equal(pretty
, "loglevel");
525 } else if (dom_print
) {
526 g_string_append(pretty
->string
, ":");
529 g_string_append(pretty
->string
, log_level_str
);
530 g_string_append_printf(
531 pretty
->string
, " (%d)", (int) log_level
);
535 if (pretty
->options
.print_emf_field
) {
538 uri_str
= bt_ctf_event_class_get_emf_uri(event_class
);
540 if (!pretty
->start_line
) {
541 g_string_append(pretty
->string
, ", ");
544 print_name_equal(pretty
, "model.emf.uri");
545 } else if (dom_print
) {
546 g_string_append(pretty
->string
, ":");
549 g_string_append(pretty
->string
, uri_str
);
553 if (dom_print
&& !print_names
) {
554 g_string_append(pretty
->string
, " ");
556 if (!pretty
->start_line
) {
557 g_string_append(pretty
->string
, ", ");
559 pretty
->start_line
= true;
561 print_name_equal(pretty
, "name");
563 if (pretty
->use_colors
) {
564 g_string_append(pretty
->string
, COLOR_EVENT_NAME
);
566 g_string_append(pretty
->string
, bt_ctf_event_class_get_name(event_class
));
567 if (pretty
->use_colors
) {
568 g_string_append(pretty
->string
, COLOR_RST
);
571 g_string_append(pretty
->string
, ": ");
573 g_string_append(pretty
->string
, ", ");
577 bt_put(stream_class
);
583 enum bt_component_status
print_integer(struct pretty_component
*pretty
,
584 struct bt_ctf_field
*field
)
586 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
587 struct bt_ctf_field_type
*field_type
= NULL
;
588 enum bt_ctf_integer_base base
;
589 enum bt_ctf_string_encoding encoding
;
595 bool rst_color
= false;
597 field_type
= bt_ctf_field_get_type(field
);
599 ret
= BT_COMPONENT_STATUS_ERROR
;
602 signedness
= bt_ctf_field_type_integer_get_signed(field_type
);
603 if (signedness
< 0) {
604 ret
= BT_COMPONENT_STATUS_ERROR
;
608 if (bt_ctf_field_unsigned_integer_get_value(field
, &v
.u
) < 0) {
609 ret
= BT_COMPONENT_STATUS_ERROR
;
613 if (bt_ctf_field_signed_integer_get_value(field
, &v
.s
) < 0) {
614 ret
= BT_COMPONENT_STATUS_ERROR
;
619 encoding
= bt_ctf_field_type_integer_get_encoding(field_type
);
621 case BT_CTF_STRING_ENCODING_UTF8
:
622 case BT_CTF_STRING_ENCODING_ASCII
:
623 g_string_append_c(pretty
->tmp_string
, (int) v
.u
);
625 case BT_CTF_STRING_ENCODING_NONE
:
626 case BT_CTF_STRING_ENCODING_UNKNOWN
:
629 ret
= BT_COMPONENT_STATUS_ERROR
;
633 if (pretty
->use_colors
) {
634 g_string_append(pretty
->string
, COLOR_NUMBER_VALUE
);
638 base
= bt_ctf_field_type_integer_get_base(field_type
);
640 case BT_CTF_INTEGER_BASE_BINARY
:
644 len
= bt_ctf_field_type_integer_get_size(field_type
);
646 ret
= BT_COMPONENT_STATUS_ERROR
;
649 g_string_append(pretty
->string
, "0b");
650 v
.u
= _bt_piecewise_lshift(v
.u
, 64 - len
);
651 for (bitnr
= 0; bitnr
< len
; bitnr
++) {
652 g_string_append_printf(pretty
->string
, "%u", (v
.u
& (1ULL << 63)) ? 1 : 0);
653 v
.u
= _bt_piecewise_lshift(v
.u
, 1);
657 case BT_CTF_INTEGER_BASE_OCTAL
:
662 len
= bt_ctf_field_type_integer_get_size(field_type
);
664 ret
= BT_COMPONENT_STATUS_ERROR
;
671 /* Round length to the nearest 3-bit */
672 rounded_len
= (((len
- 1) / 3) + 1) * 3;
673 v
.u
&= ((uint64_t) 1 << rounded_len
) - 1;
677 g_string_append_printf(pretty
->string
, "0%" PRIo64
, v
.u
);
680 case BT_CTF_INTEGER_BASE_DECIMAL
:
681 case BT_CTF_INTEGER_BASE_UNSPECIFIED
:
683 g_string_append_printf(pretty
->string
, "%" PRIu64
, v
.u
);
685 g_string_append_printf(pretty
->string
, "%" PRId64
, v
.s
);
688 case BT_CTF_INTEGER_BASE_HEXADECIMAL
:
692 len
= bt_ctf_field_type_integer_get_size(field_type
);
694 ret
= BT_COMPONENT_STATUS_ERROR
;
698 /* Round length to the nearest nibble */
699 uint8_t rounded_len
= ((len
+ 3) & ~0x3);
701 v
.u
&= ((uint64_t) 1 << rounded_len
) - 1;
704 g_string_append_printf(pretty
->string
, "0x%" PRIX64
, v
.u
);
708 ret
= BT_COMPONENT_STATUS_ERROR
;
713 g_string_append(pretty
->string
, COLOR_RST
);
720 void print_escape_string(struct pretty_component
*pretty
, const char *str
)
724 g_string_append_c(pretty
->string
, '"');
726 for (i
= 0; i
< strlen(str
); i
++) {
727 /* Escape sequences not recognized by iscntrl(). */
730 g_string_append(pretty
->string
, "\\\\");
733 g_string_append(pretty
->string
, "\\\'");
736 g_string_append(pretty
->string
, "\\\"");
739 g_string_append(pretty
->string
, "\\\?");
743 /* Standard characters. */
744 if (!iscntrl(str
[i
])) {
745 g_string_append_c(pretty
->string
, str
[i
]);
751 g_string_append(pretty
->string
, "\\0");
754 g_string_append(pretty
->string
, "\\a");
757 g_string_append(pretty
->string
, "\\b");
760 g_string_append(pretty
->string
, "\\e");
763 g_string_append(pretty
->string
, "\\f");
766 g_string_append(pretty
->string
, "\\n");
769 g_string_append(pretty
->string
, "\\r");
772 g_string_append(pretty
->string
, "\\t");
775 g_string_append(pretty
->string
, "\\v");
778 /* Unhandled control-sequence, print as hex. */
779 g_string_append_printf(pretty
->string
, "\\x%02x", str
[i
]);
784 g_string_append_c(pretty
->string
, '"');
788 enum bt_component_status
print_enum(struct pretty_component
*pretty
,
789 struct bt_ctf_field
*field
)
791 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
792 struct bt_ctf_field
*container_field
= NULL
;
793 struct bt_ctf_field_type
*enumeration_field_type
= NULL
;
794 struct bt_ctf_field_type
*container_field_type
= NULL
;
795 struct bt_ctf_field_type_enumeration_mapping_iterator
*iter
= NULL
;
799 enumeration_field_type
= bt_ctf_field_get_type(field
);
800 if (!enumeration_field_type
) {
801 ret
= BT_COMPONENT_STATUS_ERROR
;
804 container_field
= bt_ctf_field_enumeration_get_container(field
);
805 if (!container_field
) {
806 ret
= BT_COMPONENT_STATUS_ERROR
;
809 container_field_type
= bt_ctf_field_get_type(container_field
);
810 if (!container_field_type
) {
811 ret
= BT_COMPONENT_STATUS_ERROR
;
814 is_signed
= bt_ctf_field_type_integer_get_signed(container_field_type
);
816 ret
= BT_COMPONENT_STATUS_ERROR
;
822 if (bt_ctf_field_signed_integer_get_value(container_field
,
824 ret
= BT_COMPONENT_STATUS_ERROR
;
827 iter
= bt_ctf_field_type_enumeration_find_mappings_by_signed_value(
828 enumeration_field_type
, value
);
832 if (bt_ctf_field_unsigned_integer_get_value(container_field
,
834 ret
= BT_COMPONENT_STATUS_ERROR
;
837 iter
= bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(
838 enumeration_field_type
, value
);
840 g_string_append(pretty
->string
, "( ");
841 ret
= bt_ctf_field_type_enumeration_mapping_iterator_next(iter
);
843 if (pretty
->use_colors
) {
844 g_string_append(pretty
->string
, COLOR_UNKNOWN
);
846 g_string_append(pretty
->string
, "<unknown>");
847 if (pretty
->use_colors
) {
848 g_string_append(pretty
->string
, COLOR_RST
);
853 const char *mapping_name
;
855 if (bt_ctf_field_type_enumeration_mapping_iterator_get_signed(
856 iter
, &mapping_name
, NULL
, NULL
) < 0) {
857 ret
= BT_COMPONENT_STATUS_ERROR
;
861 g_string_append(pretty
->string
, ", ");
862 if (pretty
->use_colors
) {
863 g_string_append(pretty
->string
, COLOR_ENUM_MAPPING_NAME
);
865 print_escape_string(pretty
, mapping_name
);
866 if (pretty
->use_colors
) {
867 g_string_append(pretty
->string
, COLOR_RST
);
869 if (bt_ctf_field_type_enumeration_mapping_iterator_next(iter
) < 0) {
874 g_string_append(pretty
->string
, " : container = ");
875 ret
= print_integer(pretty
, container_field
);
876 if (ret
!= BT_COMPONENT_STATUS_OK
) {
879 g_string_append(pretty
->string
, " )");
882 bt_put(container_field_type
);
883 bt_put(container_field
);
884 bt_put(enumeration_field_type
);
889 int filter_field_name(struct pretty_component
*pretty
, const char *field_name
,
890 GQuark
*filter_fields
, int filter_array_len
)
893 GQuark field_quark
= g_quark_try_string(field_name
);
895 if (!field_quark
|| pretty
->options
.verbose
) {
899 for (i
= 0; i
< filter_array_len
; i
++) {
900 if (field_quark
== filter_fields
[i
]) {
908 enum bt_component_status
print_struct_field(struct pretty_component
*pretty
,
909 struct bt_ctf_field
*_struct
,
910 struct bt_ctf_field_type
*struct_type
,
911 int i
, bool print_names
, int *nr_printed_fields
,
912 GQuark
*filter_fields
, int filter_array_len
)
914 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
915 const char *field_name
;
916 struct bt_ctf_field
*field
= NULL
;
917 struct bt_ctf_field_type
*field_type
= NULL
;;
919 field
= bt_ctf_field_structure_get_field_by_index(_struct
, i
);
921 ret
= BT_COMPONENT_STATUS_ERROR
;
924 if (bt_ctf_field_type_structure_get_field(struct_type
,
925 &field_name
, &field_type
, i
) < 0) {
926 ret
= BT_COMPONENT_STATUS_ERROR
;
930 if (filter_fields
&& !filter_field_name(pretty
, field_name
,
931 filter_fields
, filter_array_len
)) {
932 ret
= BT_COMPONENT_STATUS_OK
;
936 if (*nr_printed_fields
> 0) {
937 g_string_append(pretty
->string
, ", ");
939 g_string_append(pretty
->string
, " ");
942 print_field_name_equal(pretty
, rem_(field_name
));
944 ret
= print_field(pretty
, field
, print_names
, NULL
, 0);
945 *nr_printed_fields
+= 1;
953 enum bt_component_status
print_struct(struct pretty_component
*pretty
,
954 struct bt_ctf_field
*_struct
, bool print_names
,
955 GQuark
*filter_fields
, int filter_array_len
)
957 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
958 struct bt_ctf_field_type
*struct_type
= NULL
;
959 int nr_fields
, i
, nr_printed_fields
;
961 struct_type
= bt_ctf_field_get_type(_struct
);
963 ret
= BT_COMPONENT_STATUS_ERROR
;
966 nr_fields
= bt_ctf_field_type_structure_get_field_count(struct_type
);
968 ret
= BT_COMPONENT_STATUS_ERROR
;
971 g_string_append(pretty
->string
, "{");
973 nr_printed_fields
= 0;
974 for (i
= 0; i
< nr_fields
; i
++) {
975 ret
= print_struct_field(pretty
, _struct
, struct_type
, i
,
976 print_names
, &nr_printed_fields
, filter_fields
,
978 if (ret
!= BT_COMPONENT_STATUS_OK
) {
983 g_string_append(pretty
->string
, " }");
990 enum bt_component_status
print_array_field(struct pretty_component
*pretty
,
991 struct bt_ctf_field
*array
, uint64_t i
,
992 bool is_string
, bool print_names
)
994 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
995 struct bt_ctf_field
*field
= NULL
;
999 g_string_append(pretty
->string
, ", ");
1001 g_string_append(pretty
->string
, " ");
1004 g_string_append_printf(pretty
->string
, "[%" PRIu64
"] = ", i
);
1007 field
= bt_ctf_field_array_get_field(array
, i
);
1009 ret
= BT_COMPONENT_STATUS_ERROR
;
1012 ret
= print_field(pretty
, field
, print_names
, NULL
, 0);
1019 enum bt_component_status
print_array(struct pretty_component
*pretty
,
1020 struct bt_ctf_field
*array
, bool print_names
)
1022 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1023 struct bt_ctf_field_type
*array_type
= NULL
, *field_type
= NULL
;
1024 enum bt_ctf_field_type_id type_id
;
1027 bool is_string
= false;
1029 array_type
= bt_ctf_field_get_type(array
);
1031 ret
= BT_COMPONENT_STATUS_ERROR
;
1034 field_type
= bt_ctf_field_type_array_get_element_type(array_type
);
1036 ret
= BT_COMPONENT_STATUS_ERROR
;
1039 len
= bt_ctf_field_type_array_get_length(array_type
);
1041 ret
= BT_COMPONENT_STATUS_ERROR
;
1044 type_id
= bt_ctf_field_type_get_type_id(field_type
);
1045 if (type_id
== BT_CTF_FIELD_TYPE_ID_INTEGER
) {
1046 enum bt_ctf_string_encoding encoding
;
1048 encoding
= bt_ctf_field_type_integer_get_encoding(field_type
);
1049 if (encoding
== BT_CTF_STRING_ENCODING_UTF8
1050 || encoding
== BT_CTF_STRING_ENCODING_ASCII
) {
1051 int integer_len
, integer_alignment
;
1053 integer_len
= bt_ctf_field_type_integer_get_size(field_type
);
1054 if (integer_len
< 0) {
1055 return BT_COMPONENT_STATUS_ERROR
;
1057 integer_alignment
= bt_ctf_field_type_get_alignment(field_type
);
1058 if (integer_alignment
< 0) {
1059 return BT_COMPONENT_STATUS_ERROR
;
1061 if (integer_len
== CHAR_BIT
1062 && integer_alignment
== CHAR_BIT
) {
1069 g_string_assign(pretty
->tmp_string
, "");
1071 g_string_append(pretty
->string
, "[");
1075 for (i
= 0; i
< len
; i
++) {
1076 ret
= print_array_field(pretty
, array
, i
, is_string
, print_names
);
1077 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1084 if (pretty
->use_colors
) {
1085 g_string_append(pretty
->string
, COLOR_STRING_VALUE
);
1087 print_escape_string(pretty
, pretty
->tmp_string
->str
);
1088 if (pretty
->use_colors
) {
1089 g_string_append(pretty
->string
, COLOR_RST
);
1092 g_string_append(pretty
->string
, " ]");
1101 enum bt_component_status
print_sequence_field(struct pretty_component
*pretty
,
1102 struct bt_ctf_field
*seq
, uint64_t i
,
1103 bool is_string
, bool print_names
)
1105 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1106 struct bt_ctf_field
*field
= NULL
;
1110 g_string_append(pretty
->string
, ", ");
1112 g_string_append(pretty
->string
, " ");
1115 g_string_append_printf(pretty
->string
, "[%" PRIu64
"] = ", i
);
1118 field
= bt_ctf_field_sequence_get_field(seq
, i
);
1120 ret
= BT_COMPONENT_STATUS_ERROR
;
1123 ret
= print_field(pretty
, field
, print_names
, NULL
, 0);
1130 enum bt_component_status
print_sequence(struct pretty_component
*pretty
,
1131 struct bt_ctf_field
*seq
, bool print_names
)
1133 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1134 struct bt_ctf_field_type
*seq_type
= NULL
, *field_type
= NULL
;
1135 struct bt_ctf_field
*length_field
= NULL
;
1136 enum bt_ctf_field_type_id type_id
;
1139 bool is_string
= false;
1141 seq_type
= bt_ctf_field_get_type(seq
);
1143 ret
= BT_COMPONENT_STATUS_ERROR
;
1146 length_field
= bt_ctf_field_sequence_get_length(seq
);
1147 if (!length_field
) {
1148 ret
= BT_COMPONENT_STATUS_ERROR
;
1151 if (bt_ctf_field_unsigned_integer_get_value(length_field
, &len
) < 0) {
1152 ret
= BT_COMPONENT_STATUS_ERROR
;
1155 field_type
= bt_ctf_field_type_sequence_get_element_type(seq_type
);
1157 ret
= BT_COMPONENT_STATUS_ERROR
;
1160 type_id
= bt_ctf_field_type_get_type_id(field_type
);
1161 if (type_id
== BT_CTF_FIELD_TYPE_ID_INTEGER
) {
1162 enum bt_ctf_string_encoding encoding
;
1164 encoding
= bt_ctf_field_type_integer_get_encoding(field_type
);
1165 if (encoding
== BT_CTF_STRING_ENCODING_UTF8
1166 || encoding
== BT_CTF_STRING_ENCODING_ASCII
) {
1167 int integer_len
, integer_alignment
;
1169 integer_len
= bt_ctf_field_type_integer_get_size(field_type
);
1170 if (integer_len
< 0) {
1171 ret
= BT_COMPONENT_STATUS_ERROR
;
1174 integer_alignment
= bt_ctf_field_type_get_alignment(field_type
);
1175 if (integer_alignment
< 0) {
1176 ret
= BT_COMPONENT_STATUS_ERROR
;
1179 if (integer_len
== CHAR_BIT
1180 && integer_alignment
== CHAR_BIT
) {
1187 g_string_assign(pretty
->tmp_string
, "");
1189 g_string_append(pretty
->string
, "[");
1193 for (i
= 0; i
< len
; i
++) {
1194 ret
= print_sequence_field(pretty
, seq
, i
,
1195 is_string
, print_names
);
1196 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1203 if (pretty
->use_colors
) {
1204 g_string_append(pretty
->string
, COLOR_STRING_VALUE
);
1206 print_escape_string(pretty
, pretty
->tmp_string
->str
);
1207 if (pretty
->use_colors
) {
1208 g_string_append(pretty
->string
, COLOR_RST
);
1211 g_string_append(pretty
->string
, " ]");
1214 bt_put(length_field
);
1221 enum bt_component_status
print_variant(struct pretty_component
*pretty
,
1222 struct bt_ctf_field
*variant
, bool print_names
)
1224 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1225 struct bt_ctf_field
*field
= NULL
;
1227 field
= bt_ctf_field_variant_get_current_field(variant
);
1229 ret
= BT_COMPONENT_STATUS_ERROR
;
1232 g_string_append(pretty
->string
, "{ ");
1236 struct bt_ctf_field
*tag_field
= NULL
;
1237 const char *tag_choice
;
1238 struct bt_ctf_field_type_enumeration_mapping_iterator
*iter
;
1240 tag_field
= bt_ctf_field_variant_get_tag(variant
);
1242 ret
= BT_COMPONENT_STATUS_ERROR
;
1246 iter
= bt_ctf_field_enumeration_get_mappings(tag_field
);
1247 iter_ret
= bt_ctf_field_type_enumeration_mapping_iterator_next(
1251 ret
= BT_COMPONENT_STATUS_ERROR
;
1256 bt_ctf_field_type_enumeration_mapping_iterator_get_signed(
1257 iter
, &tag_choice
, NULL
, NULL
);
1261 ret
= BT_COMPONENT_STATUS_ERROR
;
1264 print_field_name_equal(pretty
, rem_(tag_choice
));
1268 ret
= print_field(pretty
, field
, print_names
, NULL
, 0);
1269 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1273 g_string_append(pretty
->string
, " }");
1280 enum bt_component_status
print_field(struct pretty_component
*pretty
,
1281 struct bt_ctf_field
*field
, bool print_names
,
1282 GQuark
*filter_fields
, int filter_array_len
)
1284 enum bt_ctf_field_type_id type_id
;
1286 type_id
= bt_ctf_field_get_type_id(field
);
1288 case CTF_TYPE_INTEGER
:
1289 return print_integer(pretty
, field
);
1290 case CTF_TYPE_FLOAT
:
1294 if (bt_ctf_field_floating_point_get_value(field
, &v
)) {
1295 return BT_COMPONENT_STATUS_ERROR
;
1297 if (pretty
->use_colors
) {
1298 g_string_append(pretty
->string
, COLOR_NUMBER_VALUE
);
1300 g_string_append_printf(pretty
->string
, "%g", v
);
1301 if (pretty
->use_colors
) {
1302 g_string_append(pretty
->string
, COLOR_RST
);
1304 return BT_COMPONENT_STATUS_OK
;
1307 return print_enum(pretty
, field
);
1308 case CTF_TYPE_STRING
:
1312 str
= bt_ctf_field_string_get_value(field
);
1314 return BT_COMPONENT_STATUS_ERROR
;
1317 if (pretty
->use_colors
) {
1318 g_string_append(pretty
->string
, COLOR_STRING_VALUE
);
1320 print_escape_string(pretty
, str
);
1321 if (pretty
->use_colors
) {
1322 g_string_append(pretty
->string
, COLOR_RST
);
1324 return BT_COMPONENT_STATUS_OK
;
1326 case CTF_TYPE_STRUCT
:
1327 return print_struct(pretty
, field
, print_names
, filter_fields
,
1329 case CTF_TYPE_VARIANT
:
1330 return print_variant(pretty
, field
, print_names
);
1331 case CTF_TYPE_ARRAY
:
1332 return print_array(pretty
, field
, print_names
);
1333 case CTF_TYPE_SEQUENCE
:
1334 return print_sequence(pretty
, field
, print_names
);
1336 // TODO: log instead
1337 fprintf(pretty
->err
, "[error] Unknown type id: %d\n", (int) type_id
);
1338 return BT_COMPONENT_STATUS_ERROR
;
1343 enum bt_component_status
print_stream_packet_context(struct pretty_component
*pretty
,
1344 struct bt_ctf_event
*event
)
1346 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1347 struct bt_ctf_packet
*packet
= NULL
;
1348 struct bt_ctf_field
*main_field
= NULL
;
1350 packet
= bt_ctf_event_get_packet(event
);
1352 ret
= BT_COMPONENT_STATUS_ERROR
;
1355 main_field
= bt_ctf_packet_get_context(packet
);
1359 if (!pretty
->start_line
) {
1360 g_string_append(pretty
->string
, ", ");
1362 pretty
->start_line
= false;
1363 if (pretty
->options
.print_scope_field_names
) {
1364 print_name_equal(pretty
, "stream.packet.context");
1366 ret
= print_field(pretty
, main_field
,
1367 pretty
->options
.print_context_field_names
,
1368 stream_packet_context_quarks
,
1369 STREAM_PACKET_CONTEXT_QUARKS_LEN
);
1377 enum bt_component_status
print_event_header_raw(struct pretty_component
*pretty
,
1378 struct bt_ctf_event
*event
)
1380 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1381 struct bt_ctf_field
*main_field
= NULL
;
1383 main_field
= bt_ctf_event_get_header(event
);
1387 if (!pretty
->start_line
) {
1388 g_string_append(pretty
->string
, ", ");
1390 pretty
->start_line
= false;
1391 if (pretty
->options
.print_scope_field_names
) {
1392 print_name_equal(pretty
, "stream.event.header");
1394 ret
= print_field(pretty
, main_field
,
1395 pretty
->options
.print_header_field_names
, NULL
, 0);
1402 enum bt_component_status
print_stream_event_context(struct pretty_component
*pretty
,
1403 struct bt_ctf_event
*event
)
1405 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1406 struct bt_ctf_field
*main_field
= NULL
;
1408 main_field
= bt_ctf_event_get_stream_event_context(event
);
1412 if (!pretty
->start_line
) {
1413 g_string_append(pretty
->string
, ", ");
1415 pretty
->start_line
= false;
1416 if (pretty
->options
.print_scope_field_names
) {
1417 print_name_equal(pretty
, "stream.event.context");
1419 ret
= print_field(pretty
, main_field
,
1420 pretty
->options
.print_context_field_names
, NULL
, 0);
1427 enum bt_component_status
print_event_context(struct pretty_component
*pretty
,
1428 struct bt_ctf_event
*event
)
1430 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1431 struct bt_ctf_field
*main_field
= NULL
;
1433 main_field
= bt_ctf_event_get_event_context(event
);
1437 if (!pretty
->start_line
) {
1438 g_string_append(pretty
->string
, ", ");
1440 pretty
->start_line
= false;
1441 if (pretty
->options
.print_scope_field_names
) {
1442 print_name_equal(pretty
, "event.context");
1444 ret
= print_field(pretty
, main_field
,
1445 pretty
->options
.print_context_field_names
, NULL
, 0);
1452 enum bt_component_status
print_event_payload(struct pretty_component
*pretty
,
1453 struct bt_ctf_event
*event
)
1455 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1456 struct bt_ctf_field
*main_field
= NULL
;
1458 main_field
= bt_ctf_event_get_event_payload(event
);
1462 if (!pretty
->start_line
) {
1463 g_string_append(pretty
->string
, ", ");
1465 pretty
->start_line
= false;
1466 if (pretty
->options
.print_scope_field_names
) {
1467 print_name_equal(pretty
, "event.fields");
1469 ret
= print_field(pretty
, main_field
,
1470 pretty
->options
.print_payload_field_names
, NULL
, 0);
1477 int flush_buf(struct pretty_component
*pretty
)
1481 if (pretty
->string
->len
== 0) {
1485 if (fwrite(pretty
->string
->str
, pretty
->string
->len
, 1, pretty
->out
) != 1) {
1494 enum bt_component_status
pretty_print_event(struct pretty_component
*pretty
,
1495 struct bt_notification
*event_notif
)
1497 enum bt_component_status ret
;
1498 struct bt_ctf_event
*event
=
1499 bt_notification_event_get_event(event_notif
);
1500 struct bt_clock_class_priority_map
*cc_prio_map
=
1501 bt_notification_event_get_clock_class_priority_map(event_notif
);
1504 assert(cc_prio_map
);
1505 pretty
->start_line
= true;
1506 g_string_assign(pretty
->string
, "");
1507 ret
= print_event_header(pretty
, event
, cc_prio_map
);
1508 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1512 ret
= print_stream_packet_context(pretty
, event
);
1513 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1517 if (pretty
->options
.verbose
) {
1518 ret
= print_event_header_raw(pretty
, event
);
1519 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1524 ret
= print_stream_event_context(pretty
, event
);
1525 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1529 ret
= print_event_context(pretty
, event
);
1530 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1534 ret
= print_event_payload(pretty
, event
);
1535 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1539 g_string_append_c(pretty
->string
, '\n');
1540 if (flush_buf(pretty
)) {
1541 ret
= BT_COMPONENT_STATUS_ERROR
;
1547 bt_put(cc_prio_map
);
1552 enum bt_component_status
pretty_print_discarded_elements(
1553 struct pretty_component
*pretty
,
1554 struct bt_notification
*notif
)
1556 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1557 struct bt_ctf_stream
*stream
= NULL
;
1558 struct bt_ctf_stream_class
*stream_class
= NULL
;
1559 struct bt_ctf_trace
*trace
= NULL
;
1560 const char *stream_name
;
1561 const char *trace_name
;
1562 const unsigned char *trace_uuid
;
1563 int64_t stream_class_id
;
1565 bool is_discarded_events
;
1567 struct bt_ctf_clock_value
*clock_value
= NULL
;
1570 switch (bt_notification_get_type(notif
)) {
1571 case BT_NOTIFICATION_TYPE_DISCARDED_EVENTS
:
1572 stream
= bt_notification_discarded_events_get_stream(notif
);
1573 count
= bt_notification_discarded_events_get_count(notif
);
1574 is_discarded_events
= true;
1576 case BT_NOTIFICATION_TYPE_DISCARDED_PACKETS
:
1577 stream
= bt_notification_discarded_packets_get_stream(notif
);
1578 count
= bt_notification_discarded_packets_get_count(notif
);
1579 is_discarded_events
= false;
1586 stream_name
= bt_ctf_stream_get_name(stream
);
1588 /* Stream class ID */
1589 stream_class
= bt_ctf_stream_get_class(stream
);
1590 assert(stream_class
);
1591 stream_class_id
= bt_ctf_stream_class_get_id(stream_class
);
1594 stream_id
= bt_ctf_stream_get_id(stream
);
1597 trace
= bt_ctf_stream_class_get_trace(stream_class
);
1599 trace_name
= bt_ctf_trace_get_name(trace
);
1601 trace_name
= "(unknown)";
1605 trace_uuid
= bt_ctf_trace_get_uuid(trace
);
1608 * Print to standard error stream to remain backward compatible
1609 * with Babeltrace 1.
1612 "%s%sWARNING%s%s: Tracer discarded %" PRId64
" %s%s between [",
1613 bt_common_color_fg_yellow(),
1614 bt_common_color_bold(),
1615 bt_common_color_reset(),
1616 bt_common_color_fg_yellow(),
1617 count
, is_discarded_events
? "event" : "packet",
1618 count
== 1 ? "" : "s");
1619 g_string_assign(pretty
->string
, "");
1620 clock_value
= is_discarded_events
?
1621 bt_notification_discarded_events_get_begin_clock_value(notif
) :
1622 bt_notification_discarded_packets_get_begin_clock_value(notif
);
1623 print_timestamp_wall(pretty
, clock_value
);
1624 BT_PUT(clock_value
);
1625 fprintf(stderr
, "%s] and [", pretty
->string
->str
);
1626 g_string_assign(pretty
->string
, "");
1627 clock_value
= is_discarded_events
?
1628 bt_notification_discarded_events_get_end_clock_value(notif
) :
1629 bt_notification_discarded_packets_get_end_clock_value(notif
);
1630 print_timestamp_wall(pretty
, clock_value
);
1631 BT_PUT(clock_value
);
1632 fprintf(stderr
, "%s] in trace \"%s\" ",
1633 pretty
->string
->str
, trace_name
);
1637 "(UUID: %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x) ",
1655 fprintf(stderr
, "(no UUID) ");
1658 fprintf(stderr
, "within stream \"%s\" (stream class ID: %" PRId64
", ",
1659 stream_name
, stream_class_id
);
1661 if (stream_id
>= 0) {
1662 fprintf(stderr
, "stream ID: %" PRId64
, stream_id
);
1664 fprintf(stderr
, "no stream ID");
1667 fprintf(stderr
, ").%s\n", bt_common_color_reset());
1669 bt_put(stream_class
);
1671 bt_put(clock_value
);