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
, "( ");
842 if (pretty
->use_colors
) {
843 g_string_append(pretty
->string
, COLOR_UNKNOWN
);
845 g_string_append(pretty
->string
, "<unknown>");
846 if (pretty
->use_colors
) {
847 g_string_append(pretty
->string
, COLOR_RST
);
852 const char *mapping_name
;
854 if (bt_ctf_field_type_enumeration_mapping_iterator_get_signed(
855 iter
, &mapping_name
, NULL
, NULL
) < 0) {
856 ret
= BT_COMPONENT_STATUS_ERROR
;
860 g_string_append(pretty
->string
, ", ");
861 if (pretty
->use_colors
) {
862 g_string_append(pretty
->string
, COLOR_ENUM_MAPPING_NAME
);
864 print_escape_string(pretty
, mapping_name
);
865 if (pretty
->use_colors
) {
866 g_string_append(pretty
->string
, COLOR_RST
);
868 if (bt_ctf_field_type_enumeration_mapping_iterator_next(iter
) < 0) {
873 g_string_append(pretty
->string
, " : container = ");
874 ret
= print_integer(pretty
, container_field
);
875 if (ret
!= BT_COMPONENT_STATUS_OK
) {
878 g_string_append(pretty
->string
, " )");
881 bt_put(container_field_type
);
882 bt_put(container_field
);
883 bt_put(enumeration_field_type
);
888 int filter_field_name(struct pretty_component
*pretty
, const char *field_name
,
889 GQuark
*filter_fields
, int filter_array_len
)
892 GQuark field_quark
= g_quark_try_string(field_name
);
894 if (!field_quark
|| pretty
->options
.verbose
) {
898 for (i
= 0; i
< filter_array_len
; i
++) {
899 if (field_quark
== filter_fields
[i
]) {
907 enum bt_component_status
print_struct_field(struct pretty_component
*pretty
,
908 struct bt_ctf_field
*_struct
,
909 struct bt_ctf_field_type
*struct_type
,
910 int i
, bool print_names
, int *nr_printed_fields
,
911 GQuark
*filter_fields
, int filter_array_len
)
913 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
914 const char *field_name
;
915 struct bt_ctf_field
*field
= NULL
;
916 struct bt_ctf_field_type
*field_type
= NULL
;;
918 field
= bt_ctf_field_structure_get_field_by_index(_struct
, i
);
920 ret
= BT_COMPONENT_STATUS_ERROR
;
923 if (bt_ctf_field_type_structure_get_field(struct_type
,
924 &field_name
, &field_type
, i
) < 0) {
925 ret
= BT_COMPONENT_STATUS_ERROR
;
929 if (filter_fields
&& !filter_field_name(pretty
, field_name
,
930 filter_fields
, filter_array_len
)) {
931 ret
= BT_COMPONENT_STATUS_OK
;
935 if (*nr_printed_fields
> 0) {
936 g_string_append(pretty
->string
, ", ");
938 g_string_append(pretty
->string
, " ");
941 print_field_name_equal(pretty
, rem_(field_name
));
943 ret
= print_field(pretty
, field
, print_names
, NULL
, 0);
944 *nr_printed_fields
+= 1;
952 enum bt_component_status
print_struct(struct pretty_component
*pretty
,
953 struct bt_ctf_field
*_struct
, bool print_names
,
954 GQuark
*filter_fields
, int filter_array_len
)
956 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
957 struct bt_ctf_field_type
*struct_type
= NULL
;
958 int nr_fields
, i
, nr_printed_fields
;
960 struct_type
= bt_ctf_field_get_type(_struct
);
962 ret
= BT_COMPONENT_STATUS_ERROR
;
965 nr_fields
= bt_ctf_field_type_structure_get_field_count(struct_type
);
967 ret
= BT_COMPONENT_STATUS_ERROR
;
970 g_string_append(pretty
->string
, "{");
972 nr_printed_fields
= 0;
973 for (i
= 0; i
< nr_fields
; i
++) {
974 ret
= print_struct_field(pretty
, _struct
, struct_type
, i
,
975 print_names
, &nr_printed_fields
, filter_fields
,
977 if (ret
!= BT_COMPONENT_STATUS_OK
) {
982 g_string_append(pretty
->string
, " }");
989 enum bt_component_status
print_array_field(struct pretty_component
*pretty
,
990 struct bt_ctf_field
*array
, uint64_t i
,
991 bool is_string
, bool print_names
)
993 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
994 struct bt_ctf_field
*field
= NULL
;
998 g_string_append(pretty
->string
, ", ");
1000 g_string_append(pretty
->string
, " ");
1003 g_string_append_printf(pretty
->string
, "[%" PRIu64
"] = ", i
);
1006 field
= bt_ctf_field_array_get_field(array
, i
);
1008 ret
= BT_COMPONENT_STATUS_ERROR
;
1011 ret
= print_field(pretty
, field
, print_names
, NULL
, 0);
1018 enum bt_component_status
print_array(struct pretty_component
*pretty
,
1019 struct bt_ctf_field
*array
, bool print_names
)
1021 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1022 struct bt_ctf_field_type
*array_type
= NULL
, *field_type
= NULL
;
1023 enum bt_ctf_field_type_id type_id
;
1026 bool is_string
= false;
1028 array_type
= bt_ctf_field_get_type(array
);
1030 ret
= BT_COMPONENT_STATUS_ERROR
;
1033 field_type
= bt_ctf_field_type_array_get_element_type(array_type
);
1035 ret
= BT_COMPONENT_STATUS_ERROR
;
1038 len
= bt_ctf_field_type_array_get_length(array_type
);
1040 ret
= BT_COMPONENT_STATUS_ERROR
;
1043 type_id
= bt_ctf_field_type_get_type_id(field_type
);
1044 if (type_id
== BT_CTF_FIELD_TYPE_ID_INTEGER
) {
1045 enum bt_ctf_string_encoding encoding
;
1047 encoding
= bt_ctf_field_type_integer_get_encoding(field_type
);
1048 if (encoding
== BT_CTF_STRING_ENCODING_UTF8
1049 || encoding
== BT_CTF_STRING_ENCODING_ASCII
) {
1050 int integer_len
, integer_alignment
;
1052 integer_len
= bt_ctf_field_type_integer_get_size(field_type
);
1053 if (integer_len
< 0) {
1054 return BT_COMPONENT_STATUS_ERROR
;
1056 integer_alignment
= bt_ctf_field_type_get_alignment(field_type
);
1057 if (integer_alignment
< 0) {
1058 return BT_COMPONENT_STATUS_ERROR
;
1060 if (integer_len
== CHAR_BIT
1061 && integer_alignment
== CHAR_BIT
) {
1068 g_string_assign(pretty
->tmp_string
, "");
1070 g_string_append(pretty
->string
, "[");
1074 for (i
= 0; i
< len
; i
++) {
1075 ret
= print_array_field(pretty
, array
, i
, is_string
, print_names
);
1076 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1083 if (pretty
->use_colors
) {
1084 g_string_append(pretty
->string
, COLOR_STRING_VALUE
);
1086 print_escape_string(pretty
, pretty
->tmp_string
->str
);
1087 if (pretty
->use_colors
) {
1088 g_string_append(pretty
->string
, COLOR_RST
);
1091 g_string_append(pretty
->string
, " ]");
1100 enum bt_component_status
print_sequence_field(struct pretty_component
*pretty
,
1101 struct bt_ctf_field
*seq
, uint64_t i
,
1102 bool is_string
, bool print_names
)
1104 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1105 struct bt_ctf_field
*field
= NULL
;
1109 g_string_append(pretty
->string
, ", ");
1111 g_string_append(pretty
->string
, " ");
1114 g_string_append_printf(pretty
->string
, "[%" PRIu64
"] = ", i
);
1117 field
= bt_ctf_field_sequence_get_field(seq
, i
);
1119 ret
= BT_COMPONENT_STATUS_ERROR
;
1122 ret
= print_field(pretty
, field
, print_names
, NULL
, 0);
1129 enum bt_component_status
print_sequence(struct pretty_component
*pretty
,
1130 struct bt_ctf_field
*seq
, bool print_names
)
1132 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1133 struct bt_ctf_field_type
*seq_type
= NULL
, *field_type
= NULL
;
1134 struct bt_ctf_field
*length_field
= NULL
;
1135 enum bt_ctf_field_type_id type_id
;
1138 bool is_string
= false;
1140 seq_type
= bt_ctf_field_get_type(seq
);
1142 ret
= BT_COMPONENT_STATUS_ERROR
;
1145 length_field
= bt_ctf_field_sequence_get_length(seq
);
1146 if (!length_field
) {
1147 ret
= BT_COMPONENT_STATUS_ERROR
;
1150 if (bt_ctf_field_unsigned_integer_get_value(length_field
, &len
) < 0) {
1151 ret
= BT_COMPONENT_STATUS_ERROR
;
1154 field_type
= bt_ctf_field_type_sequence_get_element_type(seq_type
);
1156 ret
= BT_COMPONENT_STATUS_ERROR
;
1159 type_id
= bt_ctf_field_type_get_type_id(field_type
);
1160 if (type_id
== BT_CTF_FIELD_TYPE_ID_INTEGER
) {
1161 enum bt_ctf_string_encoding encoding
;
1163 encoding
= bt_ctf_field_type_integer_get_encoding(field_type
);
1164 if (encoding
== BT_CTF_STRING_ENCODING_UTF8
1165 || encoding
== BT_CTF_STRING_ENCODING_ASCII
) {
1166 int integer_len
, integer_alignment
;
1168 integer_len
= bt_ctf_field_type_integer_get_size(field_type
);
1169 if (integer_len
< 0) {
1170 ret
= BT_COMPONENT_STATUS_ERROR
;
1173 integer_alignment
= bt_ctf_field_type_get_alignment(field_type
);
1174 if (integer_alignment
< 0) {
1175 ret
= BT_COMPONENT_STATUS_ERROR
;
1178 if (integer_len
== CHAR_BIT
1179 && integer_alignment
== CHAR_BIT
) {
1186 g_string_assign(pretty
->tmp_string
, "");
1188 g_string_append(pretty
->string
, "[");
1192 for (i
= 0; i
< len
; i
++) {
1193 ret
= print_sequence_field(pretty
, seq
, i
,
1194 is_string
, print_names
);
1195 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1202 if (pretty
->use_colors
) {
1203 g_string_append(pretty
->string
, COLOR_STRING_VALUE
);
1205 print_escape_string(pretty
, pretty
->tmp_string
->str
);
1206 if (pretty
->use_colors
) {
1207 g_string_append(pretty
->string
, COLOR_RST
);
1210 g_string_append(pretty
->string
, " ]");
1213 bt_put(length_field
);
1220 enum bt_component_status
print_variant(struct pretty_component
*pretty
,
1221 struct bt_ctf_field
*variant
, bool print_names
)
1223 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1224 struct bt_ctf_field
*field
= NULL
;
1226 field
= bt_ctf_field_variant_get_current_field(variant
);
1228 ret
= BT_COMPONENT_STATUS_ERROR
;
1231 g_string_append(pretty
->string
, "{ ");
1235 struct bt_ctf_field
*tag_field
= NULL
;
1236 const char *tag_choice
;
1237 struct bt_ctf_field_type_enumeration_mapping_iterator
*iter
;
1239 tag_field
= bt_ctf_field_variant_get_tag(variant
);
1241 ret
= BT_COMPONENT_STATUS_ERROR
;
1245 iter
= bt_ctf_field_enumeration_get_mappings(tag_field
);
1248 ret
= BT_COMPONENT_STATUS_ERROR
;
1253 bt_ctf_field_type_enumeration_mapping_iterator_get_signed(
1254 iter
, &tag_choice
, NULL
, NULL
);
1258 ret
= BT_COMPONENT_STATUS_ERROR
;
1261 print_field_name_equal(pretty
, rem_(tag_choice
));
1265 ret
= print_field(pretty
, field
, print_names
, NULL
, 0);
1266 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1270 g_string_append(pretty
->string
, " }");
1277 enum bt_component_status
print_field(struct pretty_component
*pretty
,
1278 struct bt_ctf_field
*field
, bool print_names
,
1279 GQuark
*filter_fields
, int filter_array_len
)
1281 enum bt_ctf_field_type_id type_id
;
1283 type_id
= bt_ctf_field_get_type_id(field
);
1285 case CTF_TYPE_INTEGER
:
1286 return print_integer(pretty
, field
);
1287 case CTF_TYPE_FLOAT
:
1291 if (bt_ctf_field_floating_point_get_value(field
, &v
)) {
1292 return BT_COMPONENT_STATUS_ERROR
;
1294 if (pretty
->use_colors
) {
1295 g_string_append(pretty
->string
, COLOR_NUMBER_VALUE
);
1297 g_string_append_printf(pretty
->string
, "%g", v
);
1298 if (pretty
->use_colors
) {
1299 g_string_append(pretty
->string
, COLOR_RST
);
1301 return BT_COMPONENT_STATUS_OK
;
1304 return print_enum(pretty
, field
);
1305 case CTF_TYPE_STRING
:
1309 str
= bt_ctf_field_string_get_value(field
);
1311 return BT_COMPONENT_STATUS_ERROR
;
1314 if (pretty
->use_colors
) {
1315 g_string_append(pretty
->string
, COLOR_STRING_VALUE
);
1317 print_escape_string(pretty
, str
);
1318 if (pretty
->use_colors
) {
1319 g_string_append(pretty
->string
, COLOR_RST
);
1321 return BT_COMPONENT_STATUS_OK
;
1323 case CTF_TYPE_STRUCT
:
1324 return print_struct(pretty
, field
, print_names
, filter_fields
,
1326 case CTF_TYPE_VARIANT
:
1327 return print_variant(pretty
, field
, print_names
);
1328 case CTF_TYPE_ARRAY
:
1329 return print_array(pretty
, field
, print_names
);
1330 case CTF_TYPE_SEQUENCE
:
1331 return print_sequence(pretty
, field
, print_names
);
1333 // TODO: log instead
1334 fprintf(pretty
->err
, "[error] Unknown type id: %d\n", (int) type_id
);
1335 return BT_COMPONENT_STATUS_ERROR
;
1340 enum bt_component_status
print_stream_packet_context(struct pretty_component
*pretty
,
1341 struct bt_ctf_event
*event
)
1343 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1344 struct bt_ctf_packet
*packet
= NULL
;
1345 struct bt_ctf_field
*main_field
= NULL
;
1347 packet
= bt_ctf_event_get_packet(event
);
1349 ret
= BT_COMPONENT_STATUS_ERROR
;
1352 main_field
= bt_ctf_packet_get_context(packet
);
1356 if (!pretty
->start_line
) {
1357 g_string_append(pretty
->string
, ", ");
1359 pretty
->start_line
= false;
1360 if (pretty
->options
.print_scope_field_names
) {
1361 print_name_equal(pretty
, "stream.packet.context");
1363 ret
= print_field(pretty
, main_field
,
1364 pretty
->options
.print_context_field_names
,
1365 stream_packet_context_quarks
,
1366 STREAM_PACKET_CONTEXT_QUARKS_LEN
);
1374 enum bt_component_status
print_event_header_raw(struct pretty_component
*pretty
,
1375 struct bt_ctf_event
*event
)
1377 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1378 struct bt_ctf_field
*main_field
= NULL
;
1380 main_field
= bt_ctf_event_get_header(event
);
1384 if (!pretty
->start_line
) {
1385 g_string_append(pretty
->string
, ", ");
1387 pretty
->start_line
= false;
1388 if (pretty
->options
.print_scope_field_names
) {
1389 print_name_equal(pretty
, "stream.event.header");
1391 ret
= print_field(pretty
, main_field
,
1392 pretty
->options
.print_header_field_names
, NULL
, 0);
1399 enum bt_component_status
print_stream_event_context(struct pretty_component
*pretty
,
1400 struct bt_ctf_event
*event
)
1402 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1403 struct bt_ctf_field
*main_field
= NULL
;
1405 main_field
= bt_ctf_event_get_stream_event_context(event
);
1409 if (!pretty
->start_line
) {
1410 g_string_append(pretty
->string
, ", ");
1412 pretty
->start_line
= false;
1413 if (pretty
->options
.print_scope_field_names
) {
1414 print_name_equal(pretty
, "stream.event.context");
1416 ret
= print_field(pretty
, main_field
,
1417 pretty
->options
.print_context_field_names
, NULL
, 0);
1424 enum bt_component_status
print_event_context(struct pretty_component
*pretty
,
1425 struct bt_ctf_event
*event
)
1427 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1428 struct bt_ctf_field
*main_field
= NULL
;
1430 main_field
= bt_ctf_event_get_event_context(event
);
1434 if (!pretty
->start_line
) {
1435 g_string_append(pretty
->string
, ", ");
1437 pretty
->start_line
= false;
1438 if (pretty
->options
.print_scope_field_names
) {
1439 print_name_equal(pretty
, "event.context");
1441 ret
= print_field(pretty
, main_field
,
1442 pretty
->options
.print_context_field_names
, NULL
, 0);
1449 enum bt_component_status
print_event_payload(struct pretty_component
*pretty
,
1450 struct bt_ctf_event
*event
)
1452 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1453 struct bt_ctf_field
*main_field
= NULL
;
1455 main_field
= bt_ctf_event_get_event_payload(event
);
1459 if (!pretty
->start_line
) {
1460 g_string_append(pretty
->string
, ", ");
1462 pretty
->start_line
= false;
1463 if (pretty
->options
.print_scope_field_names
) {
1464 print_name_equal(pretty
, "event.fields");
1466 ret
= print_field(pretty
, main_field
,
1467 pretty
->options
.print_payload_field_names
, NULL
, 0);
1474 int flush_buf(struct pretty_component
*pretty
)
1478 if (pretty
->string
->len
== 0) {
1482 if (fwrite(pretty
->string
->str
, pretty
->string
->len
, 1, pretty
->out
) != 1) {
1491 enum bt_component_status
pretty_print_event(struct pretty_component
*pretty
,
1492 struct bt_notification
*event_notif
)
1494 enum bt_component_status ret
;
1495 struct bt_ctf_event
*event
=
1496 bt_notification_event_get_event(event_notif
);
1497 struct bt_clock_class_priority_map
*cc_prio_map
=
1498 bt_notification_event_get_clock_class_priority_map(event_notif
);
1501 assert(cc_prio_map
);
1502 pretty
->start_line
= true;
1503 g_string_assign(pretty
->string
, "");
1504 ret
= print_event_header(pretty
, event
, cc_prio_map
);
1505 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1509 ret
= print_stream_packet_context(pretty
, event
);
1510 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1514 if (pretty
->options
.verbose
) {
1515 ret
= print_event_header_raw(pretty
, event
);
1516 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1521 ret
= print_stream_event_context(pretty
, event
);
1522 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1526 ret
= print_event_context(pretty
, event
);
1527 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1531 ret
= print_event_payload(pretty
, event
);
1532 if (ret
!= BT_COMPONENT_STATUS_OK
) {
1536 g_string_append_c(pretty
->string
, '\n');
1537 if (flush_buf(pretty
)) {
1538 ret
= BT_COMPONENT_STATUS_ERROR
;
1544 bt_put(cc_prio_map
);
1549 enum bt_component_status
pretty_print_discarded_elements(
1550 struct pretty_component
*pretty
,
1551 struct bt_notification
*notif
)
1553 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
1554 struct bt_ctf_stream
*stream
= NULL
;
1555 struct bt_ctf_stream_class
*stream_class
= NULL
;
1556 struct bt_ctf_trace
*trace
= NULL
;
1557 const char *stream_name
;
1558 const char *trace_name
;
1559 const unsigned char *trace_uuid
;
1560 int64_t stream_class_id
;
1562 bool is_discarded_events
;
1564 struct bt_ctf_clock_value
*clock_value
= NULL
;
1567 switch (bt_notification_get_type(notif
)) {
1568 case BT_NOTIFICATION_TYPE_DISCARDED_EVENTS
:
1569 stream
= bt_notification_discarded_events_get_stream(notif
);
1570 count
= bt_notification_discarded_events_get_count(notif
);
1571 is_discarded_events
= true;
1573 case BT_NOTIFICATION_TYPE_DISCARDED_PACKETS
:
1574 stream
= bt_notification_discarded_packets_get_stream(notif
);
1575 count
= bt_notification_discarded_packets_get_count(notif
);
1576 is_discarded_events
= false;
1583 stream_name
= bt_ctf_stream_get_name(stream
);
1585 /* Stream class ID */
1586 stream_class
= bt_ctf_stream_get_class(stream
);
1587 assert(stream_class
);
1588 stream_class_id
= bt_ctf_stream_class_get_id(stream_class
);
1591 stream_id
= bt_ctf_stream_get_id(stream
);
1594 trace
= bt_ctf_stream_class_get_trace(stream_class
);
1596 trace_name
= bt_ctf_trace_get_name(trace
);
1598 trace_name
= "(unknown)";
1602 trace_uuid
= bt_ctf_trace_get_uuid(trace
);
1605 * Print to standard error stream to remain backward compatible
1606 * with Babeltrace 1.
1609 "%s%sWARNING%s%s: Tracer discarded %" PRId64
" %s%s between [",
1610 bt_common_color_fg_yellow(),
1611 bt_common_color_bold(),
1612 bt_common_color_reset(),
1613 bt_common_color_fg_yellow(),
1614 count
, is_discarded_events
? "event" : "packet",
1615 count
== 1 ? "" : "s");
1616 g_string_assign(pretty
->string
, "");
1617 clock_value
= is_discarded_events
?
1618 bt_notification_discarded_events_get_begin_clock_value(notif
) :
1619 bt_notification_discarded_packets_get_begin_clock_value(notif
);
1620 print_timestamp_wall(pretty
, clock_value
);
1621 BT_PUT(clock_value
);
1622 fprintf(stderr
, "%s] and [", pretty
->string
->str
);
1623 g_string_assign(pretty
->string
, "");
1624 clock_value
= is_discarded_events
?
1625 bt_notification_discarded_events_get_end_clock_value(notif
) :
1626 bt_notification_discarded_packets_get_end_clock_value(notif
);
1627 print_timestamp_wall(pretty
, clock_value
);
1628 BT_PUT(clock_value
);
1629 fprintf(stderr
, "%s] in trace \"%s\" ",
1630 pretty
->string
->str
, trace_name
);
1634 "(UUID: %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x) ",
1652 fprintf(stderr
, "(no UUID) ");
1655 fprintf(stderr
, "within stream \"%s\" (stream class ID: %" PRId64
", ",
1656 stream_name
, stream_class_id
);
1658 if (stream_id
>= 0) {
1659 fprintf(stderr
, "stream ID: %" PRId64
, stream_id
);
1661 fprintf(stderr
, "no stream ID");
1664 fprintf(stderr
, ").%s\n", bt_common_color_reset());
1666 bt_put(stream_class
);
1668 bt_put(clock_value
);