2 * Copyright 2018 Philippe Proulx <pproulx@efficios.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #define BT_LOG_TAG "LIB-LOGGING"
33 #include <babeltrace/common-internal.h>
34 #include <babeltrace/lib-logging-internal.h>
35 #include <babeltrace/ref-internal.h>
36 #include <babeltrace/values-internal.h>
37 #include <babeltrace/object-pool-internal.h>
38 #include <babeltrace/ctf-ir/field-types-internal.h>
39 #include <babeltrace/ctf-ir/fields-internal.h>
40 #include <babeltrace/ctf-ir/event-class-internal.h>
41 #include <babeltrace/ctf-ir/event-internal.h>
42 #include <babeltrace/ctf-ir/packet-internal.h>
43 #include <babeltrace/ctf-ir/stream-class-internal.h>
44 #include <babeltrace/ctf-ir/stream-internal.h>
45 #include <babeltrace/ctf-ir/trace-internal.h>
46 #include <babeltrace/ctf-ir/clock-class-internal.h>
47 #include <babeltrace/ctf-ir/clock-value-internal.h>
48 #include <babeltrace/ctf-ir/field-path-internal.h>
49 #include <babeltrace/ctf-ir/utils-internal.h>
50 #include <babeltrace/ctf-writer/field-types-internal.h>
51 #include <babeltrace/ctf-writer/fields-internal.h>
52 #include <babeltrace/ctf-writer/event-internal.h>
53 #include <babeltrace/ctf-writer/stream-class-internal.h>
54 #include <babeltrace/ctf-writer/stream-internal.h>
55 #include <babeltrace/ctf-writer/trace-internal.h>
56 #include <babeltrace/ctf-writer/clock-internal.h>
57 #include <babeltrace/ctf-writer/writer-internal.h>
58 #include <babeltrace/graph/clock-class-priority-map-internal.h>
59 #include <babeltrace/graph/component-class-internal.h>
60 #include <babeltrace/graph/component-class-sink-colander-internal.h>
61 #include <babeltrace/graph/component-filter-internal.h>
62 #include <babeltrace/graph/component-internal.h>
63 #include <babeltrace/graph/component-sink-internal.h>
64 #include <babeltrace/graph/component-source-internal.h>
65 #include <babeltrace/graph/connection-internal.h>
66 #include <babeltrace/graph/graph-internal.h>
67 #include <babeltrace/graph/notification-discarded-elements-internal.h>
68 #include <babeltrace/graph/notification-event-internal.h>
69 #include <babeltrace/graph/notification-inactivity-internal.h>
70 #include <babeltrace/graph/notification-internal.h>
71 #include <babeltrace/graph/notification-iterator-internal.h>
72 #include <babeltrace/graph/notification-packet-internal.h>
73 #include <babeltrace/graph/notification-stream-internal.h>
74 #include <babeltrace/graph/port-internal.h>
75 #include <babeltrace/plugin/plugin-internal.h>
76 #include <babeltrace/plugin/plugin-so-internal.h>
78 #define LIB_LOGGING_BUF_SIZE (4096 * 4)
80 static char __thread lib_logging_buf
[LIB_LOGGING_BUF_SIZE
];
82 #define BUF_APPEND(_fmt, ...) \
85 size_t _size = LIB_LOGGING_BUF_SIZE - \
86 (size_t) (*buf_ch - lib_logging_buf); \
87 _count = snprintf(*buf_ch, _size, (_fmt), __VA_ARGS__); \
88 BT_ASSERT(_count >= 0); \
89 *buf_ch += MIN(_count, _size); \
90 if (*buf_ch >= lib_logging_buf + LIB_LOGGING_BUF_SIZE - 1) { \
95 #define BUF_APPEND_UUID(_uuid) \
96 BUF_APPEND(", %suuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\"", \
98 (unsigned int) (_uuid)[0], \
99 (unsigned int) (_uuid)[1], \
100 (unsigned int) (_uuid)[2], \
101 (unsigned int) (_uuid)[3], \
102 (unsigned int) (_uuid)[4], \
103 (unsigned int) (_uuid)[5], \
104 (unsigned int) (_uuid)[6], \
105 (unsigned int) (_uuid)[7], \
106 (unsigned int) (_uuid)[8], \
107 (unsigned int) (_uuid)[9], \
108 (unsigned int) (_uuid)[10], \
109 (unsigned int) (_uuid)[11], \
110 (unsigned int) (_uuid)[12], \
111 (unsigned int) (_uuid)[13], \
112 (unsigned int) (_uuid)[14], \
113 (unsigned int) (_uuid)[15])
115 #define PRFIELD(_expr) prefix, (_expr)
117 #define SET_TMP_PREFIX(_prefix2) \
119 strcpy(tmp_prefix, prefix); \
120 strcat(tmp_prefix, (_prefix2)); \
123 typedef void (*format_func
)(char **, bool, const char *, void *);
125 static inline void format_component(char **buf_ch
, bool extended
,
126 const char *prefix
, struct bt_component
*component
);
128 static inline void format_port(char **buf_ch
, bool extended
,
129 const char *prefix
, struct bt_port
*port
);
131 static inline void format_connection(char **buf_ch
, bool extended
,
132 const char *prefix
, struct bt_connection
*connection
);
134 static inline void format_ref_count(char **buf_ch
, bool extended
,
135 const char *prefix
, struct bt_object
*obj
)
137 BUF_APPEND(", %sref-count=%lu", prefix
, obj
->ref_count
.count
);
140 static inline void format_object_pool(char **buf_ch
, bool extended
,
141 const char *prefix
, struct bt_object_pool
*pool
)
143 BUF_APPEND(", %ssize=%zu", PRFIELD(pool
->size
));
146 BUF_APPEND(", %scap=%u", PRFIELD(pool
->objects
->len
));
150 static inline void format_field_type_common(char **buf_ch
, bool extended
,
151 const char *prefix
, struct bt_field_type_common
*field_type
)
153 BUF_APPEND(", %stype-id=%s, %salignment=%u",
154 PRFIELD(bt_common_field_type_id_string(field_type
->id
)),
155 PRFIELD(field_type
->alignment
));
158 BUF_APPEND(", %sis-frozen=%d", PRFIELD(field_type
->frozen
));
163 if (field_type
->id
== BT_FIELD_TYPE_ID_UNKNOWN
) {
167 switch (field_type
->id
) {
168 case BT_FIELD_TYPE_ID_INTEGER
:
170 struct bt_field_type_common_integer
*integer
=
171 BT_FROM_COMMON(field_type
);
173 BUF_APPEND(", %ssize=%u, %sis-signed=%d, %sbyte-order=%s, "
174 "%sbase=%d, %sencoding=%s, "
175 "%smapped-clock-class-addr=%p",
176 PRFIELD(integer
->size
), PRFIELD(integer
->is_signed
),
177 PRFIELD(bt_common_byte_order_string(integer
->user_byte_order
)),
178 PRFIELD(integer
->base
),
179 PRFIELD(bt_common_string_encoding_string(integer
->encoding
)),
180 PRFIELD(integer
->mapped_clock_class
));
182 if (integer
->mapped_clock_class
) {
183 BUF_APPEND(", %smapped-clock-class-name=\"%s\"",
184 PRFIELD(bt_clock_class_get_name(integer
->mapped_clock_class
)));
188 case BT_FIELD_TYPE_ID_FLOAT
:
190 struct bt_field_type_common_floating_point
*flt
=
191 BT_FROM_COMMON(field_type
);
193 BUF_APPEND(", %sexp-dig=%u, %smant-dig=%u, %sbyte-order=%s",
194 PRFIELD(flt
->exp_dig
), PRFIELD(flt
->mant_dig
),
195 PRFIELD(bt_common_byte_order_string(flt
->user_byte_order
)));
198 case BT_FIELD_TYPE_ID_ENUM
:
200 struct bt_field_type_common_enumeration
*enm
=
201 BT_FROM_COMMON(field_type
);
203 BUF_APPEND(", %smapping-count=%u",
204 PRFIELD(enm
->entries
->len
));
207 case BT_FIELD_TYPE_ID_STRING
:
209 struct bt_field_type_common_string
*str
=
210 BT_FROM_COMMON(field_type
);
212 BUF_APPEND(", %sencoding=%s",
213 PRFIELD(bt_common_string_encoding_string(str
->encoding
)));
216 case BT_FIELD_TYPE_ID_STRUCT
:
218 struct bt_field_type_common_structure
*structure
=
219 BT_FROM_COMMON(field_type
);
221 BUF_APPEND(", %sfield-count=%u",
222 PRFIELD(structure
->fields
->len
));
225 case BT_FIELD_TYPE_ID_SEQUENCE
:
227 struct bt_field_type_common_sequence
*seq
=
228 BT_FROM_COMMON(field_type
);
230 BUF_APPEND(", %slength-ft-addr=\"%s\", %selem-ft-addr=%p",
231 PRFIELD(seq
->length_field_name
->str
),
232 PRFIELD(seq
->element_ft
));
235 case BT_FIELD_TYPE_ID_VARIANT
:
237 struct bt_field_type_common_variant
*variant
=
238 BT_FROM_COMMON(field_type
);
240 BUF_APPEND(", %stag-name=\"%s\", %sfield-count=%u",
241 PRFIELD(variant
->tag_name
->str
),
242 PRFIELD(variant
->choices
->len
));
250 static inline void format_field_type(char **buf_ch
, bool extended
,
251 const char *prefix
, struct bt_field_type
*field_type
)
253 format_field_type_common(buf_ch
, extended
, prefix
,
254 (void *) field_type
);
257 static inline void format_writer_field_type(char **buf_ch
, bool extended
,
258 const char *prefix
, struct bt_ctf_field_type
*field_type
)
260 format_field_type_common(buf_ch
, extended
, prefix
,
261 (void *) field_type
);
264 static inline void format_field_common_integer_extended(char **buf_ch
,
265 const char *prefix
, struct bt_field_common
*field
)
267 struct bt_field_common_integer
*integer
= BT_FROM_COMMON(field
);
268 struct bt_field_type_common_integer
*field_type
=
269 BT_FROM_COMMON(field
->type
);
270 const char *fmt
= NULL
;
272 BT_ASSERT(field_type
);
274 if (field_type
->base
== 8) {
275 fmt
= ", %svalue=%" PRIo64
;
276 } else if (field_type
->base
== 16) {
277 fmt
= ", %svalue=%" PRIx64
;
280 if (field_type
->is_signed
) {
282 fmt
= ", %svalue=%" PRId64
;
285 BUF_APPEND(fmt
, PRFIELD(integer
->payload
.signd
));
288 fmt
= ", %svalue=%" PRIu64
;
291 BUF_APPEND(fmt
, PRFIELD(integer
->payload
.unsignd
));
295 static inline void format_field_common(char **buf_ch
, bool extended
,
296 const char *prefix
, struct bt_field_common
*field
)
298 BUF_APPEND(", %sis-set=%d", PRFIELD(field
->payload_set
));
301 BUF_APPEND(", %sis-frozen=%d", PRFIELD(field
->frozen
));
304 BUF_APPEND(", %stype-addr=%p", PRFIELD(field
->type
));
310 BUF_APPEND(", %stype-id=%s",
311 PRFIELD(bt_common_field_type_id_string(field
->type
->id
)));
313 if (!extended
|| field
->type
->id
== BT_FIELD_TYPE_ID_UNKNOWN
||
314 !field
->payload_set
) {
318 switch (field
->type
->id
) {
319 case BT_FIELD_TYPE_ID_INTEGER
:
321 format_field_common_integer_extended(buf_ch
, prefix
, field
);
324 case BT_FIELD_TYPE_ID_FLOAT
:
326 struct bt_field_common_floating_point
*flt
=
327 BT_FROM_COMMON(field
);
329 BUF_APPEND(", %svalue=%f", PRFIELD(flt
->payload
));
332 case BT_FIELD_TYPE_ID_STRING
:
334 struct bt_field_common_string
*str
=
335 BT_FROM_COMMON(field
);
338 BT_ASSERT(str
->buf
->data
);
339 BUF_APPEND(", %spartial-value=\"%.32s\"",
340 PRFIELD(str
->buf
->data
));
345 case BT_FIELD_TYPE_ID_SEQUENCE
:
347 struct bt_field_common_sequence
*seq
=
348 BT_FROM_COMMON(field
);
350 BUF_APPEND(", %slength=%" PRIu64
, PRFIELD(seq
->length
));
353 BUF_APPEND(", %sallocated-length=%u",
354 PRFIELD(seq
->elements
->len
));
358 case BT_FIELD_TYPE_ID_VARIANT
:
360 struct bt_field_common_variant
*variant
=
361 BT_FROM_COMMON(field
);
363 BUF_APPEND(", %scur-field-addr=%p",
364 PRFIELD(variant
->current_field
));
372 static inline void format_field(char **buf_ch
, bool extended
,
373 const char *prefix
, struct bt_field
*field
)
375 struct bt_field_common
*common_field
= (void *) field
;
377 format_field_common(buf_ch
, extended
, prefix
, (void *) field
);
383 if (!common_field
->type
) {
387 switch (common_field
->type
->id
) {
388 case BT_FIELD_TYPE_ID_ENUM
:
390 struct bt_field_common_integer
*integer
= (void *) field
;
391 struct bt_field_type_common_enumeration
*enum_ft
=
392 BT_FROM_COMMON(common_field
->type
);
394 if (enum_ft
->container_ft
) {
395 if (enum_ft
->container_ft
->is_signed
) {
396 BUF_APPEND(", %svalue=%" PRId64
,
397 PRFIELD(integer
->payload
.signd
));
399 BUF_APPEND(", %svalue=%" PRIu64
,
400 PRFIELD(integer
->payload
.unsignd
));
410 static inline void format_writer_field(char **buf_ch
, bool extended
,
411 const char *prefix
, struct bt_ctf_field
*field
)
413 struct bt_field_common
*common_field
= (void *) field
;
415 format_field_common(buf_ch
, extended
, prefix
, (void *) field
);
421 if (!common_field
->type
) {
425 switch (common_field
->type
->id
) {
426 case BT_FIELD_TYPE_ID_ENUM
:
428 struct bt_ctf_field_enumeration
*enumeration
= (void *) field
;
430 if (enumeration
->container
) {
431 format_writer_field(buf_ch
, extended
, prefix
,
432 (void *) enumeration
->container
);
436 case BT_FIELD_TYPE_ID_VARIANT
:
438 struct bt_ctf_field_variant
*variant
= (void *) field
;
440 BUF_APPEND(", %stag-field-addr=%p", PRFIELD(variant
->tag
));
448 static inline void format_field_path(char **buf_ch
, bool extended
,
449 const char *prefix
, struct bt_field_path
*field_path
)
453 if (field_path
->indexes
) {
454 BT_ASSERT(field_path
->indexes
);
455 BUF_APPEND(", %sindex-count=%u", PRFIELD(field_path
->indexes
->len
));
458 if (!extended
|| !field_path
->indexes
) {
462 BUF_APPEND(", %spath=[%s", PRFIELD(bt_common_scope_string(field_path
->root
)));
464 for (i
= 0; i
< field_path
->indexes
->len
; i
++) {
465 int index
= g_array_index(field_path
->indexes
, int, i
);
467 BUF_APPEND(", %d", index
);
470 BUF_APPEND("%s", "]");
473 static inline void format_trace_common(char **buf_ch
, bool extended
,
474 const char *prefix
, struct bt_trace_common
*trace
)
477 BUF_APPEND(", %sname=\"%s\"", PRFIELD(trace
->name
->str
));
484 BUF_APPEND(", %sis-frozen=%d", PRFIELD(trace
->frozen
));
486 if (trace
->uuid_set
) {
487 BUF_APPEND_UUID(trace
->uuid
);
490 if (trace
->clock_classes
) {
491 BUF_APPEND(", %sclock-class-count=%u",
492 PRFIELD(trace
->clock_classes
->len
));
495 if (trace
->stream_classes
) {
496 BUF_APPEND(", %sstream-class-count=%u",
497 PRFIELD(trace
->stream_classes
->len
));
500 if (trace
->streams
) {
501 BUF_APPEND(", %sstream-count=%u",
502 PRFIELD(trace
->streams
->len
));
505 BUF_APPEND(", %spacket-header-ft-addr=%p",
506 PRFIELD(trace
->packet_header_field_type
));
509 static inline void format_trace(char **buf_ch
, bool extended
,
510 const char *prefix
, struct bt_trace
*trace
)
514 format_trace_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(trace
));
520 BUF_APPEND(", %sis-static=%d", PRFIELD(trace
->is_static
));
521 SET_TMP_PREFIX("phf-pool-");
522 format_object_pool(buf_ch
, extended
, prefix
,
523 &trace
->packet_header_field_pool
);
526 static inline void format_writer_trace(char **buf_ch
, bool extended
,
527 const char *prefix
, struct bt_ctf_trace
*trace
)
529 format_trace_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(trace
));
532 static inline void format_stream_class_common(char **buf_ch
, bool extended
,
533 const char *prefix
, struct bt_stream_class_common
*stream_class
,
534 format_func trace_format_func
)
536 struct bt_trace_common
*trace
;
539 if (stream_class
->id_set
) {
540 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(stream_class
->id
));
543 if (stream_class
->name
) {
544 BUF_APPEND(", %sname=\"%s\"", PRFIELD(stream_class
->name
->str
));
551 BUF_APPEND(", %sis-frozen=%d", PRFIELD(stream_class
->frozen
));
553 if (stream_class
->event_classes
) {
554 BUF_APPEND(", %sevent-class-count=%u",
555 PRFIELD(stream_class
->event_classes
->len
));
558 BUF_APPEND(", %spacket-context-ft-addr=%p, "
559 "%sevent-header-ft-addr=%p, %sevent-context-ft-addr=%p",
560 PRFIELD(stream_class
->packet_context_field_type
),
561 PRFIELD(stream_class
->event_header_field_type
),
562 PRFIELD(stream_class
->event_context_field_type
));
563 trace
= bt_stream_class_common_borrow_trace(stream_class
);
568 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
569 SET_TMP_PREFIX("trace-");
570 trace_format_func(buf_ch
, false, tmp_prefix
, trace
);
573 static inline void format_stream_class(char **buf_ch
, bool extended
,
574 const char *prefix
, struct bt_stream_class
*stream_class
)
578 format_stream_class_common(buf_ch
, extended
, prefix
,
579 BT_TO_COMMON(stream_class
), (format_func
) format_trace
);
585 SET_TMP_PREFIX("ehf-pool-");
586 format_object_pool(buf_ch
, extended
, prefix
,
587 &stream_class
->event_header_field_pool
);
588 SET_TMP_PREFIX("pcf-pool-");
589 format_object_pool(buf_ch
, extended
, prefix
,
590 &stream_class
->packet_context_field_pool
);
593 static inline void format_writer_stream_class(char **buf_ch
, bool extended
,
594 const char *prefix
, struct bt_ctf_stream_class
*stream_class
)
596 format_stream_class_common(buf_ch
, extended
, prefix
,
597 BT_TO_COMMON(stream_class
), (format_func
) format_writer_trace
);
599 if (extended
&& stream_class
->clock
) {
600 BUF_APPEND(", %sctf-writer-clock-addr=%p, "
601 "%sctf-writer-clock-name=\"%s\"",
602 PRFIELD(stream_class
->clock
),
603 PRFIELD(bt_clock_class_get_name(
604 BT_TO_COMMON(stream_class
->clock
->clock_class
))));
608 static inline void format_event_class_common(char **buf_ch
, bool extended
,
609 const char *prefix
, struct bt_event_class_common
*event_class
,
610 format_func format_stream_class_func
,
611 format_func format_trace_func
)
613 struct bt_stream_class_common
*stream_class
;
614 struct bt_trace_common
*trace
;
617 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(event_class
->id
));
619 if (event_class
->name
) {
620 BUF_APPEND(", %sname=\"%s\"", PRFIELD(event_class
->name
->str
));
627 BUF_APPEND(", %sis-frozen=%d, %slog-level=%s",
628 PRFIELD(event_class
->frozen
),
629 PRFIELD(bt_common_event_class_log_level_string(event_class
->log_level
)));
631 if (event_class
->emf_uri
) {
632 BUF_APPEND(", %semf-uri=\"%s\"",
633 PRFIELD(event_class
->emf_uri
->str
));
636 BUF_APPEND(", %scontext-ft-addr=%p, %spayload-ft-addr=%p",
637 PRFIELD(event_class
->context_field_type
),
638 PRFIELD(event_class
->payload_field_type
));
640 stream_class
= bt_event_class_common_borrow_stream_class(event_class
);
645 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
646 SET_TMP_PREFIX("stream-class-");
647 format_stream_class_func(buf_ch
, false, tmp_prefix
, stream_class
);
648 trace
= bt_stream_class_common_borrow_trace(stream_class
);
653 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
654 SET_TMP_PREFIX("trace-");
655 format_trace_func(buf_ch
, false, tmp_prefix
, trace
);
658 static inline void format_event_class(char **buf_ch
, bool extended
,
659 const char *prefix
, struct bt_event_class
*event_class
)
663 format_event_class_common(buf_ch
, extended
, prefix
,
664 BT_TO_COMMON(event_class
), (format_func
) format_stream_class
,
665 (format_func
) format_trace
);
671 SET_TMP_PREFIX("event-pool-");
672 format_object_pool(buf_ch
, extended
, prefix
, &event_class
->event_pool
);
675 static inline void format_writer_event_class(char **buf_ch
, bool extended
,
676 const char *prefix
, struct bt_ctf_event_class
*event_class
)
678 format_event_class_common(buf_ch
, extended
, prefix
,
679 BT_TO_COMMON(event_class
),
680 (format_func
) format_writer_stream_class
,
681 (format_func
) format_writer_trace
);
684 static inline void format_stream_common(char **buf_ch
, bool extended
,
685 const char *prefix
, struct bt_stream_common
*stream
,
686 format_func format_stream_class_func
,
687 format_func format_trace_func
)
689 struct bt_stream_class_common
*stream_class
;
690 struct bt_trace_common
*trace
;
693 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(stream
->id
));
696 BUF_APPEND(", %sname=\"%s\"", PRFIELD(stream
->name
->str
));
703 stream_class
= bt_stream_common_borrow_class(stream
);
708 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
709 SET_TMP_PREFIX("stream-class-");
710 format_stream_class_func(buf_ch
, false, tmp_prefix
, stream_class
);
711 trace
= bt_stream_class_common_borrow_trace(stream_class
);
716 trace
= (void *) bt_object_borrow_parent(stream
);
721 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
722 SET_TMP_PREFIX("trace-");
723 format_trace_common(buf_ch
, false, tmp_prefix
, trace
);
726 static inline void format_stream(char **buf_ch
, bool extended
,
727 const char *prefix
, struct bt_stream
*stream
)
731 format_stream_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(stream
),
732 (format_func
) format_stream_class
,
733 (format_func
) format_trace
);
734 SET_TMP_PREFIX("packet-pool-");
735 format_object_pool(buf_ch
, extended
, prefix
, &stream
->packet_pool
);
738 static inline void format_writer_stream(char **buf_ch
, bool extended
,
739 const char *prefix
, struct bt_ctf_stream
*stream
)
741 format_stream_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(stream
),
742 (format_func
) format_writer_stream_class
,
743 (format_func
) format_writer_trace
);
745 BUF_APPEND(", %sheader-field-addr=%p, %scontext-field-addr=%p"
746 ", %sfd=%d, %smmap-offset=%zu, "
747 "%smmap-base-offset=%zu, %spacket-size=%" PRIu64
", "
748 "%soffset=%" PRId64
", %sevent-count=%u, "
749 "%sflushed-packet-count=%u, "
750 "%sdiscarded-event-count=%" PRIu64
", "
751 "%ssize=%" PRIu64
", %slast-ts-end=%" PRIu64
,
752 PRFIELD(stream
->packet_header
),
753 PRFIELD(stream
->packet_context
),
754 PRFIELD(stream
->pos
.fd
),
755 PRFIELD((size_t) stream
->pos
.mmap_offset
),
756 PRFIELD((size_t) stream
->pos
.mmap_base_offset
),
757 PRFIELD(stream
->pos
.packet_size
),
758 PRFIELD(stream
->pos
.offset
),
759 PRFIELD(stream
->events
->len
),
760 PRFIELD(stream
->flushed_packet_count
),
761 PRFIELD(stream
->discarded_events
),
762 PRFIELD(stream
->size
), PRFIELD(stream
->last_ts_end
));
764 if (stream
->events
) {
765 BUF_APPEND(", %sevent-count=%u", PRFIELD(stream
->events
->len
));
768 BUF_APPEND(", %sheader-field-addr=%p, %scontext-field-addr=%p"
769 ", %sfd=%d, %smmap-offset=%zu, "
770 "%smmap-base-offset=%zu, %spacket-size=%" PRIu64
", "
771 "%soffset=%" PRId64
", "
772 "%sflushed-packet-count=%u, "
773 "%sdiscarded-event-count=%" PRIu64
", "
774 "%ssize=%" PRIu64
", %slast-ts-end=%" PRIu64
,
775 PRFIELD(stream
->packet_header
),
776 PRFIELD(stream
->packet_context
),
777 PRFIELD(stream
->pos
.fd
),
778 PRFIELD((size_t) stream
->pos
.mmap_offset
),
779 PRFIELD((size_t) stream
->pos
.mmap_base_offset
),
780 PRFIELD(stream
->pos
.packet_size
),
781 PRFIELD(stream
->pos
.offset
),
782 PRFIELD(stream
->flushed_packet_count
),
783 PRFIELD(stream
->discarded_events
),
784 PRFIELD(stream
->size
), PRFIELD(stream
->last_ts_end
));
787 static inline void format_packet(char **buf_ch
, bool extended
,
788 const char *prefix
, struct bt_packet
*packet
)
790 struct bt_stream
*stream
;
791 struct bt_trace
*trace
;
798 BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, "
799 "%scontext-field-addr=%p",
800 PRFIELD(packet
->frozen
),
801 PRFIELD(packet
->header
? packet
->header
->field
: NULL
),
802 PRFIELD(packet
->context
));
803 stream
= bt_packet_borrow_stream(packet
);
808 BUF_APPEND(", %sstream-addr=%p", PRFIELD(stream
));
809 SET_TMP_PREFIX("stream-");
810 format_stream(buf_ch
, false, tmp_prefix
, stream
);
811 trace
= (struct bt_trace
*) bt_object_borrow_parent(stream
);
816 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
817 SET_TMP_PREFIX("trace-");
818 format_trace(buf_ch
, false, tmp_prefix
, trace
);
821 static inline void format_event_common(char **buf_ch
, bool extended
,
822 const char *prefix
, struct bt_event_common
*event
,
823 format_func format_event_class_func
,
824 format_func format_stream_class_func
,
825 format_func format_trace_func
)
827 struct bt_trace_common
*trace
;
828 struct bt_stream_class_common
*stream_class
;
835 BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, "
836 "%sstream-context-field-addr=%p, "
837 "%scontext-field-addr=%p, %spayload-field-addr=%p, ",
838 PRFIELD(event
->frozen
),
839 PRFIELD(event
->header_field
? event
->header_field
->field
: NULL
),
840 PRFIELD(event
->stream_event_context_field
),
841 PRFIELD(event
->context_field
),
842 PRFIELD(event
->payload_field
));
843 BUF_APPEND(", %sevent-class-addr=%p", PRFIELD(event
->class));
849 SET_TMP_PREFIX("event-class-");
850 format_event_class_func(buf_ch
, false, tmp_prefix
, event
->class);
851 stream_class
= bt_event_class_common_borrow_stream_class(event
->class);
853 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
854 SET_TMP_PREFIX("stream-class-");
855 format_stream_class_func(buf_ch
, false, tmp_prefix
,
858 trace
= bt_stream_class_common_borrow_trace(stream_class
);
860 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
861 SET_TMP_PREFIX("trace-");
862 format_trace_func(buf_ch
, false, tmp_prefix
, trace
);
867 static inline void format_event(char **buf_ch
, bool extended
,
868 const char *prefix
, struct bt_event
*event
)
870 struct bt_packet
*packet
;
871 struct bt_stream
*stream
;
874 format_event_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(event
),
875 (format_func
) format_event_class
,
876 (format_func
) format_stream_class
, (format_func
) format_trace
);
882 if (event
->clock_values
) {
883 BUF_APPEND(", %sclock-value-count=%u",
884 PRFIELD(g_hash_table_size(event
->clock_values
)));
887 packet
= bt_event_borrow_packet(event
);
892 BUF_APPEND(", %spacket-addr=%p", PRFIELD(packet
));
893 SET_TMP_PREFIX("packet-");
894 format_packet(buf_ch
, false, tmp_prefix
, packet
);
895 stream
= bt_packet_borrow_stream(packet
);
900 BUF_APPEND(", %sstream-addr=%p", PRFIELD(stream
));
901 SET_TMP_PREFIX("stream-");
902 format_stream(buf_ch
, false, tmp_prefix
, stream
);
905 static inline void format_writer_event(char **buf_ch
, bool extended
,
906 const char *prefix
, struct bt_event
*event
)
908 format_event_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(event
),
909 (format_func
) format_writer_event_class
,
910 (format_func
) format_writer_stream_class
,
911 (format_func
) format_writer_trace
);
914 static inline void format_clock_class(char **buf_ch
, bool extended
,
915 const char *prefix
, struct bt_clock_class
*clock_class
)
919 BUF_APPEND(", %sname=\"%s\", %sfreq=%" PRIu64
,
920 PRFIELD(clock_class
->name
->str
),
921 PRFIELD(clock_class
->frequency
));
927 if (clock_class
->description
) {
928 BUF_APPEND(", %spartial-description=\"%.32s\"",
929 PRFIELD(clock_class
->description
->str
));
932 BUF_APPEND(", %sis-frozen=%d, %sprecision=%" PRIu64
", "
933 "%soffset-s=%" PRId64
", "
934 "%soffset-cycles=%" PRId64
", %sis-absolute=%d",
935 PRFIELD(clock_class
->frozen
), PRFIELD(clock_class
->precision
),
936 PRFIELD(clock_class
->offset_s
), PRFIELD(clock_class
->offset
),
937 PRFIELD(clock_class
->absolute
));
939 if (clock_class
->uuid_set
) {
940 BUF_APPEND_UUID(clock_class
->uuid
);
943 SET_TMP_PREFIX("cv-pool-");
944 format_object_pool(buf_ch
, extended
, prefix
, &clock_class
->cv_pool
);
947 static inline void format_clock_value(char **buf_ch
, bool extended
,
948 const char *prefix
, struct bt_clock_value
*clock_value
)
951 BUF_APPEND(", %svalue=%" PRIu64
", %sns-from-epoch=%" PRId64
,
952 PRFIELD(clock_value
->value
),
953 PRFIELD(clock_value
->ns_from_epoch
));
959 BUF_APPEND(", %sis-frozen=%d, %sis-set=%d",
960 PRFIELD(clock_value
->frozen
), PRFIELD(clock_value
->is_set
));
961 BUF_APPEND(", %sclock-class-addr=%p",
962 PRFIELD(clock_value
->clock_class
));
963 SET_TMP_PREFIX("clock-class-");
964 format_clock_class(buf_ch
, false, tmp_prefix
, clock_value
->clock_class
);
967 static inline void format_value(char **buf_ch
, bool extended
,
968 const char *prefix
, struct bt_value
*value
)
970 BUF_APPEND(", %stype=%s",
971 PRFIELD(bt_value_type_string(bt_value_get_type(value
))));
977 switch (bt_value_get_type(value
)) {
978 case BT_VALUE_TYPE_BOOL
:
982 (void) bt_value_bool_get(value
, &val
);
983 BUF_APPEND(", %svalue=%d", PRFIELD(val
));
986 case BT_VALUE_TYPE_INTEGER
:
990 (void) bt_value_integer_get(value
, &val
);
991 BUF_APPEND(", %svalue=%" PRId64
, PRFIELD(val
));
994 case BT_VALUE_TYPE_FLOAT
:
998 (void) bt_value_float_get(value
, &val
);
999 BUF_APPEND(", %svalue=%f", PRFIELD(val
));
1002 case BT_VALUE_TYPE_STRING
:
1006 (void) bt_value_string_get(value
, &val
);
1007 BUF_APPEND(", %spartial-value=\"%.32s\"", PRFIELD(val
));
1010 case BT_VALUE_TYPE_ARRAY
:
1012 int64_t count
= bt_value_array_size(value
);
1014 BT_ASSERT(count
>= 0);
1015 BUF_APPEND(", %selement-count=%" PRId64
, PRFIELD(count
));
1018 case BT_VALUE_TYPE_MAP
:
1020 int64_t count
= bt_value_map_size(value
);
1022 BT_ASSERT(count
>= 0);
1023 BUF_APPEND(", %selement-count=%" PRId64
, PRFIELD(count
));
1031 static inline void format_notification(char **buf_ch
, bool extended
,
1032 const char *prefix
, struct bt_notification
*notif
)
1034 char tmp_prefix
[64];
1036 BUF_APPEND(", %stype=%s",
1037 PRFIELD(bt_notification_type_string(notif
->type
)));
1043 BUF_APPEND(", %sis-frozen=%d, %sgraph-addr=%p",
1044 PRFIELD(notif
->frozen
), PRFIELD(notif
->graph
));
1046 switch (notif
->type
) {
1047 case BT_NOTIFICATION_TYPE_EVENT
:
1049 struct bt_notification_event
*notif_event
= (void *) notif
;
1051 SET_TMP_PREFIX("event-");
1052 format_event(buf_ch
, true, tmp_prefix
, notif_event
->event
);
1054 if (!notif_event
->cc_prio_map
) {
1058 BUF_APPEND(", %scc-prio-map-addr=%p, %scc-prio-map-cc-count=%u",
1059 PRFIELD(notif_event
->cc_prio_map
),
1060 PRFIELD(notif_event
->cc_prio_map
->entries
->len
));
1063 case BT_NOTIFICATION_TYPE_INACTIVITY
:
1065 struct bt_notification_inactivity
*notif_inactivity
=
1068 if (!notif_inactivity
->cc_prio_map
) {
1072 BUF_APPEND(", %scc-prio-map-addr=%p, %scc-prio-map-cc-count=%u",
1073 PRFIELD(notif_inactivity
->cc_prio_map
),
1074 PRFIELD(notif_inactivity
->cc_prio_map
->entries
->len
));
1077 case BT_NOTIFICATION_TYPE_STREAM_BEGIN
:
1079 struct bt_notification_stream_begin
*notif_stream
=
1082 SET_TMP_PREFIX("stream-");
1083 format_stream(buf_ch
, true, tmp_prefix
, notif_stream
->stream
);
1086 case BT_NOTIFICATION_TYPE_STREAM_END
:
1088 struct bt_notification_stream_end
*notif_stream
=
1091 SET_TMP_PREFIX("stream-");
1092 format_stream(buf_ch
, true, tmp_prefix
, notif_stream
->stream
);
1095 case BT_NOTIFICATION_TYPE_PACKET_BEGIN
:
1097 struct bt_notification_packet_begin
*notif_packet
=
1100 SET_TMP_PREFIX("packet-");
1101 format_packet(buf_ch
, true, tmp_prefix
, notif_packet
->packet
);
1104 case BT_NOTIFICATION_TYPE_PACKET_END
:
1106 struct bt_notification_packet_end
*notif_packet
=
1109 SET_TMP_PREFIX("packet-");
1110 format_packet(buf_ch
, true, tmp_prefix
, notif_packet
->packet
);
1113 case BT_NOTIFICATION_TYPE_DISCARDED_EVENTS
:
1114 case BT_NOTIFICATION_TYPE_DISCARDED_PACKETS
:
1116 struct bt_notification_discarded_elements
*notif_discarded
=
1119 BUF_APPEND(", %scount=%" PRId64
,
1120 PRFIELD(notif_discarded
->count
));
1122 if (notif_discarded
->begin_clock_value
) {
1123 SET_TMP_PREFIX("begin-clock-value-");
1124 format_clock_value(buf_ch
, true, tmp_prefix
,
1125 notif_discarded
->begin_clock_value
);
1128 if (notif_discarded
->end_clock_value
) {
1129 SET_TMP_PREFIX("end-clock-value-");
1130 format_clock_value(buf_ch
, true, tmp_prefix
,
1131 notif_discarded
->end_clock_value
);
1140 static inline void format_plugin_so_shared_lib_handle(char **buf_ch
,
1142 struct bt_plugin_so_shared_lib_handle
*handle
)
1144 BUF_APPEND(", %saddr=%p", PRFIELD(handle
));
1147 BUF_APPEND(", %spath=\"%s\"", PRFIELD(handle
->path
->str
));
1151 static inline void format_component_class(char **buf_ch
, bool extended
,
1152 const char *prefix
, struct bt_component_class
*comp_class
)
1154 char tmp_prefix
[64];
1156 BUF_APPEND(", %stype=%s, %sname=\"%s\"",
1157 PRFIELD(bt_component_class_type_string(comp_class
->type
)),
1158 PRFIELD(comp_class
->name
? comp_class
->name
->str
: NULL
));
1160 if (comp_class
->description
) {
1161 BUF_APPEND(", %spartial-descr=\"%.32s\"",
1162 PRFIELD(comp_class
->description
->str
));
1169 BUF_APPEND(", %sis-frozen=%d", PRFIELD(comp_class
->frozen
));
1171 if (comp_class
->so_handle
) {
1172 SET_TMP_PREFIX("so-handle-");
1173 format_plugin_so_shared_lib_handle(buf_ch
, tmp_prefix
,
1174 comp_class
->so_handle
);
1178 static inline void format_component(char **buf_ch
, bool extended
,
1179 const char *prefix
, struct bt_component
*component
)
1181 char tmp_prefix
[64];
1183 BUF_APPEND(", %sname=\"%s\"", PRFIELD(component
->name
->str
));
1184 SET_TMP_PREFIX("class-");
1185 format_component_class(buf_ch
, extended
, tmp_prefix
, component
->class);
1191 if (component
->input_ports
) {
1192 BUF_APPEND(", %sinput-port-count=%u",
1193 PRFIELD(component
->input_ports
->len
));
1196 if (component
->output_ports
) {
1197 BUF_APPEND(", %soutput-port-count=%u",
1198 PRFIELD(component
->output_ports
->len
));
1202 static inline void format_port(char **buf_ch
, bool extended
,
1203 const char *prefix
, struct bt_port
*port
)
1205 char tmp_prefix
[64];
1207 BUF_APPEND(", %stype=%s, %sname=\"%s\"",
1208 PRFIELD(bt_port_type_string(port
->type
)),
1209 PRFIELD(port
->name
->str
));
1215 if (port
->connection
) {
1216 SET_TMP_PREFIX("conn-");
1217 format_connection(buf_ch
, false, tmp_prefix
, port
->connection
);
1221 static inline void format_connection(char **buf_ch
, bool extended
,
1222 const char *prefix
, struct bt_connection
*connection
)
1224 char tmp_prefix
[64];
1230 if (connection
->upstream_port
) {
1231 SET_TMP_PREFIX("upstream-port-");
1232 format_port(buf_ch
, false, tmp_prefix
,
1233 connection
->upstream_port
);
1236 if (connection
->downstream_port
) {
1237 SET_TMP_PREFIX("downstream-port-");
1238 format_port(buf_ch
, false, tmp_prefix
,
1239 connection
->downstream_port
);
1243 static inline void format_graph(char **buf_ch
, bool extended
,
1244 const char *prefix
, struct bt_graph
*graph
)
1246 char tmp_prefix
[64];
1248 BUF_APPEND(", %sis-canceled=%d", PRFIELD(graph
->canceled
));
1254 if (graph
->components
) {
1255 BUF_APPEND(", %scomp-count=%u",
1256 PRFIELD(graph
->components
->len
));
1259 if (graph
->connections
) {
1260 BUF_APPEND(", %sconn-count=%u",
1261 PRFIELD(graph
->connections
->len
));
1264 SET_TMP_PREFIX("en-pool-");
1265 format_object_pool(buf_ch
, extended
, prefix
,
1266 &graph
->event_notif_pool
);
1267 SET_TMP_PREFIX("pbn-pool-");
1268 format_object_pool(buf_ch
, extended
, prefix
,
1269 &graph
->packet_begin_notif_pool
);
1270 SET_TMP_PREFIX("pen-pool-");
1271 format_object_pool(buf_ch
, extended
, prefix
,
1272 &graph
->packet_end_notif_pool
);
1275 static inline void format_notification_iterator(char **buf_ch
,
1276 bool extended
, const char *prefix
,
1277 struct bt_notification_iterator
*iterator
)
1280 char tmp_prefix
[64];
1282 if (iterator
->type
== BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION
) {
1283 type
= "BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION";
1284 } else if (iterator
->type
== BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT
) {
1285 type
= "BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT";
1290 BUF_APPEND(", %stype=%s", PRFIELD(type
));
1292 switch (iterator
->type
) {
1293 case BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION
:
1295 struct bt_notification_iterator_private_connection
*
1296 iter_priv_conn
= (void *) iterator
;
1298 if (iter_priv_conn
->upstream_component
) {
1299 SET_TMP_PREFIX("upstream-comp-");
1300 format_component(buf_ch
, false, tmp_prefix
,
1301 iter_priv_conn
->upstream_component
);
1304 if (iter_priv_conn
->upstream_port
) {
1305 SET_TMP_PREFIX("upstream-port-");
1306 format_port(buf_ch
, false, tmp_prefix
,
1307 iter_priv_conn
->upstream_port
);
1310 if (iter_priv_conn
->connection
) {
1311 SET_TMP_PREFIX("upstream-conn-");
1312 format_connection(buf_ch
, false, tmp_prefix
,
1313 iter_priv_conn
->connection
);
1317 case BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT
:
1319 struct bt_notification_iterator_output_port
*iter_output_port
=
1322 SET_TMP_PREFIX("graph-");
1323 format_graph(buf_ch
, false, tmp_prefix
,
1324 iter_output_port
->graph
);
1325 SET_TMP_PREFIX("colander-comp-");
1326 format_component(buf_ch
, false, tmp_prefix
,
1327 iter_output_port
->colander
);
1335 static inline void format_plugin(char **buf_ch
, bool extended
,
1336 const char *prefix
, struct bt_plugin
*plugin
)
1338 char tmp_prefix
[64];
1340 BUF_APPEND(", %stype=%s", PRFIELD(bt_plugin_type_string(plugin
->type
)));
1342 if (plugin
->info
.path_set
) {
1343 BUF_APPEND(", %spath=\"%s\"",
1344 PRFIELD(plugin
->info
.path
->str
));
1347 if (plugin
->info
.name_set
) {
1348 BUF_APPEND(", %sname=\"%s\"",
1349 PRFIELD(plugin
->info
.name
->str
));
1356 if (plugin
->info
.author_set
) {
1357 BUF_APPEND(", %sauthor=\"%s\"",
1358 PRFIELD(plugin
->info
.author
->str
));
1361 if (plugin
->info
.license_set
) {
1362 BUF_APPEND(", %slicense=\"%s\"",
1363 PRFIELD(plugin
->info
.license
->str
));
1366 if (plugin
->info
.version_set
) {
1367 BUF_APPEND(", %sversion=%u.%u.%u%s",
1368 PRFIELD(plugin
->info
.version
.major
),
1369 plugin
->info
.version
.minor
,
1370 plugin
->info
.version
.patch
,
1371 plugin
->info
.version
.extra
?
1372 plugin
->info
.version
.extra
->str
: "");
1375 BUF_APPEND(", %sis-frozen=%d, %scomp-class-count=%u",
1376 PRFIELD(plugin
->frozen
),
1377 PRFIELD(plugin
->comp_classes
->len
));
1379 if (plugin
->spec_data
) {
1380 struct bt_plugin_so_spec_data
*spec_data
=
1381 (void *) plugin
->spec_data
;
1383 if (spec_data
->shared_lib_handle
) {
1384 SET_TMP_PREFIX("so-handle-");
1385 format_plugin_so_shared_lib_handle(buf_ch
, tmp_prefix
,
1386 spec_data
->shared_lib_handle
);
1391 static inline void format_ctf_writer(char **buf_ch
, bool extended
,
1392 const char *prefix
, struct bt_ctf_writer
*writer
)
1397 static inline void format_stream_class_common_common(char **buf_ch
,
1398 bool extended
, const char *prefix
,
1399 struct bt_stream_class_common
*stream_class
)
1401 format_stream_class_common(buf_ch
, extended
, prefix
, stream_class
,
1402 (format_func
) format_trace_common
);
1405 static inline void format_event_class_common_common(char **buf_ch
,
1406 bool extended
, const char *prefix
,
1407 struct bt_event_class_common
*event_class
)
1409 format_event_class_common(buf_ch
, extended
, prefix
, event_class
,
1410 (format_func
) format_stream_class_common
,
1411 (format_func
) format_trace_common
);
1414 static inline void format_event_common_common(char **buf_ch
,
1415 bool extended
, const char *prefix
,
1416 struct bt_event_common
*event
)
1418 format_event_common(buf_ch
, extended
, prefix
, event
,
1419 (format_func
) format_event_class_common
,
1420 (format_func
) format_stream_class_common
,
1421 (format_func
) format_trace_common
);
1424 static inline void format_stream_common_common(char **buf_ch
, bool extended
,
1425 const char *prefix
, struct bt_stream_common
*stream
)
1427 format_stream_common(buf_ch
, extended
, prefix
, stream
,
1428 (format_func
) format_stream_class_common
,
1429 (format_func
) format_trace_common
);
1432 static inline void handle_conversion_specifier_bt(void *priv_data
,
1433 char **buf_ch
, size_t avail_size
,
1434 const char **out_fmt_ch
, va_list *args
)
1436 const char *fmt_ch
= *out_fmt_ch
;
1437 bool extended
= false;
1439 char *prefix_ch
= prefix
;
1445 } cat
= CAT_DEFAULT
;
1450 if (*fmt_ch
== '[') {
1455 if (*fmt_ch
== ']') {
1461 *prefix_ch
= *fmt_ch
;
1469 if (*fmt_ch
== '+') {
1474 if (*fmt_ch
== 'w') {
1477 } else if (*fmt_ch
== '_') {
1482 obj
= va_arg(*args
, void *);
1483 BUF_APPEND("%saddr=%p", prefix
, obj
);
1493 format_ref_count(buf_ch
, extended
, prefix
, obj
);
1496 format_field_type(buf_ch
, extended
, prefix
, obj
);
1499 format_field(buf_ch
, extended
, prefix
, obj
);
1502 format_field_path(buf_ch
, extended
, prefix
, obj
);
1505 format_event_class(buf_ch
, extended
, prefix
, obj
);
1508 format_event(buf_ch
, extended
, prefix
, obj
);
1511 format_stream_class(buf_ch
, extended
, prefix
, obj
);
1514 format_stream(buf_ch
, extended
, prefix
, obj
);
1517 format_packet(buf_ch
, extended
, prefix
, obj
);
1520 format_trace(buf_ch
, extended
, prefix
, obj
);
1523 format_clock_class(buf_ch
, extended
, prefix
, obj
);
1526 format_clock_value(buf_ch
, extended
, prefix
, obj
);
1529 format_value(buf_ch
, extended
, prefix
, obj
);
1532 format_notification(buf_ch
, extended
, prefix
, obj
);
1535 format_notification_iterator(buf_ch
, extended
, prefix
, obj
);
1538 format_component_class(buf_ch
, extended
, prefix
, obj
);
1541 format_component(buf_ch
, extended
, prefix
, obj
);
1544 format_port(buf_ch
, extended
, prefix
, obj
);
1547 format_connection(buf_ch
, extended
, prefix
, obj
);
1550 format_plugin(buf_ch
, extended
, prefix
, obj
);
1553 format_graph(buf_ch
, extended
, prefix
, obj
);
1556 format_object_pool(buf_ch
, extended
, prefix
, obj
);
1565 format_writer_field_type(buf_ch
, extended
, prefix
, obj
);
1568 format_writer_field(buf_ch
, extended
, prefix
, obj
);
1571 format_writer_event_class(buf_ch
, extended
, prefix
, obj
);
1574 format_writer_event(buf_ch
, extended
, prefix
, obj
);
1577 format_writer_stream_class(buf_ch
, extended
, prefix
, obj
);
1580 format_writer_stream(buf_ch
, extended
, prefix
, obj
);
1583 format_writer_trace(buf_ch
, extended
, prefix
, obj
);
1586 format_ctf_writer(buf_ch
, extended
, prefix
, obj
);
1595 format_field_type_common(buf_ch
, extended
, prefix
, obj
);
1598 format_field_common(buf_ch
, extended
, prefix
, obj
);
1601 format_event_class_common_common(buf_ch
, extended
, prefix
, obj
);
1604 format_event_common_common(buf_ch
, extended
, prefix
, obj
);
1607 format_stream_class_common_common(buf_ch
, extended
, prefix
, obj
);
1610 format_stream_common_common(buf_ch
, extended
, prefix
, obj
);
1613 format_trace_common(buf_ch
, extended
, prefix
, obj
);
1623 *out_fmt_ch
= fmt_ch
;
1627 void bt_lib_log(const char *func
, const char *file
, unsigned line
,
1628 int lvl
, const char *tag
, const char *fmt
, ...)
1633 va_start(args
, fmt
);
1634 bt_common_custom_vsnprintf(lib_logging_buf
, LIB_LOGGING_BUF_SIZE
, '!',
1635 handle_conversion_specifier_bt
, NULL
, fmt
, &args
);
1637 _bt_log_write_d(func
, file
, line
, lvl
, tag
, "%s", lib_logging_buf
);