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/values-internal.h>
36 #include <babeltrace/object-pool-internal.h>
37 #include <babeltrace/ctf-ir/field-types-internal.h>
38 #include <babeltrace/ctf-ir/fields-internal.h>
39 #include <babeltrace/ctf-ir/event-class-internal.h>
40 #include <babeltrace/ctf-ir/event-internal.h>
41 #include <babeltrace/ctf-ir/packet-internal.h>
42 #include <babeltrace/ctf-ir/stream-class-internal.h>
43 #include <babeltrace/ctf-ir/stream-internal.h>
44 #include <babeltrace/ctf-ir/trace-internal.h>
45 #include <babeltrace/ctf-ir/clock-class-internal.h>
46 #include <babeltrace/ctf-ir/clock-value-internal.h>
47 #include <babeltrace/ctf-ir/field-path-internal.h>
48 #include <babeltrace/ctf-ir/utils-internal.h>
49 #include <babeltrace/ctf-writer/field-types-internal.h>
50 #include <babeltrace/ctf-writer/fields-internal.h>
51 #include <babeltrace/ctf-writer/event-internal.h>
52 #include <babeltrace/ctf-writer/stream-class-internal.h>
53 #include <babeltrace/ctf-writer/stream-internal.h>
54 #include <babeltrace/ctf-writer/trace-internal.h>
55 #include <babeltrace/ctf-writer/clock-internal.h>
56 #include <babeltrace/ctf-writer/writer-internal.h>
57 #include <babeltrace/graph/component-class-internal.h>
58 #include <babeltrace/graph/component-class-sink-colander-internal.h>
59 #include <babeltrace/graph/component-filter-internal.h>
60 #include <babeltrace/graph/component-internal.h>
61 #include <babeltrace/graph/component-sink-internal.h>
62 #include <babeltrace/graph/component-source-internal.h>
63 #include <babeltrace/graph/connection-internal.h>
64 #include <babeltrace/graph/graph-internal.h>
65 #include <babeltrace/graph/notification-event-internal.h>
66 #include <babeltrace/graph/notification-inactivity-internal.h>
67 #include <babeltrace/graph/notification-internal.h>
68 #include <babeltrace/graph/notification-iterator-internal.h>
69 #include <babeltrace/graph/notification-packet-internal.h>
70 #include <babeltrace/graph/notification-stream-internal.h>
71 #include <babeltrace/graph/port-internal.h>
72 #include <babeltrace/plugin/plugin-internal.h>
73 #include <babeltrace/plugin/plugin-so-internal.h>
75 #define LIB_LOGGING_BUF_SIZE (4096 * 4)
77 static char __thread lib_logging_buf
[LIB_LOGGING_BUF_SIZE
];
79 #define BUF_APPEND(_fmt, ...) \
82 size_t _size = LIB_LOGGING_BUF_SIZE - \
83 (size_t) (*buf_ch - lib_logging_buf); \
84 _count = snprintf(*buf_ch, _size, (_fmt), __VA_ARGS__); \
85 BT_ASSERT(_count >= 0); \
86 *buf_ch += MIN(_count, _size); \
87 if (*buf_ch >= lib_logging_buf + LIB_LOGGING_BUF_SIZE - 1) { \
92 #define BUF_APPEND_UUID(_uuid) \
93 BUF_APPEND(", %suuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\"", \
95 (unsigned int) (_uuid)[0], \
96 (unsigned int) (_uuid)[1], \
97 (unsigned int) (_uuid)[2], \
98 (unsigned int) (_uuid)[3], \
99 (unsigned int) (_uuid)[4], \
100 (unsigned int) (_uuid)[5], \
101 (unsigned int) (_uuid)[6], \
102 (unsigned int) (_uuid)[7], \
103 (unsigned int) (_uuid)[8], \
104 (unsigned int) (_uuid)[9], \
105 (unsigned int) (_uuid)[10], \
106 (unsigned int) (_uuid)[11], \
107 (unsigned int) (_uuid)[12], \
108 (unsigned int) (_uuid)[13], \
109 (unsigned int) (_uuid)[14], \
110 (unsigned int) (_uuid)[15])
112 #define PRFIELD(_expr) prefix, (_expr)
114 #define SET_TMP_PREFIX(_prefix2) \
116 strcpy(tmp_prefix, prefix); \
117 strcat(tmp_prefix, (_prefix2)); \
120 typedef void (*format_func
)(char **, bool, const char *, void *);
122 static inline void format_component(char **buf_ch
, bool extended
,
123 const char *prefix
, struct bt_component
*component
);
125 static inline void format_port(char **buf_ch
, bool extended
,
126 const char *prefix
, struct bt_port
*port
);
128 static inline void format_connection(char **buf_ch
, bool extended
,
129 const char *prefix
, struct bt_connection
*connection
);
131 static inline void format_clock_value(char **buf_ch
, bool extended
,
132 const char *prefix
, struct bt_clock_value
*clock_value
);
134 static inline void format_object(char **buf_ch
, bool extended
,
135 const char *prefix
, struct bt_object
*obj
)
137 BUF_APPEND(", %sref-count=%llu", prefix
, obj
->ref_count
);
140 static inline void format_clock_value_set(char **buf_ch
, bool extended
,
141 const char *prefix
, struct bt_clock_value_set
*cv_set
)
145 if (!cv_set
->clock_values
) {
149 BUF_APPEND(", %ssize=%u", PRFIELD(cv_set
->clock_values
->len
));
151 if (cv_set
->default_cv
) {
152 SET_TMP_PREFIX("default-cv-");
153 format_clock_value(buf_ch
, extended
, tmp_prefix
,
158 static inline void format_object_pool(char **buf_ch
, bool extended
,
159 const char *prefix
, struct bt_object_pool
*pool
)
161 BUF_APPEND(", %ssize=%zu", PRFIELD(pool
->size
));
164 BUF_APPEND(", %scap=%u", PRFIELD(pool
->objects
->len
));
168 static inline void format_field_type_common(char **buf_ch
, bool extended
,
169 const char *prefix
, struct bt_field_type_common
*field_type
)
171 BUF_APPEND(", %stype-id=%s, %salignment=%u",
172 PRFIELD(bt_common_field_type_id_string(field_type
->id
)),
173 PRFIELD(field_type
->alignment
));
176 BUF_APPEND(", %sis-frozen=%d", PRFIELD(field_type
->frozen
));
181 if (field_type
->id
== BT_FIELD_TYPE_ID_UNKNOWN
) {
185 switch (field_type
->id
) {
186 case BT_FIELD_TYPE_ID_INTEGER
:
188 struct bt_field_type_common_integer
*integer
=
189 BT_FROM_COMMON(field_type
);
191 BUF_APPEND(", %ssize=%u, %sis-signed=%d, %sbyte-order=%s, "
192 "%sbase=%d, %sencoding=%s, "
193 "%smapped-clock-class-addr=%p",
194 PRFIELD(integer
->size
), PRFIELD(integer
->is_signed
),
195 PRFIELD(bt_common_byte_order_string(integer
->user_byte_order
)),
196 PRFIELD(integer
->base
),
197 PRFIELD(bt_common_string_encoding_string(integer
->encoding
)),
198 PRFIELD(integer
->mapped_clock_class
));
200 if (integer
->mapped_clock_class
) {
201 BUF_APPEND(", %smapped-clock-class-name=\"%s\"",
202 PRFIELD(bt_clock_class_get_name(integer
->mapped_clock_class
)));
206 case BT_FIELD_TYPE_ID_FLOAT
:
208 struct bt_field_type_common_floating_point
*flt
=
209 BT_FROM_COMMON(field_type
);
211 BUF_APPEND(", %sexp-dig=%u, %smant-dig=%u, %sbyte-order=%s",
212 PRFIELD(flt
->exp_dig
), PRFIELD(flt
->mant_dig
),
213 PRFIELD(bt_common_byte_order_string(flt
->user_byte_order
)));
216 case BT_FIELD_TYPE_ID_ENUM
:
218 struct bt_field_type_common_enumeration
*enm
=
219 BT_FROM_COMMON(field_type
);
221 BUF_APPEND(", %smapping-count=%u",
222 PRFIELD(enm
->entries
->len
));
225 case BT_FIELD_TYPE_ID_STRING
:
227 struct bt_field_type_common_string
*str
=
228 BT_FROM_COMMON(field_type
);
230 BUF_APPEND(", %sencoding=%s",
231 PRFIELD(bt_common_string_encoding_string(str
->encoding
)));
234 case BT_FIELD_TYPE_ID_STRUCT
:
236 struct bt_field_type_common_structure
*structure
=
237 BT_FROM_COMMON(field_type
);
239 BUF_APPEND(", %sfield-count=%u",
240 PRFIELD(structure
->fields
->len
));
243 case BT_FIELD_TYPE_ID_SEQUENCE
:
245 struct bt_field_type_common_sequence
*seq
=
246 BT_FROM_COMMON(field_type
);
248 BUF_APPEND(", %slength-ft-addr=\"%s\", %selem-ft-addr=%p",
249 PRFIELD(seq
->length_field_name
->str
),
250 PRFIELD(seq
->element_ft
));
253 case BT_FIELD_TYPE_ID_VARIANT
:
255 struct bt_field_type_common_variant
*variant
=
256 BT_FROM_COMMON(field_type
);
258 BUF_APPEND(", %stag-name=\"%s\", %sfield-count=%u",
259 PRFIELD(variant
->tag_name
->str
),
260 PRFIELD(variant
->choices
->len
));
268 static inline void format_field_type(char **buf_ch
, bool extended
,
269 const char *prefix
, struct bt_field_type
*field_type
)
271 format_field_type_common(buf_ch
, extended
, prefix
,
272 (void *) field_type
);
275 static inline void format_writer_field_type(char **buf_ch
, bool extended
,
276 const char *prefix
, struct bt_ctf_field_type
*field_type
)
278 format_field_type_common(buf_ch
, extended
, prefix
,
279 (void *) field_type
);
282 static inline void format_field_common_integer_extended(char **buf_ch
,
283 const char *prefix
, struct bt_field_common
*field
)
285 struct bt_field_common_integer
*integer
= BT_FROM_COMMON(field
);
286 struct bt_field_type_common_integer
*field_type
=
287 BT_FROM_COMMON(field
->type
);
288 const char *fmt
= NULL
;
290 BT_ASSERT(field_type
);
292 if (field_type
->base
== 8) {
293 fmt
= ", %svalue=%" PRIo64
;
294 } else if (field_type
->base
== 16) {
295 fmt
= ", %svalue=%" PRIx64
;
298 if (field_type
->is_signed
) {
300 fmt
= ", %svalue=%" PRId64
;
303 BUF_APPEND(fmt
, PRFIELD(integer
->payload
.signd
));
306 fmt
= ", %svalue=%" PRIu64
;
309 BUF_APPEND(fmt
, PRFIELD(integer
->payload
.unsignd
));
313 static inline void format_field_common(char **buf_ch
, bool extended
,
314 const char *prefix
, struct bt_field_common
*field
)
316 BUF_APPEND(", %sis-set=%d", PRFIELD(field
->payload_set
));
319 BUF_APPEND(", %sis-frozen=%d", PRFIELD(field
->frozen
));
322 BUF_APPEND(", %stype-addr=%p", PRFIELD(field
->type
));
328 BUF_APPEND(", %stype-id=%s",
329 PRFIELD(bt_common_field_type_id_string(field
->type
->id
)));
331 if (!extended
|| field
->type
->id
== BT_FIELD_TYPE_ID_UNKNOWN
||
332 !field
->payload_set
) {
336 switch (field
->type
->id
) {
337 case BT_FIELD_TYPE_ID_INTEGER
:
339 format_field_common_integer_extended(buf_ch
, prefix
, field
);
342 case BT_FIELD_TYPE_ID_FLOAT
:
344 struct bt_field_common_floating_point
*flt
=
345 BT_FROM_COMMON(field
);
347 BUF_APPEND(", %svalue=%f", PRFIELD(flt
->payload
));
350 case BT_FIELD_TYPE_ID_STRING
:
352 struct bt_field_common_string
*str
=
353 BT_FROM_COMMON(field
);
356 BT_ASSERT(str
->buf
->data
);
357 BUF_APPEND(", %spartial-value=\"%.32s\"",
358 PRFIELD(str
->buf
->data
));
363 case BT_FIELD_TYPE_ID_SEQUENCE
:
365 struct bt_field_common_sequence
*seq
=
366 BT_FROM_COMMON(field
);
368 BUF_APPEND(", %slength=%" PRIu64
, PRFIELD(seq
->length
));
371 BUF_APPEND(", %sallocated-length=%u",
372 PRFIELD(seq
->elements
->len
));
376 case BT_FIELD_TYPE_ID_VARIANT
:
378 struct bt_field_common_variant
*variant
=
379 BT_FROM_COMMON(field
);
381 BUF_APPEND(", %scur-field-addr=%p",
382 PRFIELD(variant
->current_field
));
390 static inline void format_field(char **buf_ch
, bool extended
,
391 const char *prefix
, struct bt_field
*field
)
393 struct bt_field_common
*common_field
= (void *) field
;
395 format_field_common(buf_ch
, extended
, prefix
, (void *) field
);
401 if (!common_field
->type
) {
405 switch (common_field
->type
->id
) {
406 case BT_FIELD_TYPE_ID_ENUM
:
408 struct bt_field_common_integer
*integer
= (void *) field
;
409 struct bt_field_type_common_enumeration
*enum_ft
=
410 BT_FROM_COMMON(common_field
->type
);
412 if (enum_ft
->container_ft
) {
413 if (enum_ft
->container_ft
->is_signed
) {
414 BUF_APPEND(", %svalue=%" PRId64
,
415 PRFIELD(integer
->payload
.signd
));
417 BUF_APPEND(", %svalue=%" PRIu64
,
418 PRFIELD(integer
->payload
.unsignd
));
428 static inline void format_writer_field(char **buf_ch
, bool extended
,
429 const char *prefix
, struct bt_ctf_field
*field
)
431 struct bt_field_common
*common_field
= (void *) field
;
433 format_field_common(buf_ch
, extended
, prefix
, (void *) field
);
439 if (!common_field
->type
) {
443 switch (common_field
->type
->id
) {
444 case BT_FIELD_TYPE_ID_ENUM
:
446 struct bt_ctf_field_enumeration
*enumeration
= (void *) field
;
448 if (enumeration
->container
) {
449 format_writer_field(buf_ch
, extended
, prefix
,
450 (void *) enumeration
->container
);
454 case BT_FIELD_TYPE_ID_VARIANT
:
456 struct bt_ctf_field_variant
*variant
= (void *) field
;
458 BUF_APPEND(", %stag-field-addr=%p", PRFIELD(variant
->tag
));
466 static inline void format_field_path(char **buf_ch
, bool extended
,
467 const char *prefix
, struct bt_field_path
*field_path
)
471 if (field_path
->indexes
) {
472 BT_ASSERT(field_path
->indexes
);
473 BUF_APPEND(", %sindex-count=%u", PRFIELD(field_path
->indexes
->len
));
476 if (!extended
|| !field_path
->indexes
) {
480 BUF_APPEND(", %spath=[%s", PRFIELD(bt_common_scope_string(field_path
->root
)));
482 for (i
= 0; i
< field_path
->indexes
->len
; i
++) {
483 int index
= g_array_index(field_path
->indexes
, int, i
);
485 BUF_APPEND(", %d", index
);
488 BUF_APPEND("%s", "]");
491 static inline void format_trace_common(char **buf_ch
, bool extended
,
492 const char *prefix
, struct bt_trace_common
*trace
)
495 BUF_APPEND(", %sname=\"%s\"", PRFIELD(trace
->name
->str
));
502 BUF_APPEND(", %sis-frozen=%d", PRFIELD(trace
->frozen
));
504 if (trace
->uuid_set
) {
505 BUF_APPEND_UUID(trace
->uuid
);
508 if (trace
->clock_classes
) {
509 BUF_APPEND(", %sclock-class-count=%u",
510 PRFIELD(trace
->clock_classes
->len
));
513 if (trace
->stream_classes
) {
514 BUF_APPEND(", %sstream-class-count=%u",
515 PRFIELD(trace
->stream_classes
->len
));
518 if (trace
->streams
) {
519 BUF_APPEND(", %sstream-count=%u",
520 PRFIELD(trace
->streams
->len
));
523 BUF_APPEND(", %spacket-header-ft-addr=%p",
524 PRFIELD(trace
->packet_header_field_type
));
527 static inline void format_trace(char **buf_ch
, bool extended
,
528 const char *prefix
, struct bt_trace
*trace
)
532 format_trace_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(trace
));
538 BUF_APPEND(", %sis-static=%d", PRFIELD(trace
->is_static
));
539 SET_TMP_PREFIX("phf-pool-");
540 format_object_pool(buf_ch
, extended
, prefix
,
541 &trace
->packet_header_field_pool
);
544 static inline void format_writer_trace(char **buf_ch
, bool extended
,
545 const char *prefix
, struct bt_ctf_trace
*trace
)
547 format_trace_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(trace
));
550 static inline void format_stream_class_common(char **buf_ch
, bool extended
,
551 const char *prefix
, struct bt_stream_class_common
*stream_class
,
552 format_func trace_format_func
)
554 struct bt_trace_common
*trace
;
557 if (stream_class
->id_set
) {
558 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(stream_class
->id
));
561 if (stream_class
->name
) {
562 BUF_APPEND(", %sname=\"%s\"", PRFIELD(stream_class
->name
->str
));
569 BUF_APPEND(", %sis-frozen=%d", PRFIELD(stream_class
->frozen
));
571 if (stream_class
->event_classes
) {
572 BUF_APPEND(", %sevent-class-count=%u",
573 PRFIELD(stream_class
->event_classes
->len
));
576 BUF_APPEND(", %spacket-context-ft-addr=%p, "
577 "%sevent-header-ft-addr=%p, %sevent-context-ft-addr=%p",
578 PRFIELD(stream_class
->packet_context_field_type
),
579 PRFIELD(stream_class
->event_header_field_type
),
580 PRFIELD(stream_class
->event_context_field_type
));
581 trace
= bt_stream_class_common_borrow_trace(stream_class
);
586 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
587 SET_TMP_PREFIX("trace-");
588 trace_format_func(buf_ch
, false, tmp_prefix
, trace
);
591 static inline void format_stream_class(char **buf_ch
, bool extended
,
592 const char *prefix
, struct bt_stream_class
*stream_class
)
596 format_stream_class_common(buf_ch
, extended
, prefix
,
597 BT_TO_COMMON(stream_class
), (format_func
) format_trace
);
603 SET_TMP_PREFIX("ehf-pool-");
604 format_object_pool(buf_ch
, extended
, prefix
,
605 &stream_class
->event_header_field_pool
);
606 SET_TMP_PREFIX("pcf-pool-");
607 format_object_pool(buf_ch
, extended
, prefix
,
608 &stream_class
->packet_context_field_pool
);
611 static inline void format_writer_stream_class(char **buf_ch
, bool extended
,
612 const char *prefix
, struct bt_ctf_stream_class
*stream_class
)
614 format_stream_class_common(buf_ch
, extended
, prefix
,
615 BT_TO_COMMON(stream_class
), (format_func
) format_writer_trace
);
617 if (extended
&& stream_class
->clock
) {
618 BUF_APPEND(", %sctf-writer-clock-addr=%p, "
619 "%sctf-writer-clock-name=\"%s\"",
620 PRFIELD(stream_class
->clock
),
621 PRFIELD(bt_clock_class_get_name(
622 BT_TO_COMMON(stream_class
->clock
->clock_class
))));
626 static inline void format_event_class_common(char **buf_ch
, bool extended
,
627 const char *prefix
, struct bt_event_class_common
*event_class
,
628 format_func format_stream_class_func
,
629 format_func format_trace_func
)
631 struct bt_stream_class_common
*stream_class
;
632 struct bt_trace_common
*trace
;
635 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(event_class
->id
));
637 if (event_class
->name
) {
638 BUF_APPEND(", %sname=\"%s\"", PRFIELD(event_class
->name
->str
));
645 BUF_APPEND(", %sis-frozen=%d, %slog-level=%s",
646 PRFIELD(event_class
->frozen
),
647 PRFIELD(bt_common_event_class_log_level_string(event_class
->log_level
)));
649 if (event_class
->emf_uri
) {
650 BUF_APPEND(", %semf-uri=\"%s\"",
651 PRFIELD(event_class
->emf_uri
->str
));
654 BUF_APPEND(", %scontext-ft-addr=%p, %spayload-ft-addr=%p",
655 PRFIELD(event_class
->context_field_type
),
656 PRFIELD(event_class
->payload_field_type
));
658 stream_class
= bt_event_class_common_borrow_stream_class(event_class
);
663 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
664 SET_TMP_PREFIX("stream-class-");
665 format_stream_class_func(buf_ch
, false, tmp_prefix
, stream_class
);
666 trace
= bt_stream_class_common_borrow_trace(stream_class
);
671 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
672 SET_TMP_PREFIX("trace-");
673 format_trace_func(buf_ch
, false, tmp_prefix
, trace
);
676 static inline void format_event_class(char **buf_ch
, bool extended
,
677 const char *prefix
, struct bt_event_class
*event_class
)
681 format_event_class_common(buf_ch
, extended
, prefix
,
682 BT_TO_COMMON(event_class
), (format_func
) format_stream_class
,
683 (format_func
) format_trace
);
689 SET_TMP_PREFIX("event-pool-");
690 format_object_pool(buf_ch
, extended
, prefix
, &event_class
->event_pool
);
693 static inline void format_writer_event_class(char **buf_ch
, bool extended
,
694 const char *prefix
, struct bt_ctf_event_class
*event_class
)
696 format_event_class_common(buf_ch
, extended
, prefix
,
697 BT_TO_COMMON(event_class
),
698 (format_func
) format_writer_stream_class
,
699 (format_func
) format_writer_trace
);
702 static inline void format_stream_common(char **buf_ch
, bool extended
,
703 const char *prefix
, struct bt_stream_common
*stream
,
704 format_func format_stream_class_func
,
705 format_func format_trace_func
)
707 struct bt_stream_class_common
*stream_class
;
708 struct bt_trace_common
*trace
;
711 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(stream
->id
));
714 BUF_APPEND(", %sname=\"%s\"", PRFIELD(stream
->name
->str
));
721 stream_class
= bt_stream_common_borrow_class(stream
);
726 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
727 SET_TMP_PREFIX("stream-class-");
728 format_stream_class_func(buf_ch
, false, tmp_prefix
, stream_class
);
729 trace
= bt_stream_class_common_borrow_trace(stream_class
);
734 trace
= (void *) bt_object_borrow_parent(&stream
->base
);
739 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
740 SET_TMP_PREFIX("trace-");
741 format_trace_common(buf_ch
, false, tmp_prefix
, trace
);
744 static inline void format_stream(char **buf_ch
, bool extended
,
745 const char *prefix
, struct bt_stream
*stream
)
749 format_stream_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(stream
),
750 (format_func
) format_stream_class
,
751 (format_func
) format_trace
);
752 SET_TMP_PREFIX("packet-pool-");
753 format_object_pool(buf_ch
, extended
, prefix
, &stream
->packet_pool
);
756 static inline void format_writer_stream(char **buf_ch
, bool extended
,
757 const char *prefix
, struct bt_ctf_stream
*stream
)
759 format_stream_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(stream
),
760 (format_func
) format_writer_stream_class
,
761 (format_func
) format_writer_trace
);
763 BUF_APPEND(", %sheader-field-addr=%p, %scontext-field-addr=%p"
764 ", %sfd=%d, %smmap-offset=%zu, "
765 "%smmap-base-offset=%zu, %spacket-size=%" PRIu64
", "
766 "%soffset=%" PRId64
", %sevent-count=%u, "
767 "%sflushed-packet-count=%u, "
768 "%sdiscarded-event-count=%" PRIu64
", "
769 "%ssize=%" PRIu64
", %slast-ts-end=%" PRIu64
,
770 PRFIELD(stream
->packet_header
),
771 PRFIELD(stream
->packet_context
),
772 PRFIELD(stream
->pos
.fd
),
773 PRFIELD((size_t) stream
->pos
.mmap_offset
),
774 PRFIELD((size_t) stream
->pos
.mmap_base_offset
),
775 PRFIELD(stream
->pos
.packet_size
),
776 PRFIELD(stream
->pos
.offset
),
777 PRFIELD(stream
->events
->len
),
778 PRFIELD(stream
->flushed_packet_count
),
779 PRFIELD(stream
->discarded_events
),
780 PRFIELD(stream
->size
), PRFIELD(stream
->last_ts_end
));
782 if (stream
->events
) {
783 BUF_APPEND(", %sevent-count=%u", PRFIELD(stream
->events
->len
));
786 BUF_APPEND(", %sheader-field-addr=%p, %scontext-field-addr=%p"
787 ", %sfd=%d, %smmap-offset=%zu, "
788 "%smmap-base-offset=%zu, %spacket-size=%" PRIu64
", "
789 "%soffset=%" PRId64
", "
790 "%sflushed-packet-count=%u, "
791 "%sdiscarded-event-count=%" PRIu64
", "
792 "%ssize=%" PRIu64
", %slast-ts-end=%" PRIu64
,
793 PRFIELD(stream
->packet_header
),
794 PRFIELD(stream
->packet_context
),
795 PRFIELD(stream
->pos
.fd
),
796 PRFIELD((size_t) stream
->pos
.mmap_offset
),
797 PRFIELD((size_t) stream
->pos
.mmap_base_offset
),
798 PRFIELD(stream
->pos
.packet_size
),
799 PRFIELD(stream
->pos
.offset
),
800 PRFIELD(stream
->flushed_packet_count
),
801 PRFIELD(stream
->discarded_events
),
802 PRFIELD(stream
->size
), PRFIELD(stream
->last_ts_end
));
805 static inline void format_packet(char **buf_ch
, bool extended
,
806 const char *prefix
, struct bt_packet
*packet
)
808 struct bt_stream
*stream
;
809 struct bt_trace
*trace
;
816 BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, "
817 "%scontext-field-addr=%p",
818 PRFIELD(packet
->frozen
),
819 PRFIELD(packet
->header
? packet
->header
->field
: NULL
),
820 PRFIELD(packet
->context
));
821 stream
= bt_packet_borrow_stream(packet
);
826 BUF_APPEND(", %sstream-addr=%p", PRFIELD(stream
));
827 SET_TMP_PREFIX("stream-");
828 format_stream(buf_ch
, false, tmp_prefix
, stream
);
829 trace
= (struct bt_trace
*) bt_object_borrow_parent(&stream
->common
.base
);
834 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
835 SET_TMP_PREFIX("trace-");
836 format_trace(buf_ch
, false, tmp_prefix
, trace
);
839 static inline void format_event_common(char **buf_ch
, bool extended
,
840 const char *prefix
, struct bt_event_common
*event
,
841 format_func format_event_class_func
,
842 format_func format_stream_class_func
,
843 format_func format_trace_func
)
845 struct bt_trace_common
*trace
;
846 struct bt_stream_class_common
*stream_class
;
853 BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, "
854 "%sstream-context-field-addr=%p, "
855 "%scontext-field-addr=%p, %spayload-field-addr=%p, ",
856 PRFIELD(event
->frozen
),
857 PRFIELD(event
->header_field
? event
->header_field
->field
: NULL
),
858 PRFIELD(event
->stream_event_context_field
),
859 PRFIELD(event
->context_field
),
860 PRFIELD(event
->payload_field
));
861 BUF_APPEND(", %sevent-class-addr=%p", PRFIELD(event
->class));
867 SET_TMP_PREFIX("event-class-");
868 format_event_class_func(buf_ch
, false, tmp_prefix
, event
->class);
869 stream_class
= bt_event_class_common_borrow_stream_class(event
->class);
871 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
872 SET_TMP_PREFIX("stream-class-");
873 format_stream_class_func(buf_ch
, false, tmp_prefix
,
876 trace
= bt_stream_class_common_borrow_trace(stream_class
);
878 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
879 SET_TMP_PREFIX("trace-");
880 format_trace_func(buf_ch
, false, tmp_prefix
, trace
);
885 static inline void format_event(char **buf_ch
, bool extended
,
886 const char *prefix
, struct bt_event
*event
)
888 struct bt_packet
*packet
;
889 struct bt_stream
*stream
;
892 format_event_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(event
),
893 (format_func
) format_event_class
,
894 (format_func
) format_stream_class
, (format_func
) format_trace
);
900 SET_TMP_PREFIX("cvs-");
901 format_clock_value_set(buf_ch
, extended
, tmp_prefix
, &event
->cv_set
);
902 packet
= bt_event_borrow_packet(event
);
907 BUF_APPEND(", %spacket-addr=%p", PRFIELD(packet
));
908 SET_TMP_PREFIX("packet-");
909 format_packet(buf_ch
, false, tmp_prefix
, packet
);
910 stream
= bt_packet_borrow_stream(packet
);
915 BUF_APPEND(", %sstream-addr=%p", PRFIELD(stream
));
916 SET_TMP_PREFIX("stream-");
917 format_stream(buf_ch
, false, tmp_prefix
, stream
);
920 static inline void format_writer_event(char **buf_ch
, bool extended
,
921 const char *prefix
, struct bt_event
*event
)
923 format_event_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(event
),
924 (format_func
) format_writer_event_class
,
925 (format_func
) format_writer_stream_class
,
926 (format_func
) format_writer_trace
);
929 static inline void format_clock_class(char **buf_ch
, bool extended
,
930 const char *prefix
, struct bt_clock_class
*clock_class
)
934 BUF_APPEND(", %sname=\"%s\", %sfreq=%" PRIu64
,
935 PRFIELD(clock_class
->name
->str
),
936 PRFIELD(clock_class
->frequency
));
942 if (clock_class
->description
) {
943 BUF_APPEND(", %spartial-description=\"%.32s\"",
944 PRFIELD(clock_class
->description
->str
));
947 BUF_APPEND(", %sis-frozen=%d, %sprecision=%" PRIu64
", "
948 "%soffset-s=%" PRId64
", "
949 "%soffset-cycles=%" PRId64
", %sis-absolute=%d",
950 PRFIELD(clock_class
->frozen
), PRFIELD(clock_class
->precision
),
951 PRFIELD(clock_class
->offset_s
), PRFIELD(clock_class
->offset
),
952 PRFIELD(clock_class
->absolute
));
954 if (clock_class
->uuid_set
) {
955 BUF_APPEND_UUID(clock_class
->uuid
);
958 SET_TMP_PREFIX("cv-pool-");
959 format_object_pool(buf_ch
, extended
, prefix
, &clock_class
->cv_pool
);
962 static inline void format_clock_value(char **buf_ch
, bool extended
,
963 const char *prefix
, struct bt_clock_value
*clock_value
)
966 BUF_APPEND(", %sraw-value=%" PRIu64
", %sns-from-epoch=%" PRId64
,
967 PRFIELD(clock_value
->value
),
968 PRFIELD(clock_value
->ns_from_epoch
));
974 BUF_APPEND(", %sis-frozen=%d, %sis-set=%d",
975 PRFIELD(clock_value
->frozen
), PRFIELD(clock_value
->is_set
));
976 BUF_APPEND(", %sclock-class-addr=%p",
977 PRFIELD(clock_value
->clock_class
));
978 SET_TMP_PREFIX("clock-class-");
979 format_clock_class(buf_ch
, false, tmp_prefix
, clock_value
->clock_class
);
982 static inline void format_value(char **buf_ch
, bool extended
,
983 const char *prefix
, struct bt_value
*value
)
985 BUF_APPEND(", %stype=%s",
986 PRFIELD(bt_value_type_string(bt_value_get_type(value
))));
992 switch (bt_value_get_type(value
)) {
993 case BT_VALUE_TYPE_BOOL
:
997 (void) bt_value_bool_get(value
, &val
);
998 BUF_APPEND(", %svalue=%d", PRFIELD(val
));
1001 case BT_VALUE_TYPE_INTEGER
:
1005 (void) bt_value_integer_get(value
, &val
);
1006 BUF_APPEND(", %svalue=%" PRId64
, PRFIELD(val
));
1009 case BT_VALUE_TYPE_FLOAT
:
1013 (void) bt_value_float_get(value
, &val
);
1014 BUF_APPEND(", %svalue=%f", PRFIELD(val
));
1017 case BT_VALUE_TYPE_STRING
:
1021 (void) bt_value_string_get(value
, &val
);
1022 BUF_APPEND(", %spartial-value=\"%.32s\"", PRFIELD(val
));
1025 case BT_VALUE_TYPE_ARRAY
:
1027 int64_t count
= bt_value_array_size(value
);
1029 BT_ASSERT(count
>= 0);
1030 BUF_APPEND(", %selement-count=%" PRId64
, PRFIELD(count
));
1033 case BT_VALUE_TYPE_MAP
:
1035 int64_t count
= bt_value_map_size(value
);
1037 BT_ASSERT(count
>= 0);
1038 BUF_APPEND(", %selement-count=%" PRId64
, PRFIELD(count
));
1046 static inline void format_notification(char **buf_ch
, bool extended
,
1047 const char *prefix
, struct bt_notification
*notif
)
1049 char tmp_prefix
[64];
1051 BUF_APPEND(", %stype=%s",
1052 PRFIELD(bt_notification_type_string(notif
->type
)));
1058 BUF_APPEND(", %sis-frozen=%d, %sgraph-addr=%p",
1059 PRFIELD(notif
->frozen
), PRFIELD(notif
->graph
));
1061 switch (notif
->type
) {
1062 case BT_NOTIFICATION_TYPE_EVENT
:
1064 struct bt_notification_event
*notif_event
= (void *) notif
;
1066 SET_TMP_PREFIX("event-");
1067 format_event(buf_ch
, true, tmp_prefix
, notif_event
->event
);
1070 case BT_NOTIFICATION_TYPE_STREAM_BEGIN
:
1072 struct bt_notification_stream_begin
*notif_stream
=
1075 SET_TMP_PREFIX("stream-");
1076 format_stream(buf_ch
, true, tmp_prefix
, notif_stream
->stream
);
1079 case BT_NOTIFICATION_TYPE_STREAM_END
:
1081 struct bt_notification_stream_end
*notif_stream
=
1084 SET_TMP_PREFIX("stream-");
1085 format_stream(buf_ch
, true, tmp_prefix
, notif_stream
->stream
);
1088 case BT_NOTIFICATION_TYPE_PACKET_BEGIN
:
1090 struct bt_notification_packet_begin
*notif_packet
=
1093 SET_TMP_PREFIX("packet-");
1094 format_packet(buf_ch
, true, tmp_prefix
, notif_packet
->packet
);
1097 case BT_NOTIFICATION_TYPE_PACKET_END
:
1099 struct bt_notification_packet_end
*notif_packet
=
1102 SET_TMP_PREFIX("packet-");
1103 format_packet(buf_ch
, true, tmp_prefix
, notif_packet
->packet
);
1111 static inline void format_plugin_so_shared_lib_handle(char **buf_ch
,
1113 struct bt_plugin_so_shared_lib_handle
*handle
)
1115 BUF_APPEND(", %saddr=%p", PRFIELD(handle
));
1118 BUF_APPEND(", %spath=\"%s\"", PRFIELD(handle
->path
->str
));
1122 static inline void format_component_class(char **buf_ch
, bool extended
,
1123 const char *prefix
, struct bt_component_class
*comp_class
)
1125 char tmp_prefix
[64];
1127 BUF_APPEND(", %stype=%s, %sname=\"%s\"",
1128 PRFIELD(bt_component_class_type_string(comp_class
->type
)),
1129 PRFIELD(comp_class
->name
? comp_class
->name
->str
: NULL
));
1131 if (comp_class
->description
) {
1132 BUF_APPEND(", %spartial-descr=\"%.32s\"",
1133 PRFIELD(comp_class
->description
->str
));
1140 BUF_APPEND(", %sis-frozen=%d", PRFIELD(comp_class
->frozen
));
1142 if (comp_class
->so_handle
) {
1143 SET_TMP_PREFIX("so-handle-");
1144 format_plugin_so_shared_lib_handle(buf_ch
, tmp_prefix
,
1145 comp_class
->so_handle
);
1149 static inline void format_component(char **buf_ch
, bool extended
,
1150 const char *prefix
, struct bt_component
*component
)
1152 char tmp_prefix
[64];
1154 BUF_APPEND(", %sname=\"%s\"", PRFIELD(component
->name
->str
));
1155 SET_TMP_PREFIX("class-");
1156 format_component_class(buf_ch
, extended
, tmp_prefix
, component
->class);
1162 if (component
->input_ports
) {
1163 BUF_APPEND(", %sinput-port-count=%u",
1164 PRFIELD(component
->input_ports
->len
));
1167 if (component
->output_ports
) {
1168 BUF_APPEND(", %soutput-port-count=%u",
1169 PRFIELD(component
->output_ports
->len
));
1173 static inline void format_port(char **buf_ch
, bool extended
,
1174 const char *prefix
, struct bt_port
*port
)
1176 char tmp_prefix
[64];
1178 BUF_APPEND(", %stype=%s, %sname=\"%s\"",
1179 PRFIELD(bt_port_type_string(port
->type
)),
1180 PRFIELD(port
->name
->str
));
1186 if (port
->connection
) {
1187 SET_TMP_PREFIX("conn-");
1188 format_connection(buf_ch
, false, tmp_prefix
, port
->connection
);
1192 static inline void format_connection(char **buf_ch
, bool extended
,
1193 const char *prefix
, struct bt_connection
*connection
)
1195 char tmp_prefix
[64];
1201 if (connection
->upstream_port
) {
1202 SET_TMP_PREFIX("upstream-port-");
1203 format_port(buf_ch
, false, tmp_prefix
,
1204 connection
->upstream_port
);
1207 if (connection
->downstream_port
) {
1208 SET_TMP_PREFIX("downstream-port-");
1209 format_port(buf_ch
, false, tmp_prefix
,
1210 connection
->downstream_port
);
1214 static inline void format_graph(char **buf_ch
, bool extended
,
1215 const char *prefix
, struct bt_graph
*graph
)
1217 char tmp_prefix
[64];
1219 BUF_APPEND(", %sis-canceled=%d", PRFIELD(graph
->canceled
));
1225 if (graph
->components
) {
1226 BUF_APPEND(", %scomp-count=%u",
1227 PRFIELD(graph
->components
->len
));
1230 if (graph
->connections
) {
1231 BUF_APPEND(", %sconn-count=%u",
1232 PRFIELD(graph
->connections
->len
));
1235 SET_TMP_PREFIX("en-pool-");
1236 format_object_pool(buf_ch
, extended
, prefix
,
1237 &graph
->event_notif_pool
);
1238 SET_TMP_PREFIX("pbn-pool-");
1239 format_object_pool(buf_ch
, extended
, prefix
,
1240 &graph
->packet_begin_notif_pool
);
1241 SET_TMP_PREFIX("pen-pool-");
1242 format_object_pool(buf_ch
, extended
, prefix
,
1243 &graph
->packet_end_notif_pool
);
1246 static inline void format_notification_iterator(char **buf_ch
,
1247 bool extended
, const char *prefix
,
1248 struct bt_notification_iterator
*iterator
)
1251 char tmp_prefix
[64];
1253 if (iterator
->type
== BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION
) {
1254 type
= "BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION";
1255 } else if (iterator
->type
== BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT
) {
1256 type
= "BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT";
1261 BUF_APPEND(", %stype=%s", PRFIELD(type
));
1263 switch (iterator
->type
) {
1264 case BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION
:
1266 struct bt_notification_iterator_private_connection
*
1267 iter_priv_conn
= (void *) iterator
;
1269 if (iter_priv_conn
->upstream_component
) {
1270 SET_TMP_PREFIX("upstream-comp-");
1271 format_component(buf_ch
, false, tmp_prefix
,
1272 iter_priv_conn
->upstream_component
);
1275 if (iter_priv_conn
->upstream_port
) {
1276 SET_TMP_PREFIX("upstream-port-");
1277 format_port(buf_ch
, false, tmp_prefix
,
1278 iter_priv_conn
->upstream_port
);
1281 if (iter_priv_conn
->connection
) {
1282 SET_TMP_PREFIX("upstream-conn-");
1283 format_connection(buf_ch
, false, tmp_prefix
,
1284 iter_priv_conn
->connection
);
1288 case BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT
:
1290 struct bt_notification_iterator_output_port
*iter_output_port
=
1293 SET_TMP_PREFIX("graph-");
1294 format_graph(buf_ch
, false, tmp_prefix
,
1295 iter_output_port
->graph
);
1296 SET_TMP_PREFIX("colander-comp-");
1297 format_component(buf_ch
, false, tmp_prefix
,
1298 iter_output_port
->colander
);
1306 static inline void format_plugin(char **buf_ch
, bool extended
,
1307 const char *prefix
, struct bt_plugin
*plugin
)
1309 char tmp_prefix
[64];
1311 BUF_APPEND(", %stype=%s", PRFIELD(bt_plugin_type_string(plugin
->type
)));
1313 if (plugin
->info
.path_set
) {
1314 BUF_APPEND(", %spath=\"%s\"",
1315 PRFIELD(plugin
->info
.path
->str
));
1318 if (plugin
->info
.name_set
) {
1319 BUF_APPEND(", %sname=\"%s\"",
1320 PRFIELD(plugin
->info
.name
->str
));
1327 if (plugin
->info
.author_set
) {
1328 BUF_APPEND(", %sauthor=\"%s\"",
1329 PRFIELD(plugin
->info
.author
->str
));
1332 if (plugin
->info
.license_set
) {
1333 BUF_APPEND(", %slicense=\"%s\"",
1334 PRFIELD(plugin
->info
.license
->str
));
1337 if (plugin
->info
.version_set
) {
1338 BUF_APPEND(", %sversion=%u.%u.%u%s",
1339 PRFIELD(plugin
->info
.version
.major
),
1340 plugin
->info
.version
.minor
,
1341 plugin
->info
.version
.patch
,
1342 plugin
->info
.version
.extra
?
1343 plugin
->info
.version
.extra
->str
: "");
1346 BUF_APPEND(", %sis-frozen=%d, %scomp-class-count=%u",
1347 PRFIELD(plugin
->frozen
),
1348 PRFIELD(plugin
->comp_classes
->len
));
1350 if (plugin
->spec_data
) {
1351 struct bt_plugin_so_spec_data
*spec_data
=
1352 (void *) plugin
->spec_data
;
1354 if (spec_data
->shared_lib_handle
) {
1355 SET_TMP_PREFIX("so-handle-");
1356 format_plugin_so_shared_lib_handle(buf_ch
, tmp_prefix
,
1357 spec_data
->shared_lib_handle
);
1362 static inline void format_ctf_writer(char **buf_ch
, bool extended
,
1363 const char *prefix
, struct bt_ctf_writer
*writer
)
1368 static inline void format_stream_class_common_common(char **buf_ch
,
1369 bool extended
, const char *prefix
,
1370 struct bt_stream_class_common
*stream_class
)
1372 format_stream_class_common(buf_ch
, extended
, prefix
, stream_class
,
1373 (format_func
) format_trace_common
);
1376 static inline void format_event_class_common_common(char **buf_ch
,
1377 bool extended
, const char *prefix
,
1378 struct bt_event_class_common
*event_class
)
1380 format_event_class_common(buf_ch
, extended
, prefix
, event_class
,
1381 (format_func
) format_stream_class_common
,
1382 (format_func
) format_trace_common
);
1385 static inline void format_event_common_common(char **buf_ch
,
1386 bool extended
, const char *prefix
,
1387 struct bt_event_common
*event
)
1389 format_event_common(buf_ch
, extended
, prefix
, event
,
1390 (format_func
) format_event_class_common
,
1391 (format_func
) format_stream_class_common
,
1392 (format_func
) format_trace_common
);
1395 static inline void format_stream_common_common(char **buf_ch
, bool extended
,
1396 const char *prefix
, struct bt_stream_common
*stream
)
1398 format_stream_common(buf_ch
, extended
, prefix
, stream
,
1399 (format_func
) format_stream_class_common
,
1400 (format_func
) format_trace_common
);
1403 static inline void handle_conversion_specifier_bt(void *priv_data
,
1404 char **buf_ch
, size_t avail_size
,
1405 const char **out_fmt_ch
, va_list *args
)
1407 const char *fmt_ch
= *out_fmt_ch
;
1408 bool extended
= false;
1410 char *prefix_ch
= prefix
;
1416 } cat
= CAT_DEFAULT
;
1421 if (*fmt_ch
== '[') {
1426 if (*fmt_ch
== ']') {
1432 *prefix_ch
= *fmt_ch
;
1440 if (*fmt_ch
== '+') {
1445 if (*fmt_ch
== 'w') {
1448 } else if (*fmt_ch
== '_') {
1453 obj
= va_arg(*args
, void *);
1454 BUF_APPEND("%saddr=%p", prefix
, obj
);
1464 format_field_type(buf_ch
, extended
, prefix
, obj
);
1467 format_field(buf_ch
, extended
, prefix
, obj
);
1470 format_field_path(buf_ch
, extended
, prefix
, obj
);
1473 format_event_class(buf_ch
, extended
, prefix
, obj
);
1476 format_event(buf_ch
, extended
, prefix
, obj
);
1479 format_stream_class(buf_ch
, extended
, prefix
, obj
);
1482 format_stream(buf_ch
, extended
, prefix
, obj
);
1485 format_packet(buf_ch
, extended
, prefix
, obj
);
1488 format_trace(buf_ch
, extended
, prefix
, obj
);
1491 format_clock_class(buf_ch
, extended
, prefix
, obj
);
1494 format_clock_value(buf_ch
, extended
, prefix
, obj
);
1497 format_value(buf_ch
, extended
, prefix
, obj
);
1500 format_notification(buf_ch
, extended
, prefix
, obj
);
1503 format_notification_iterator(buf_ch
, extended
, prefix
, obj
);
1506 format_component_class(buf_ch
, extended
, prefix
, obj
);
1509 format_component(buf_ch
, extended
, prefix
, obj
);
1512 format_port(buf_ch
, extended
, prefix
, obj
);
1515 format_connection(buf_ch
, extended
, prefix
, obj
);
1518 format_plugin(buf_ch
, extended
, prefix
, obj
);
1521 format_graph(buf_ch
, extended
, prefix
, obj
);
1524 format_object_pool(buf_ch
, extended
, prefix
, obj
);
1527 format_object(buf_ch
, extended
, prefix
, obj
);
1536 format_writer_field_type(buf_ch
, extended
, prefix
, obj
);
1539 format_writer_field(buf_ch
, extended
, prefix
, obj
);
1542 format_writer_event_class(buf_ch
, extended
, prefix
, obj
);
1545 format_writer_event(buf_ch
, extended
, prefix
, obj
);
1548 format_writer_stream_class(buf_ch
, extended
, prefix
, obj
);
1551 format_writer_stream(buf_ch
, extended
, prefix
, obj
);
1554 format_writer_trace(buf_ch
, extended
, prefix
, obj
);
1557 format_ctf_writer(buf_ch
, extended
, prefix
, obj
);
1566 format_field_type_common(buf_ch
, extended
, prefix
, obj
);
1569 format_field_common(buf_ch
, extended
, prefix
, obj
);
1572 format_event_class_common_common(buf_ch
, extended
, prefix
, obj
);
1575 format_event_common_common(buf_ch
, extended
, prefix
, obj
);
1578 format_stream_class_common_common(buf_ch
, extended
, prefix
, obj
);
1581 format_stream_common_common(buf_ch
, extended
, prefix
, obj
);
1584 format_trace_common(buf_ch
, extended
, prefix
, obj
);
1594 *out_fmt_ch
= fmt_ch
;
1598 void bt_lib_log(const char *func
, const char *file
, unsigned line
,
1599 int lvl
, const char *tag
, const char *fmt
, ...)
1604 va_start(args
, fmt
);
1605 bt_common_custom_vsnprintf(lib_logging_buf
, LIB_LOGGING_BUF_SIZE
, '!',
1606 handle_conversion_specifier_bt
, NULL
, fmt
, &args
);
1608 _bt_log_write_d(func
, file
, line
, lvl
, tag
, "%s", lib_logging_buf
);