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-heap-internal.h>
70 #include <babeltrace/graph/notification-inactivity-internal.h>
71 #include <babeltrace/graph/notification-internal.h>
72 #include <babeltrace/graph/notification-iterator-internal.h>
73 #include <babeltrace/graph/notification-packet-internal.h>
74 #include <babeltrace/graph/notification-stream-internal.h>
75 #include <babeltrace/graph/port-internal.h>
76 #include <babeltrace/plugin/plugin-internal.h>
77 #include <babeltrace/plugin/plugin-so-internal.h>
79 #define LIB_LOGGING_BUF_SIZE (4096 * 4)
81 static char __thread lib_logging_buf
[LIB_LOGGING_BUF_SIZE
];
83 #define BUF_APPEND(_fmt, ...) \
86 size_t _size = LIB_LOGGING_BUF_SIZE - \
87 (size_t) (*buf_ch - lib_logging_buf); \
88 _count = snprintf(*buf_ch, _size, (_fmt), __VA_ARGS__); \
89 BT_ASSERT(_count >= 0); \
90 *buf_ch += MIN(_count, _size); \
91 if (*buf_ch >= lib_logging_buf + LIB_LOGGING_BUF_SIZE - 1) { \
96 #define BUF_APPEND_UUID(_uuid) \
97 BUF_APPEND(", %suuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\"", \
99 (unsigned int) (_uuid)[0], \
100 (unsigned int) (_uuid)[1], \
101 (unsigned int) (_uuid)[2], \
102 (unsigned int) (_uuid)[3], \
103 (unsigned int) (_uuid)[4], \
104 (unsigned int) (_uuid)[5], \
105 (unsigned int) (_uuid)[6], \
106 (unsigned int) (_uuid)[7], \
107 (unsigned int) (_uuid)[8], \
108 (unsigned int) (_uuid)[9], \
109 (unsigned int) (_uuid)[10], \
110 (unsigned int) (_uuid)[11], \
111 (unsigned int) (_uuid)[12], \
112 (unsigned int) (_uuid)[13], \
113 (unsigned int) (_uuid)[14], \
114 (unsigned int) (_uuid)[15])
116 #define PRFIELD(_expr) prefix, (_expr)
118 #define SET_TMP_PREFIX(_prefix2) \
120 strcpy(tmp_prefix, prefix); \
121 strcat(tmp_prefix, (_prefix2)); \
124 typedef void (*format_func
)(char **, bool, const char *, void *);
126 static inline void format_component(char **buf_ch
, bool extended
,
127 const char *prefix
, struct bt_component
*component
);
129 static inline void format_port(char **buf_ch
, bool extended
,
130 const char *prefix
, struct bt_port
*port
);
132 static inline void format_connection(char **buf_ch
, bool extended
,
133 const char *prefix
, struct bt_connection
*connection
);
135 static inline void format_ref_count(char **buf_ch
, bool extended
,
136 const char *prefix
, struct bt_object
*obj
)
138 BUF_APPEND(", %sref-count=%lu", prefix
, obj
->ref_count
.count
);
141 static inline void format_object_pool(char **buf_ch
, bool extended
,
142 const char *prefix
, struct bt_object_pool
*pool
)
144 BUF_APPEND(", %ssize=%zu", PRFIELD(pool
->size
));
147 BUF_APPEND(", %scap=%u", PRFIELD(pool
->objects
->len
));
151 static inline void format_field_type_common(char **buf_ch
, bool extended
,
152 const char *prefix
, struct bt_field_type_common
*field_type
)
154 BUF_APPEND(", %stype-id=%s, %salignment=%u",
155 PRFIELD(bt_common_field_type_id_string(field_type
->id
)),
156 PRFIELD(field_type
->alignment
));
159 BUF_APPEND(", %sis-frozen=%d", PRFIELD(field_type
->frozen
));
164 if (field_type
->id
== BT_FIELD_TYPE_ID_UNKNOWN
) {
168 switch (field_type
->id
) {
169 case BT_FIELD_TYPE_ID_INTEGER
:
171 struct bt_field_type_common_integer
*integer
=
172 BT_FROM_COMMON(field_type
);
174 BUF_APPEND(", %ssize=%u, %sis-signed=%d, %sbyte-order=%s, "
175 "%sbase=%d, %sencoding=%s, "
176 "%smapped-clock-class-addr=%p",
177 PRFIELD(integer
->size
), PRFIELD(integer
->is_signed
),
178 PRFIELD(bt_common_byte_order_string(integer
->user_byte_order
)),
179 PRFIELD(integer
->base
),
180 PRFIELD(bt_common_string_encoding_string(integer
->encoding
)),
181 PRFIELD(integer
->mapped_clock_class
));
183 if (integer
->mapped_clock_class
) {
184 BUF_APPEND(", %smapped-clock-class-name=\"%s\"",
185 PRFIELD(bt_clock_class_get_name(integer
->mapped_clock_class
)));
189 case BT_FIELD_TYPE_ID_FLOAT
:
191 struct bt_field_type_common_floating_point
*flt
=
192 BT_FROM_COMMON(field_type
);
194 BUF_APPEND(", %sexp-dig=%u, %smant-dig=%u, %sbyte-order=%s",
195 PRFIELD(flt
->exp_dig
), PRFIELD(flt
->mant_dig
),
196 PRFIELD(bt_common_byte_order_string(flt
->user_byte_order
)));
199 case BT_FIELD_TYPE_ID_ENUM
:
201 struct bt_field_type_common_enumeration
*enm
=
202 BT_FROM_COMMON(field_type
);
204 BUF_APPEND(", %smapping-count=%u",
205 PRFIELD(enm
->entries
->len
));
208 case BT_FIELD_TYPE_ID_STRING
:
210 struct bt_field_type_common_string
*str
=
211 BT_FROM_COMMON(field_type
);
213 BUF_APPEND(", %sencoding=%s",
214 PRFIELD(bt_common_string_encoding_string(str
->encoding
)));
217 case BT_FIELD_TYPE_ID_STRUCT
:
219 struct bt_field_type_common_structure
*structure
=
220 BT_FROM_COMMON(field_type
);
222 BUF_APPEND(", %sfield-count=%u",
223 PRFIELD(structure
->fields
->len
));
226 case BT_FIELD_TYPE_ID_SEQUENCE
:
228 struct bt_field_type_common_sequence
*seq
=
229 BT_FROM_COMMON(field_type
);
231 BUF_APPEND(", %slength-ft-addr=\"%s\", %selem-ft-addr=%p",
232 PRFIELD(seq
->length_field_name
->str
),
233 PRFIELD(seq
->element_ft
));
236 case BT_FIELD_TYPE_ID_VARIANT
:
238 struct bt_field_type_common_variant
*variant
=
239 BT_FROM_COMMON(field_type
);
241 BUF_APPEND(", %stag-name=\"%s\", %sfield-count=%u",
242 PRFIELD(variant
->tag_name
->str
),
243 PRFIELD(variant
->choices
->len
));
251 static inline void format_field_type(char **buf_ch
, bool extended
,
252 const char *prefix
, struct bt_field_type
*field_type
)
254 format_field_type_common(buf_ch
, extended
, prefix
,
255 (void *) field_type
);
258 static inline void format_writer_field_type(char **buf_ch
, bool extended
,
259 const char *prefix
, struct bt_ctf_field_type
*field_type
)
261 format_field_type_common(buf_ch
, extended
, prefix
,
262 (void *) field_type
);
265 static inline void format_field_common_integer_extended(char **buf_ch
,
266 const char *prefix
, struct bt_field_common
*field
)
268 struct bt_field_common_integer
*integer
= BT_FROM_COMMON(field
);
269 struct bt_field_type_common_integer
*field_type
=
270 BT_FROM_COMMON(field
->type
);
271 const char *fmt
= NULL
;
273 BT_ASSERT(field_type
);
275 if (field_type
->base
== 8) {
276 fmt
= ", %svalue=%" PRIo64
;
277 } else if (field_type
->base
== 16) {
278 fmt
= ", %svalue=%" PRIx64
;
281 if (field_type
->is_signed
) {
283 fmt
= ", %svalue=%" PRId64
;
286 BUF_APPEND(fmt
, PRFIELD(integer
->payload
.signd
));
289 fmt
= ", %svalue=%" PRIu64
;
292 BUF_APPEND(fmt
, PRFIELD(integer
->payload
.unsignd
));
296 static inline void format_field_common(char **buf_ch
, bool extended
,
297 const char *prefix
, struct bt_field_common
*field
)
299 BUF_APPEND(", %sis-set=%d", PRFIELD(field
->payload_set
));
302 BUF_APPEND(", %sis-frozen=%d", PRFIELD(field
->frozen
));
305 BUF_APPEND(", %stype-addr=%p", PRFIELD(field
->type
));
311 BUF_APPEND(", %stype-id=%s",
312 PRFIELD(bt_common_field_type_id_string(field
->type
->id
)));
314 if (!extended
|| field
->type
->id
== BT_FIELD_TYPE_ID_UNKNOWN
||
315 !field
->payload_set
) {
319 switch (field
->type
->id
) {
320 case BT_FIELD_TYPE_ID_INTEGER
:
322 format_field_common_integer_extended(buf_ch
, prefix
, field
);
325 case BT_FIELD_TYPE_ID_FLOAT
:
327 struct bt_field_common_floating_point
*flt
=
328 BT_FROM_COMMON(field
);
330 BUF_APPEND(", %svalue=%f", PRFIELD(flt
->payload
));
333 case BT_FIELD_TYPE_ID_STRING
:
335 struct bt_field_common_string
*str
=
336 BT_FROM_COMMON(field
);
339 BT_ASSERT(str
->payload
);
340 BUF_APPEND(", %spartial-value=\"%.32s\"",
341 PRFIELD(str
->payload
->str
));
346 case BT_FIELD_TYPE_ID_SEQUENCE
:
348 struct bt_field_common_sequence
*seq
=
349 BT_FROM_COMMON(field
);
351 BUF_APPEND(", %slength=%" PRIu64
, PRFIELD(seq
->length
));
354 BUF_APPEND(", %sallocated-length=%u",
355 PRFIELD(seq
->elements
->len
));
359 case BT_FIELD_TYPE_ID_VARIANT
:
361 struct bt_field_common_variant
*variant
=
362 BT_FROM_COMMON(field
);
364 BUF_APPEND(", %scur-field-addr=%p",
365 PRFIELD(variant
->current_field
));
373 static inline void format_field(char **buf_ch
, bool extended
,
374 const char *prefix
, struct bt_field
*field
)
376 struct bt_field_common
*common_field
= (void *) field
;
378 format_field_common(buf_ch
, extended
, prefix
, (void *) field
);
384 if (!common_field
->type
) {
388 switch (common_field
->type
->id
) {
389 case BT_FIELD_TYPE_ID_ENUM
:
391 struct bt_field_common_integer
*integer
= (void *) field
;
392 struct bt_field_type_common_enumeration
*enum_ft
=
393 BT_FROM_COMMON(common_field
->type
);
395 if (enum_ft
->container_ft
) {
396 if (enum_ft
->container_ft
->is_signed
) {
397 BUF_APPEND(", %svalue=%" PRId64
,
398 PRFIELD(integer
->payload
.signd
));
400 BUF_APPEND(", %svalue=%" PRIu64
,
401 PRFIELD(integer
->payload
.unsignd
));
411 static inline void format_writer_field(char **buf_ch
, bool extended
,
412 const char *prefix
, struct bt_ctf_field
*field
)
414 struct bt_field_common
*common_field
= (void *) field
;
416 format_field_common(buf_ch
, extended
, prefix
, (void *) field
);
422 if (!common_field
->type
) {
426 switch (common_field
->type
->id
) {
427 case BT_FIELD_TYPE_ID_ENUM
:
429 struct bt_ctf_field_enumeration
*enumeration
= (void *) field
;
431 if (enumeration
->container
) {
432 format_writer_field(buf_ch
, extended
, prefix
,
433 (void *) enumeration
->container
);
437 case BT_FIELD_TYPE_ID_VARIANT
:
439 struct bt_ctf_field_variant
*variant
= (void *) field
;
441 BUF_APPEND(", %stag-field-addr=%p", PRFIELD(variant
->tag
));
449 static inline void format_field_path(char **buf_ch
, bool extended
,
450 const char *prefix
, struct bt_field_path
*field_path
)
454 if (field_path
->indexes
) {
455 BT_ASSERT(field_path
->indexes
);
456 BUF_APPEND(", %sindex-count=%u", PRFIELD(field_path
->indexes
->len
));
459 if (!extended
|| !field_path
->indexes
) {
463 BUF_APPEND(", %spath=[%s", PRFIELD(bt_common_scope_string(field_path
->root
)));
465 for (i
= 0; i
< field_path
->indexes
->len
; i
++) {
466 int index
= g_array_index(field_path
->indexes
, int, i
);
468 BUF_APPEND(", %d", index
);
471 BUF_APPEND("%s", "]");
474 static inline void format_trace_common(char **buf_ch
, bool extended
,
475 const char *prefix
, struct bt_trace_common
*trace
)
478 BUF_APPEND(", %sname=\"%s\"", PRFIELD(trace
->name
->str
));
485 BUF_APPEND(", %sis-frozen=%d", PRFIELD(trace
->frozen
));
487 if (trace
->uuid_set
) {
488 BUF_APPEND_UUID(trace
->uuid
);
491 if (trace
->clock_classes
) {
492 BUF_APPEND(", %sclock-class-count=%u",
493 PRFIELD(trace
->clock_classes
->len
));
496 if (trace
->stream_classes
) {
497 BUF_APPEND(", %sstream-class-count=%u",
498 PRFIELD(trace
->stream_classes
->len
));
501 if (trace
->streams
) {
502 BUF_APPEND(", %sstream-count=%u",
503 PRFIELD(trace
->streams
->len
));
506 BUF_APPEND(", %spacket-header-ft-addr=%p",
507 PRFIELD(trace
->packet_header_field_type
));
510 static inline void format_trace(char **buf_ch
, bool extended
,
511 const char *prefix
, struct bt_trace
*trace
)
515 format_trace_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(trace
));
521 BUF_APPEND(", %sis-static=%d", PRFIELD(trace
->is_static
));
522 SET_TMP_PREFIX("phf-pool-");
523 format_object_pool(buf_ch
, extended
, prefix
,
524 &trace
->packet_header_field_pool
);
527 static inline void format_writer_trace(char **buf_ch
, bool extended
,
528 const char *prefix
, struct bt_ctf_trace
*trace
)
530 format_trace_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(trace
));
533 static inline void format_stream_class_common(char **buf_ch
, bool extended
,
534 const char *prefix
, struct bt_stream_class_common
*stream_class
,
535 format_func trace_format_func
)
537 struct bt_trace_common
*trace
;
540 if (stream_class
->id_set
) {
541 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(stream_class
->id
));
544 if (stream_class
->name
) {
545 BUF_APPEND(", %sname=\"%s\"", PRFIELD(stream_class
->name
->str
));
552 BUF_APPEND(", %sis-frozen=%d", PRFIELD(stream_class
->frozen
));
554 if (stream_class
->event_classes
) {
555 BUF_APPEND(", %sevent-class-count=%u",
556 PRFIELD(stream_class
->event_classes
->len
));
559 BUF_APPEND(", %spacket-context-ft-addr=%p, "
560 "%sevent-header-ft-addr=%p, %sevent-context-ft-addr=%p",
561 PRFIELD(stream_class
->packet_context_field_type
),
562 PRFIELD(stream_class
->event_header_field_type
),
563 PRFIELD(stream_class
->event_context_field_type
));
564 trace
= bt_stream_class_common_borrow_trace(stream_class
);
569 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
570 SET_TMP_PREFIX("trace-");
571 trace_format_func(buf_ch
, false, tmp_prefix
, trace
);
574 static inline void format_stream_class(char **buf_ch
, bool extended
,
575 const char *prefix
, struct bt_stream_class
*stream_class
)
579 format_stream_class_common(buf_ch
, extended
, prefix
,
580 BT_TO_COMMON(stream_class
), (format_func
) format_trace
);
586 SET_TMP_PREFIX("ehf-pool-");
587 format_object_pool(buf_ch
, extended
, prefix
,
588 &stream_class
->event_header_field_pool
);
591 static inline void format_writer_stream_class(char **buf_ch
, bool extended
,
592 const char *prefix
, struct bt_ctf_stream_class
*stream_class
)
594 format_stream_class_common(buf_ch
, extended
, prefix
,
595 BT_TO_COMMON(stream_class
), (format_func
) format_writer_trace
);
597 if (extended
&& stream_class
->clock
) {
598 BUF_APPEND(", %sctf-writer-clock-addr=%p, "
599 "%sctf-writer-clock-name=\"%s\"",
600 PRFIELD(stream_class
->clock
),
601 PRFIELD(bt_clock_class_get_name(
602 BT_TO_COMMON(stream_class
->clock
->clock_class
))));
606 static inline void format_event_class_common(char **buf_ch
, bool extended
,
607 const char *prefix
, struct bt_event_class_common
*event_class
,
608 format_func format_stream_class_func
,
609 format_func format_trace_func
)
611 struct bt_stream_class_common
*stream_class
;
612 struct bt_trace_common
*trace
;
615 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(event_class
->id
));
617 if (event_class
->name
) {
618 BUF_APPEND(", %sname=\"%s\"", PRFIELD(event_class
->name
->str
));
625 BUF_APPEND(", %sis-frozen=%d, %slog-level=%s",
626 PRFIELD(event_class
->frozen
),
627 PRFIELD(bt_common_event_class_log_level_string(event_class
->log_level
)));
629 if (event_class
->emf_uri
) {
630 BUF_APPEND(", %semf-uri=\"%s\"",
631 PRFIELD(event_class
->emf_uri
->str
));
634 BUF_APPEND(", %scontext-ft-addr=%p, %spayload-ft-addr=%p",
635 PRFIELD(event_class
->context_field_type
),
636 PRFIELD(event_class
->payload_field_type
));
638 stream_class
= bt_event_class_common_borrow_stream_class(event_class
);
643 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
644 SET_TMP_PREFIX("stream-class-");
645 format_stream_class_func(buf_ch
, false, tmp_prefix
, stream_class
);
646 trace
= bt_stream_class_common_borrow_trace(stream_class
);
651 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
652 SET_TMP_PREFIX("trace-");
653 format_trace_func(buf_ch
, false, tmp_prefix
, trace
);
656 static inline void format_event_class(char **buf_ch
, bool extended
,
657 const char *prefix
, struct bt_event_class
*event_class
)
661 format_event_class_common(buf_ch
, extended
, prefix
,
662 BT_TO_COMMON(event_class
), (format_func
) format_stream_class
,
663 (format_func
) format_trace
);
669 SET_TMP_PREFIX("event-pool-");
670 format_object_pool(buf_ch
, extended
, prefix
, &event_class
->event_pool
);
673 static inline void format_writer_event_class(char **buf_ch
, bool extended
,
674 const char *prefix
, struct bt_ctf_event_class
*event_class
)
676 format_event_class_common(buf_ch
, extended
, prefix
,
677 BT_TO_COMMON(event_class
),
678 (format_func
) format_writer_stream_class
,
679 (format_func
) format_writer_trace
);
682 static inline void format_stream_common(char **buf_ch
, bool extended
,
683 const char *prefix
, struct bt_stream_common
*stream
,
684 format_func format_stream_class_func
,
685 format_func format_trace_func
)
687 struct bt_stream_class_common
*stream_class
;
688 struct bt_trace_common
*trace
;
691 BUF_APPEND(", %sid=%" PRId64
, PRFIELD(stream
->id
));
694 BUF_APPEND(", %sname=\"%s\"", PRFIELD(stream
->name
->str
));
701 stream_class
= bt_stream_common_borrow_class(stream
);
706 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
707 SET_TMP_PREFIX("stream-class-");
708 format_stream_class_func(buf_ch
, false, tmp_prefix
, stream_class
);
709 trace
= bt_stream_class_common_borrow_trace(stream_class
);
714 trace
= (void *) bt_object_borrow_parent(stream
);
719 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
720 SET_TMP_PREFIX("trace-");
721 format_trace_common(buf_ch
, false, tmp_prefix
, trace
);
724 static inline void format_stream(char **buf_ch
, bool extended
,
725 const char *prefix
, struct bt_stream
*stream
)
729 format_stream_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(stream
),
730 (format_func
) format_stream_class
,
731 (format_func
) format_trace
);
732 SET_TMP_PREFIX("packet-pool-");
733 format_object_pool(buf_ch
, extended
, prefix
, &stream
->packet_pool
);
736 static inline void format_writer_stream(char **buf_ch
, bool extended
,
737 const char *prefix
, struct bt_ctf_stream
*stream
)
739 format_stream_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(stream
),
740 (format_func
) format_writer_stream_class
,
741 (format_func
) format_writer_trace
);
743 BUF_APPEND(", %sheader-field-addr=%p, %scontext-field-addr=%p"
744 ", %sfd=%d, %smmap-offset=%zu, "
745 "%smmap-base-offset=%zu, %spacket-size=%" PRIu64
", "
746 "%soffset=%" PRId64
", %sevent-count=%u, "
747 "%sflushed-packet-count=%u, "
748 "%sdiscarded-event-count=%" PRIu64
", "
749 "%ssize=%" PRIu64
", %slast-ts-end=%" PRIu64
,
750 PRFIELD(stream
->packet_header
),
751 PRFIELD(stream
->packet_context
),
752 PRFIELD(stream
->pos
.fd
),
753 PRFIELD((size_t) stream
->pos
.mmap_offset
),
754 PRFIELD((size_t) stream
->pos
.mmap_base_offset
),
755 PRFIELD(stream
->pos
.packet_size
),
756 PRFIELD(stream
->pos
.offset
),
757 PRFIELD(stream
->events
->len
),
758 PRFIELD(stream
->flushed_packet_count
),
759 PRFIELD(stream
->discarded_events
),
760 PRFIELD(stream
->size
), PRFIELD(stream
->last_ts_end
));
762 if (stream
->events
) {
763 BUF_APPEND(", %sevent-count=%u", PRFIELD(stream
->events
->len
));
766 BUF_APPEND(", %sheader-field-addr=%p, %scontext-field-addr=%p"
767 ", %sfd=%d, %smmap-offset=%zu, "
768 "%smmap-base-offset=%zu, %spacket-size=%" PRIu64
", "
769 "%soffset=%" PRId64
", "
770 "%sflushed-packet-count=%u, "
771 "%sdiscarded-event-count=%" PRIu64
", "
772 "%ssize=%" PRIu64
", %slast-ts-end=%" PRIu64
,
773 PRFIELD(stream
->packet_header
),
774 PRFIELD(stream
->packet_context
),
775 PRFIELD(stream
->pos
.fd
),
776 PRFIELD((size_t) stream
->pos
.mmap_offset
),
777 PRFIELD((size_t) stream
->pos
.mmap_base_offset
),
778 PRFIELD(stream
->pos
.packet_size
),
779 PRFIELD(stream
->pos
.offset
),
780 PRFIELD(stream
->flushed_packet_count
),
781 PRFIELD(stream
->discarded_events
),
782 PRFIELD(stream
->size
), PRFIELD(stream
->last_ts_end
));
785 static inline void format_packet(char **buf_ch
, bool extended
,
786 const char *prefix
, struct bt_packet
*packet
)
788 struct bt_stream
*stream
;
789 struct bt_trace
*trace
;
796 BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, "
797 "%scontext-field-addr=%p",
798 PRFIELD(packet
->frozen
),
799 PRFIELD(packet
->header
? packet
->header
->field
: NULL
),
800 PRFIELD(packet
->context
));
801 stream
= bt_packet_borrow_stream(packet
);
806 BUF_APPEND(", %sstream-addr=%p", PRFIELD(stream
));
807 SET_TMP_PREFIX("stream-");
808 format_stream(buf_ch
, false, tmp_prefix
, stream
);
809 trace
= (struct bt_trace
*) bt_object_borrow_parent(stream
);
814 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
815 SET_TMP_PREFIX("trace-");
816 format_trace(buf_ch
, false, tmp_prefix
, trace
);
819 static inline void format_event_common(char **buf_ch
, bool extended
,
820 const char *prefix
, struct bt_event_common
*event
,
821 format_func format_event_class_func
,
822 format_func format_stream_class_func
,
823 format_func format_trace_func
)
825 struct bt_trace_common
*trace
;
826 struct bt_stream_class_common
*stream_class
;
833 BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, "
834 "%sstream-context-field-addr=%p, "
835 "%scontext-field-addr=%p, %spayload-field-addr=%p, ",
836 PRFIELD(event
->frozen
),
837 PRFIELD(event
->header_field
? event
->header_field
->field
: NULL
),
838 PRFIELD(event
->stream_event_context_field
),
839 PRFIELD(event
->context_field
),
840 PRFIELD(event
->payload_field
));
841 BUF_APPEND(", %sevent-class-addr=%p", PRFIELD(event
->class));
847 SET_TMP_PREFIX("event-class-");
848 format_event_class_func(buf_ch
, false, tmp_prefix
, event
->class);
849 stream_class
= bt_event_class_common_borrow_stream_class(event
->class);
851 BUF_APPEND(", %sstream-class-addr=%p", PRFIELD(stream_class
));
852 SET_TMP_PREFIX("stream-class-");
853 format_stream_class_func(buf_ch
, false, tmp_prefix
,
856 trace
= bt_stream_class_common_borrow_trace(stream_class
);
858 BUF_APPEND(", %strace-addr=%p", PRFIELD(trace
));
859 SET_TMP_PREFIX("trace-");
860 format_trace_func(buf_ch
, false, tmp_prefix
, trace
);
865 static inline void format_event(char **buf_ch
, bool extended
,
866 const char *prefix
, struct bt_event
*event
)
868 struct bt_packet
*packet
;
869 struct bt_stream
*stream
;
872 format_event_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(event
),
873 (format_func
) format_event_class
,
874 (format_func
) format_stream_class
, (format_func
) format_trace
);
880 if (event
->clock_values
) {
881 BUF_APPEND(", %sclock-value-count=%u",
882 PRFIELD(g_hash_table_size(event
->clock_values
)));
885 packet
= bt_event_borrow_packet(event
);
890 BUF_APPEND(", %spacket-addr=%p", PRFIELD(packet
));
891 SET_TMP_PREFIX("packet-");
892 format_packet(buf_ch
, false, tmp_prefix
, packet
);
893 stream
= bt_packet_borrow_stream(packet
);
898 BUF_APPEND(", %sstream-addr=%p", PRFIELD(stream
));
899 SET_TMP_PREFIX("stream-");
900 format_stream(buf_ch
, false, tmp_prefix
, stream
);
903 static inline void format_writer_event(char **buf_ch
, bool extended
,
904 const char *prefix
, struct bt_event
*event
)
906 format_event_common(buf_ch
, extended
, prefix
, BT_TO_COMMON(event
),
907 (format_func
) format_writer_event_class
,
908 (format_func
) format_writer_stream_class
,
909 (format_func
) format_writer_trace
);
912 static inline void format_clock_class(char **buf_ch
, bool extended
,
913 const char *prefix
, struct bt_clock_class
*clock_class
)
917 BUF_APPEND(", %sname=\"%s\", %sfreq=%" PRIu64
,
918 PRFIELD(clock_class
->name
->str
),
919 PRFIELD(clock_class
->frequency
));
925 if (clock_class
->description
) {
926 BUF_APPEND(", %spartial-description=\"%.32s\"",
927 PRFIELD(clock_class
->description
->str
));
930 BUF_APPEND(", %sis-frozen=%d, %sprecision=%" PRIu64
", "
931 "%soffset-s=%" PRId64
", "
932 "%soffset-cycles=%" PRId64
", %sis-absolute=%d",
933 PRFIELD(clock_class
->frozen
), PRFIELD(clock_class
->precision
),
934 PRFIELD(clock_class
->offset_s
), PRFIELD(clock_class
->offset
),
935 PRFIELD(clock_class
->absolute
));
937 if (clock_class
->uuid_set
) {
938 BUF_APPEND_UUID(clock_class
->uuid
);
941 SET_TMP_PREFIX("cv-pool-");
942 format_object_pool(buf_ch
, extended
, prefix
, &clock_class
->cv_pool
);
945 static inline void format_clock_value(char **buf_ch
, bool extended
,
946 const char *prefix
, struct bt_clock_value
*clock_value
)
949 BUF_APPEND(", %svalue=%" PRIu64
", %sns-from-epoch=%" PRId64
,
950 PRFIELD(clock_value
->value
),
951 PRFIELD(clock_value
->ns_from_epoch
));
957 BUF_APPEND(", %sis-frozen=%d, %sis-set=%d",
958 PRFIELD(clock_value
->frozen
), PRFIELD(clock_value
->is_set
));
959 BUF_APPEND(", %sclock-class-addr=%p",
960 PRFIELD(clock_value
->clock_class
));
961 SET_TMP_PREFIX("clock-class-");
962 format_clock_class(buf_ch
, false, tmp_prefix
, clock_value
->clock_class
);
965 static inline void format_value(char **buf_ch
, bool extended
,
966 const char *prefix
, struct bt_value
*value
)
968 BUF_APPEND(", %stype=%s",
969 PRFIELD(bt_value_type_string(bt_value_get_type(value
))));
975 switch (bt_value_get_type(value
)) {
976 case BT_VALUE_TYPE_BOOL
:
980 (void) bt_value_bool_get(value
, &val
);
981 BUF_APPEND(", %svalue=%d", PRFIELD(val
));
984 case BT_VALUE_TYPE_INTEGER
:
988 (void) bt_value_integer_get(value
, &val
);
989 BUF_APPEND(", %svalue=%" PRId64
, PRFIELD(val
));
992 case BT_VALUE_TYPE_FLOAT
:
996 (void) bt_value_float_get(value
, &val
);
997 BUF_APPEND(", %svalue=%f", PRFIELD(val
));
1000 case BT_VALUE_TYPE_STRING
:
1004 (void) bt_value_string_get(value
, &val
);
1005 BUF_APPEND(", %spartial-value=\"%.32s\"", PRFIELD(val
));
1008 case BT_VALUE_TYPE_ARRAY
:
1010 int64_t count
= bt_value_array_size(value
);
1012 BT_ASSERT(count
>= 0);
1013 BUF_APPEND(", %selement-count=%" PRId64
, PRFIELD(count
));
1016 case BT_VALUE_TYPE_MAP
:
1018 int64_t count
= bt_value_map_size(value
);
1020 BT_ASSERT(count
>= 0);
1021 BUF_APPEND(", %selement-count=%" PRId64
, PRFIELD(count
));
1029 static inline void format_notification(char **buf_ch
, bool extended
,
1030 const char *prefix
, struct bt_notification
*notif
)
1032 char tmp_prefix
[64];
1034 BUF_APPEND(", %stype=%s",
1035 PRFIELD(bt_notification_type_string(notif
->type
)));
1041 BUF_APPEND(", %sis-frozen=%d", PRFIELD(notif
->frozen
));
1043 switch (notif
->type
) {
1044 case BT_NOTIFICATION_TYPE_EVENT
:
1046 struct bt_notification_event
*notif_event
= (void *) notif
;
1048 SET_TMP_PREFIX("event-");
1049 format_event(buf_ch
, true, tmp_prefix
, notif_event
->event
);
1051 if (!notif_event
->cc_prio_map
) {
1055 BUF_APPEND(", %scc-prio-map-addr=%p, %scc-prio-map-cc-count=%u",
1056 PRFIELD(notif_event
->cc_prio_map
),
1057 PRFIELD(notif_event
->cc_prio_map
->entries
->len
));
1060 case BT_NOTIFICATION_TYPE_INACTIVITY
:
1062 struct bt_notification_inactivity
*notif_inactivity
=
1065 if (!notif_inactivity
->cc_prio_map
) {
1069 BUF_APPEND(", %scc-prio-map-addr=%p, %scc-prio-map-cc-count=%u",
1070 PRFIELD(notif_inactivity
->cc_prio_map
),
1071 PRFIELD(notif_inactivity
->cc_prio_map
->entries
->len
));
1074 case BT_NOTIFICATION_TYPE_STREAM_BEGIN
:
1076 struct bt_notification_stream_begin
*notif_stream
=
1079 SET_TMP_PREFIX("stream-");
1080 format_stream(buf_ch
, true, tmp_prefix
, notif_stream
->stream
);
1083 case BT_NOTIFICATION_TYPE_STREAM_END
:
1085 struct bt_notification_stream_end
*notif_stream
=
1088 SET_TMP_PREFIX("stream-");
1089 format_stream(buf_ch
, true, tmp_prefix
, notif_stream
->stream
);
1092 case BT_NOTIFICATION_TYPE_PACKET_BEGIN
:
1094 struct bt_notification_packet_begin
*notif_packet
=
1097 SET_TMP_PREFIX("packet-");
1098 format_packet(buf_ch
, true, tmp_prefix
, notif_packet
->packet
);
1101 case BT_NOTIFICATION_TYPE_PACKET_END
:
1103 struct bt_notification_packet_end
*notif_packet
=
1106 SET_TMP_PREFIX("packet-");
1107 format_packet(buf_ch
, true, tmp_prefix
, notif_packet
->packet
);
1110 case BT_NOTIFICATION_TYPE_DISCARDED_EVENTS
:
1111 case BT_NOTIFICATION_TYPE_DISCARDED_PACKETS
:
1113 struct bt_notification_discarded_elements
*notif_discarded
=
1116 BUF_APPEND(", %scount=%" PRId64
,
1117 PRFIELD(notif_discarded
->count
));
1119 if (notif_discarded
->begin_clock_value
) {
1120 SET_TMP_PREFIX("begin-clock-value-");
1121 format_clock_value(buf_ch
, true, tmp_prefix
,
1122 notif_discarded
->begin_clock_value
);
1125 if (notif_discarded
->end_clock_value
) {
1126 SET_TMP_PREFIX("end-clock-value-");
1127 format_clock_value(buf_ch
, true, tmp_prefix
,
1128 notif_discarded
->end_clock_value
);
1137 static inline void format_plugin_so_shared_lib_handle(char **buf_ch
,
1139 struct bt_plugin_so_shared_lib_handle
*handle
)
1141 BUF_APPEND(", %saddr=%p", PRFIELD(handle
));
1144 BUF_APPEND(", %spath=\"%s\"", PRFIELD(handle
->path
->str
));
1148 static inline void format_component_class(char **buf_ch
, bool extended
,
1149 const char *prefix
, struct bt_component_class
*comp_class
)
1151 char tmp_prefix
[64];
1153 BUF_APPEND(", %stype=%s, %sname=\"%s\"",
1154 PRFIELD(bt_component_class_type_string(comp_class
->type
)),
1155 PRFIELD(comp_class
->name
? comp_class
->name
->str
: NULL
));
1157 if (comp_class
->description
) {
1158 BUF_APPEND(", %spartial-descr=\"%.32s\"",
1159 PRFIELD(comp_class
->description
->str
));
1166 BUF_APPEND(", %sis-frozen=%d", PRFIELD(comp_class
->frozen
));
1168 if (comp_class
->so_handle
) {
1169 SET_TMP_PREFIX("so-handle-");
1170 format_plugin_so_shared_lib_handle(buf_ch
, tmp_prefix
,
1171 comp_class
->so_handle
);
1175 static inline void format_component(char **buf_ch
, bool extended
,
1176 const char *prefix
, struct bt_component
*component
)
1178 char tmp_prefix
[64];
1180 BUF_APPEND(", %sname=\"%s\"", PRFIELD(component
->name
->str
));
1181 SET_TMP_PREFIX("class-");
1182 format_component_class(buf_ch
, extended
, tmp_prefix
, component
->class);
1188 if (component
->input_ports
) {
1189 BUF_APPEND(", %sinput-port-count=%u",
1190 PRFIELD(component
->input_ports
->len
));
1193 if (component
->output_ports
) {
1194 BUF_APPEND(", %soutput-port-count=%u",
1195 PRFIELD(component
->output_ports
->len
));
1199 static inline void format_port(char **buf_ch
, bool extended
,
1200 const char *prefix
, struct bt_port
*port
)
1202 char tmp_prefix
[64];
1204 BUF_APPEND(", %stype=%s, %sname=\"%s\"",
1205 PRFIELD(bt_port_type_string(port
->type
)),
1206 PRFIELD(port
->name
->str
));
1212 if (port
->connection
) {
1213 SET_TMP_PREFIX("conn-");
1214 format_connection(buf_ch
, false, tmp_prefix
, port
->connection
);
1218 static inline void format_connection(char **buf_ch
, bool extended
,
1219 const char *prefix
, struct bt_connection
*connection
)
1221 char tmp_prefix
[64];
1227 if (connection
->upstream_port
) {
1228 SET_TMP_PREFIX("upstream-port-");
1229 format_port(buf_ch
, false, tmp_prefix
,
1230 connection
->upstream_port
);
1233 if (connection
->downstream_port
) {
1234 SET_TMP_PREFIX("downstream-port-");
1235 format_port(buf_ch
, false, tmp_prefix
,
1236 connection
->downstream_port
);
1240 static inline void format_graph(char **buf_ch
, bool extended
,
1241 const char *prefix
, struct bt_graph
*graph
)
1243 BUF_APPEND(", %sis-canceled=%d", PRFIELD(graph
->canceled
));
1249 if (graph
->components
) {
1250 BUF_APPEND(", %scomp-count=%u",
1251 PRFIELD(graph
->components
->len
));
1254 if (graph
->connections
) {
1255 BUF_APPEND(", %sconn-count=%u",
1256 PRFIELD(graph
->connections
->len
));
1260 static inline void format_notification_iterator(char **buf_ch
,
1261 bool extended
, const char *prefix
,
1262 struct bt_notification_iterator
*iterator
)
1265 char tmp_prefix
[64];
1267 if (iterator
->type
== BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION
) {
1268 type
= "BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION";
1269 } else if (iterator
->type
== BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT
) {
1270 type
= "BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT";
1275 BUF_APPEND(", %stype=%s", PRFIELD(type
));
1277 switch (iterator
->type
) {
1278 case BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION
:
1280 struct bt_notification_iterator_private_connection
*
1281 iter_priv_conn
= (void *) iterator
;
1283 if (iter_priv_conn
->upstream_component
) {
1284 SET_TMP_PREFIX("upstream-comp-");
1285 format_component(buf_ch
, false, tmp_prefix
,
1286 iter_priv_conn
->upstream_component
);
1289 if (iter_priv_conn
->upstream_port
) {
1290 SET_TMP_PREFIX("upstream-port-");
1291 format_port(buf_ch
, false, tmp_prefix
,
1292 iter_priv_conn
->upstream_port
);
1295 if (iter_priv_conn
->connection
) {
1296 SET_TMP_PREFIX("upstream-conn-");
1297 format_connection(buf_ch
, false, tmp_prefix
,
1298 iter_priv_conn
->connection
);
1302 case BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT
:
1304 struct bt_notification_iterator_output_port
*iter_output_port
=
1307 SET_TMP_PREFIX("graph-");
1308 format_graph(buf_ch
, false, tmp_prefix
,
1309 iter_output_port
->graph
);
1310 SET_TMP_PREFIX("colander-comp-");
1311 format_component(buf_ch
, false, tmp_prefix
,
1312 iter_output_port
->colander
);
1313 SET_TMP_PREFIX("output-port-");
1314 format_port(buf_ch
, false, tmp_prefix
,
1315 iter_output_port
->output_port
);
1323 static inline void format_plugin(char **buf_ch
, bool extended
,
1324 const char *prefix
, struct bt_plugin
*plugin
)
1326 char tmp_prefix
[64];
1328 BUF_APPEND(", %stype=%s", PRFIELD(bt_plugin_type_string(plugin
->type
)));
1330 if (plugin
->info
.path_set
) {
1331 BUF_APPEND(", %spath=\"%s\"",
1332 PRFIELD(plugin
->info
.path
->str
));
1335 if (plugin
->info
.name_set
) {
1336 BUF_APPEND(", %sname=\"%s\"",
1337 PRFIELD(plugin
->info
.name
->str
));
1344 if (plugin
->info
.author_set
) {
1345 BUF_APPEND(", %sauthor=\"%s\"",
1346 PRFIELD(plugin
->info
.author
->str
));
1349 if (plugin
->info
.license_set
) {
1350 BUF_APPEND(", %slicense=\"%s\"",
1351 PRFIELD(plugin
->info
.license
->str
));
1354 if (plugin
->info
.version_set
) {
1355 BUF_APPEND(", %sversion=%u.%u.%u%s",
1356 PRFIELD(plugin
->info
.version
.major
),
1357 plugin
->info
.version
.minor
,
1358 plugin
->info
.version
.patch
,
1359 plugin
->info
.version
.extra
?
1360 plugin
->info
.version
.extra
->str
: "");
1363 BUF_APPEND(", %sis-frozen=%d, %scomp-class-count=%u",
1364 PRFIELD(plugin
->frozen
),
1365 PRFIELD(plugin
->comp_classes
->len
));
1367 if (plugin
->spec_data
) {
1368 struct bt_plugin_so_spec_data
*spec_data
=
1369 (void *) plugin
->spec_data
;
1371 if (spec_data
->shared_lib_handle
) {
1372 SET_TMP_PREFIX("so-handle-");
1373 format_plugin_so_shared_lib_handle(buf_ch
, tmp_prefix
,
1374 spec_data
->shared_lib_handle
);
1379 static inline void format_ctf_writer(char **buf_ch
, bool extended
,
1380 const char *prefix
, struct bt_ctf_writer
*writer
)
1385 static inline void format_stream_class_common_common(char **buf_ch
,
1386 bool extended
, const char *prefix
,
1387 struct bt_stream_class_common
*stream_class
)
1389 format_stream_class_common(buf_ch
, extended
, prefix
, stream_class
,
1390 (format_func
) format_trace_common
);
1393 static inline void format_event_class_common_common(char **buf_ch
,
1394 bool extended
, const char *prefix
,
1395 struct bt_event_class_common
*event_class
)
1397 format_event_class_common(buf_ch
, extended
, prefix
, event_class
,
1398 (format_func
) format_stream_class_common
,
1399 (format_func
) format_trace_common
);
1402 static inline void format_event_common_common(char **buf_ch
,
1403 bool extended
, const char *prefix
,
1404 struct bt_event_common
*event
)
1406 format_event_common(buf_ch
, extended
, prefix
, event
,
1407 (format_func
) format_event_class_common
,
1408 (format_func
) format_stream_class_common
,
1409 (format_func
) format_trace_common
);
1412 static inline void format_stream_common_common(char **buf_ch
, bool extended
,
1413 const char *prefix
, struct bt_stream_common
*stream
)
1415 format_stream_common(buf_ch
, extended
, prefix
, stream
,
1416 (format_func
) format_stream_class_common
,
1417 (format_func
) format_trace_common
);
1420 static inline void handle_conversion_specifier_bt(void *priv_data
,
1421 char **buf_ch
, size_t avail_size
,
1422 const char **out_fmt_ch
, va_list *args
)
1424 const char *fmt_ch
= *out_fmt_ch
;
1425 bool extended
= false;
1427 char *prefix_ch
= prefix
;
1433 } cat
= CAT_DEFAULT
;
1438 if (*fmt_ch
== '[') {
1443 if (*fmt_ch
== ']') {
1449 *prefix_ch
= *fmt_ch
;
1457 if (*fmt_ch
== '+') {
1462 if (*fmt_ch
== 'w') {
1465 } else if (*fmt_ch
== '_') {
1470 obj
= va_arg(*args
, void *);
1471 BUF_APPEND("%saddr=%p", prefix
, obj
);
1481 format_ref_count(buf_ch
, extended
, prefix
, obj
);
1484 format_field_type(buf_ch
, extended
, prefix
, obj
);
1487 format_field(buf_ch
, extended
, prefix
, obj
);
1490 format_field_path(buf_ch
, extended
, prefix
, obj
);
1493 format_event_class(buf_ch
, extended
, prefix
, obj
);
1496 format_event(buf_ch
, extended
, prefix
, obj
);
1499 format_stream_class(buf_ch
, extended
, prefix
, obj
);
1502 format_stream(buf_ch
, extended
, prefix
, obj
);
1505 format_packet(buf_ch
, extended
, prefix
, obj
);
1508 format_trace(buf_ch
, extended
, prefix
, obj
);
1511 format_clock_class(buf_ch
, extended
, prefix
, obj
);
1514 format_clock_value(buf_ch
, extended
, prefix
, obj
);
1517 format_value(buf_ch
, extended
, prefix
, obj
);
1520 format_notification(buf_ch
, extended
, prefix
, obj
);
1523 format_notification_iterator(buf_ch
, extended
, prefix
, obj
);
1526 format_component_class(buf_ch
, extended
, prefix
, obj
);
1529 format_component(buf_ch
, extended
, prefix
, obj
);
1532 format_port(buf_ch
, extended
, prefix
, obj
);
1535 format_connection(buf_ch
, extended
, prefix
, obj
);
1538 format_plugin(buf_ch
, extended
, prefix
, obj
);
1541 format_graph(buf_ch
, extended
, prefix
, obj
);
1544 format_object_pool(buf_ch
, extended
, prefix
, obj
);
1553 format_writer_field_type(buf_ch
, extended
, prefix
, obj
);
1556 format_writer_field(buf_ch
, extended
, prefix
, obj
);
1559 format_writer_event_class(buf_ch
, extended
, prefix
, obj
);
1562 format_writer_event(buf_ch
, extended
, prefix
, obj
);
1565 format_writer_stream_class(buf_ch
, extended
, prefix
, obj
);
1568 format_writer_stream(buf_ch
, extended
, prefix
, obj
);
1571 format_writer_trace(buf_ch
, extended
, prefix
, obj
);
1574 format_ctf_writer(buf_ch
, extended
, prefix
, obj
);
1583 format_field_type_common(buf_ch
, extended
, prefix
, obj
);
1586 format_field_common(buf_ch
, extended
, prefix
, obj
);
1589 format_event_class_common_common(buf_ch
, extended
, prefix
, obj
);
1592 format_event_common_common(buf_ch
, extended
, prefix
, obj
);
1595 format_stream_class_common_common(buf_ch
, extended
, prefix
, obj
);
1598 format_stream_common_common(buf_ch
, extended
, prefix
, obj
);
1601 format_trace_common(buf_ch
, extended
, prefix
, obj
);
1611 *out_fmt_ch
= fmt_ch
;
1615 void bt_lib_log(const char *func
, const char *file
, unsigned line
,
1616 int lvl
, const char *tag
, const char *fmt
, ...)
1621 va_start(args
, fmt
);
1622 bt_common_custom_vsnprintf(lib_logging_buf
, LIB_LOGGING_BUF_SIZE
, '!',
1623 handle_conversion_specifier_bt
, NULL
, fmt
, &args
);
1625 _bt_log_write_d(func
, file
, line
, lvl
, tag
, "%s", lib_logging_buf
);