X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fctf-writer%2Fstream.c;h=5576628dee3af5617e1fe9b4b48518b76e648f2c;hb=c4f23e30bf67d2523163614bc9461d84cbe1ae80;hp=a1025c7560e202ddd08389f928b08378af8987a4;hpb=578e048b5debf169e286e5b5cc747b5d6c16886d;p=babeltrace.git diff --git a/src/ctf-writer/stream.c b/src/ctf-writer/stream.c index a1025c75..5576628d 100644 --- a/src/ctf-writer/stream.c +++ b/src/ctf-writer/stream.c @@ -21,18 +21,19 @@ * SOFTWARE. */ -#define BT_LOG_TAG "CTF-WRITER-STREAM" +#define BT_LOG_TAG "CTF-WRITER/STREAM" #include "logging.h" #include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "common/align.h" #include "common/assert.h" @@ -146,7 +147,7 @@ static void bt_ctf_stream_destroy(struct bt_ctf_object *obj); static -int try_set_structure_field_integer(struct bt_ctf_field *, char *, uint64_t); +int try_set_structure_field_integer(struct bt_ctf_field *, const char *, uint64_t); static int set_integer_field_value(struct bt_ctf_field* field, uint64_t value) @@ -161,7 +162,7 @@ int set_integer_field_value(struct bt_ctf_field* field, uint64_t value) } field_type = bt_ctf_field_get_type(field); - BT_ASSERT(field_type); + BT_ASSERT_DBG(field_type); if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { @@ -207,11 +208,11 @@ int set_packet_header_magic(struct bt_ctf_stream *stream) stream->packet_header, "magic"); const uint32_t magic_value = 0xc1fc1fc1; - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); if (!magic_field) { /* No magic field found. Not an error, skip. */ - BT_LOGV("No field named `magic` in packet header: skipping: " + BT_LOGT("No field named `magic` in packet header: skipping: " "stream-addr=%p, stream-name=\"%s\"", stream, bt_ctf_stream_get_name(stream)); goto end; @@ -226,7 +227,7 @@ int set_packet_header_magic(struct bt_ctf_stream *stream) stream, bt_ctf_stream_get_name(stream), magic_field, (uint64_t) magic_value); } else { - BT_LOGV("Set packet header field's `magic` field's value: " + BT_LOGT("Set packet header field's `magic` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, stream, bt_ctf_stream_get_name(stream), magic_field, (uint64_t) magic_value); @@ -245,11 +246,11 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) struct bt_ctf_field *uuid_field = bt_ctf_field_structure_get_field_by_name( stream->packet_header, "uuid"); - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); if (!uuid_field) { /* No uuid field found. Not an error, skip. */ - BT_LOGV("No field named `uuid` in packet header: skipping: " + BT_LOGT("No field named `uuid` in packet header: skipping: " "stream-addr=%p, stream-name=\"%s\"", stream, bt_ctf_stream_get_name(stream)); goto end; @@ -275,7 +276,7 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) } } - BT_LOGV("Set packet header field's `uuid` field's value: " + BT_LOGT("Set packet header field's `uuid` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p", stream, bt_ctf_stream_get_name(stream), uuid_field); @@ -295,7 +296,7 @@ int set_packet_header_stream_id(struct bt_ctf_stream *stream) if (!stream_id_field) { /* No stream_id field found. Not an error, skip. */ - BT_LOGV("No field named `stream_id` in packet header: skipping: " + BT_LOGT("No field named `stream_id` in packet header: skipping: " "stream-addr=%p, stream-name=\"%s\"", stream, bt_ctf_stream_get_name(stream)); goto end; @@ -310,7 +311,7 @@ int set_packet_header_stream_id(struct bt_ctf_stream *stream) stream, bt_ctf_stream_get_name(stream), stream_id_field, (uint64_t) stream_id); } else { - BT_LOGV("Set packet header field's `stream_id` field's value: " + BT_LOGT("Set packet header field's `stream_id` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, stream, bt_ctf_stream_get_name(stream), stream_id_field, (uint64_t) stream_id); @@ -354,7 +355,7 @@ int auto_populate_packet_header(struct bt_ctf_stream *stream) goto end; } - BT_LOGV("Automatically populated stream's packet header's known fields: " + BT_LOGT("Automatically populated stream's packet header's known fields: " "stream-addr=%p, stream-name=\"%s\"", stream, bt_ctf_stream_get_name(stream)); @@ -377,7 +378,7 @@ int set_packet_context_packet_size(struct bt_ctf_stream *stream, stream, bt_ctf_stream_get_name(stream), field, packet_size_bits); } else { - BT_LOGV("Set packet context field's `packet_size` field's value: " + BT_LOGT("Set packet context field's `packet_size` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, stream, bt_ctf_stream_get_name(stream), field, packet_size_bits); @@ -395,11 +396,11 @@ int set_packet_context_content_size(struct bt_ctf_stream *stream, struct bt_ctf_field *field = bt_ctf_field_structure_get_field_by_name( stream->packet_context, "content_size"); - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); if (!field) { /* No content size field found. Not an error, skip. */ - BT_LOGV("No field named `content_size` in packet context: skipping: " + BT_LOGT("No field named `content_size` in packet context: skipping: " "stream-addr=%p, stream-name=\"%s\"", stream, bt_ctf_stream_get_name(stream)); goto end; @@ -412,7 +413,7 @@ int set_packet_context_content_size(struct bt_ctf_stream *stream, stream, bt_ctf_stream_get_name(stream), field, content_size_bits); } else { - BT_LOGV("Set packet context field's `content_size` field's value: " + BT_LOGT("Set packet context field's `content_size` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, stream, bt_ctf_stream_get_name(stream), field, content_size_bits); @@ -430,11 +431,11 @@ int set_packet_context_events_discarded(struct bt_ctf_stream *stream) struct bt_ctf_field *field = bt_ctf_field_structure_get_field_by_name( stream->packet_context, "events_discarded"); - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); if (!field) { /* No discarded events count field found. Not an error, skip. */ - BT_LOGV("No field named `events_discarded` in packet context: skipping: " + BT_LOGT("No field named `events_discarded` in packet context: skipping: " "stream-addr=%p, stream-name=\"%s\"", stream, bt_ctf_stream_get_name(stream)); goto end; @@ -479,7 +480,7 @@ int set_packet_context_events_discarded(struct bt_ctf_stream *stream) stream, bt_ctf_stream_get_name(stream), field, stream->discarded_events); } else { - BT_LOGV("Set packet context field's `events_discarded` field's value: " + BT_LOGT("Set packet context field's `events_discarded` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, stream, bt_ctf_stream_get_name(stream), field, stream->discarded_events); @@ -499,7 +500,7 @@ void update_clock_value(uint64_t *val, uint64_t new_val, const uint64_t mask = pow2 - 1; uint64_t val_masked; -#ifdef BT_LOG_ENABLED_VERBOSE +#ifdef BT_LOG_ENABLED_TRACE uint64_t old_val = *val; #endif @@ -519,7 +520,7 @@ void update_clock_value(uint64_t *val, uint64_t new_val, *val |= new_val; end: - BT_LOGV("Updated clock value: old-val=%" PRIu64 ", new-val=%" PRIu64, + BT_LOGT("Updated clock value: old-val=%" PRIu64 ", new-val=%" PRIu64, old_val, *val); return; } @@ -550,7 +551,7 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) bt_ctf_object_put_ref(cc); val_size = bt_ctf_field_type_integer_get_size( (void *) field_common->type); - BT_ASSERT(val_size >= 1); + BT_ASSERT_DBG(val_size >= 1); if (bt_ctf_field_type_integer_is_signed( (void *) field_common->type)) { @@ -575,7 +576,7 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) struct bt_ctf_field *int_field = bt_ctf_field_enumeration_get_container(field); - BT_ASSERT(int_field); + BT_ASSERT_DBG(int_field); ret = visit_field_update_clock_value(int_field, val); bt_ctf_object_put_ref(int_field); break; @@ -586,13 +587,13 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) int64_t len = bt_ctf_field_type_array_get_length( (void *) field_common->type); - BT_ASSERT(len >= 0); + BT_ASSERT_DBG(len >= 0); for (i = 0; i < len; i++) { struct bt_ctf_field *elem_field = bt_ctf_field_array_get_field(field, i); - BT_ASSERT(elem_field); + BT_ASSERT_DBG(elem_field); ret = visit_field_update_clock_value(elem_field, val); bt_ctf_object_put_ref(elem_field); if (ret) { @@ -616,7 +617,7 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) struct bt_ctf_field *elem_field = bt_ctf_field_sequence_get_field(field, i); - BT_ASSERT(elem_field); + BT_ASSERT_DBG(elem_field); ret = visit_field_update_clock_value(elem_field, val); bt_ctf_object_put_ref(elem_field); if (ret) { @@ -631,13 +632,13 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) int64_t len = bt_ctf_field_type_structure_get_field_count( (void *) field_common->type); - BT_ASSERT(len >= 0); + BT_ASSERT_DBG(len >= 0); for (i = 0; i < len; i++) { struct bt_ctf_field *member_field = bt_ctf_field_structure_get_field_by_index(field, i); - BT_ASSERT(member_field); + BT_ASSERT_DBG(member_field); ret = visit_field_update_clock_value(member_field, val); bt_ctf_object_put_ref(member_field); if (ret) { @@ -668,6 +669,7 @@ end: return ret; } +static int visit_event_update_clock_value(struct bt_ctf_event *event, uint64_t *val) { int ret = 0; @@ -732,7 +734,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) if (ts_begin_field && bt_ctf_field_is_set_recursive(ts_begin_field)) { /* Use provided `timestamp_begin` value as starting value */ ret = bt_ctf_field_integer_unsigned_get_value(ts_begin_field, &val); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); init_clock_value = val; } else if (stream->last_ts_end != -1ULL) { /* Use last packet's ending timestamp as starting value */ @@ -768,7 +770,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) */ len = bt_ctf_field_type_structure_get_field_count( (void *) packet_context->type); - BT_ASSERT(len >= 0); + BT_ASSERT_DBG(len >= 0); for (i = 0; i < len; i++) { const char *member_name; @@ -776,7 +778,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) ret = bt_ctf_field_type_structure_get_field_by_index( (void *) packet_context->type, &member_name, NULL, i); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); if (strcmp(member_name, "timestamp_begin") == 0 || strcmp(member_name, "timestamp_end") == 0) { @@ -785,7 +787,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) member_field = bt_ctf_field_structure_get_field_by_index( stream->packet_context, i); - BT_ASSERT(member_field); + BT_ASSERT_DBG(member_field); if (strcmp(member_name, "packet_size") == 0 && !bt_ctf_field_is_set_recursive(member_field)) { @@ -828,7 +830,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) for (i = 0; i < stream->events->len; i++) { struct bt_ctf_event *event = g_ptr_array_index(stream->events, i); - BT_ASSERT(event); + BT_ASSERT_DBG(event); ret = visit_event_update_clock_value(event, &cur_clock_value); if (ret) { BT_LOGW("Cannot automatically update clock value " @@ -853,7 +855,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) */ if (ts_end_field && bt_ctf_field_is_set_recursive(ts_end_field)) { ret = bt_ctf_field_integer_unsigned_get_value(ts_end_field, &val); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); if (val < cur_clock_value) { BT_LOGW("Packet's final timestamp is less than " @@ -872,7 +874,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) if (ts_end_field && !bt_ctf_field_is_set_recursive(ts_end_field)) { ret = set_integer_field_value(ts_end_field, cur_clock_value); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); stream->last_ts_end = cur_clock_value; } @@ -883,7 +885,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) /* Set `timestamp_begin` field to initial clock value */ if (ts_begin_field && !bt_ctf_field_is_set_recursive(ts_begin_field)) { ret = set_integer_field_value(ts_begin_field, init_clock_value); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); } end: @@ -936,7 +938,7 @@ int auto_populate_packet_context(struct bt_ctf_stream *stream, bool set_ts, goto end; } - BT_LOGV("Automatically populated stream's packet context's known fields: " + BT_LOGT("Automatically populated stream's packet context's known fields: " "stream-addr=%p, stream-name=\"%s\"", stream, bt_ctf_stream_get_name(stream)); @@ -979,7 +981,7 @@ int create_stream_file(struct bt_ctf_writer *writer, /* Use stream name's base name as prefix */ gchar *basename = g_path_get_basename(stream->common.name->str); - BT_ASSERT(basename); + BT_ASSERT_DBG(basename); if (strcmp(basename, G_DIR_SEPARATOR_S) == 0) { g_string_assign(filename, "stream"); @@ -998,7 +1000,7 @@ int create_stream_file(struct bt_ctf_writer *writer, g_path_get_basename( stream->common.stream_class->name->str); - BT_ASSERT(basename); + BT_ASSERT_DBG(basename); if (strcmp(basename, G_DIR_SEPARATOR_S) == 0) { g_string_assign(filename, "stream"); @@ -1015,18 +1017,19 @@ int create_stream_file(struct bt_ctf_writer *writer, append_ids: stream_class_id = bt_ctf_stream_class_common_get_id(stream->common.stream_class); - BT_ASSERT(stream_class_id >= 0); - BT_ASSERT(stream->common.id >= 0); + BT_ASSERT_DBG(stream_class_id >= 0); + BT_ASSERT_DBG(stream->common.id >= 0); g_string_append_printf(filename, "-%" PRId64 "-%" PRId64, stream_class_id, stream->common.id); file_path = g_build_filename(writer->path->str, filename->str, NULL); - if (file_path == NULL) { + if (!file_path) { ret = -1; goto end; } - ret = bt_ctfser_init(&stream->ctfser, file_path); + ret = bt_ctfser_init(&stream->ctfser, file_path, + BT_LOG_OUTPUT_LEVEL); g_free(file_path); if (ret) { /* bt_ctfser_init() logs errors */ @@ -1092,7 +1095,7 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id( stream->last_ts_end = -1ULL; BT_LOGD("CTF writer stream object belongs writer's trace: " "writer-addr=%p", writer); - BT_ASSERT(writer); + BT_ASSERT_DBG(writer); if (stream_class->common.packet_context_field_type) { BT_LOGD("Creating stream's packet context field: " @@ -1248,7 +1251,7 @@ void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, goto end; } - BT_LOGV("Appending discarded events to stream: " + BT_LOGT("Appending discarded events to stream: " "stream-addr=%p, stream-name=\"%s\", append-count=%" PRIu64, stream, bt_ctf_stream_get_name(stream), event_count); @@ -1279,7 +1282,7 @@ void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, } stream->discarded_events = new_count; - BT_LOGV("Appended discarded events to stream: " + BT_LOGT("Appended discarded events to stream: " "stream-addr=%p, stream-name=\"%s\", append-count=%" PRIu64, stream, bt_ctf_stream_get_name(stream), event_count); @@ -1298,7 +1301,7 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, BT_CTF_TO_COMMON(stream))); int64_t event_class_id; - BT_ASSERT(event); + BT_ASSERT_DBG(event); if (!event->common.header_field) { goto end; @@ -1310,14 +1313,14 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, goto end; } - BT_LOGV("Automatically populating event's header field: " + BT_LOGT("Automatically populating event's header field: " "stream-addr=%p, stream-name=\"%s\", event-addr=%p", stream, bt_ctf_stream_get_name(stream), event); id_field = bt_ctf_field_structure_get_field_by_name( (void *) event->common.header_field->field, "id"); event_class_id = bt_ctf_event_class_common_get_id(event->common.class); - BT_ASSERT(event_class_id >= 0); + BT_ASSERT_DBG(event_class_id >= 0); if (id_field && bt_ctf_field_get_type_id(id_field) == BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = set_integer_field_value(id_field, event_class_id); @@ -1349,12 +1352,12 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, if (mapped_clock_class) { uint64_t timestamp; - BT_ASSERT(mapped_clock_class == + BT_ASSERT_DBG(mapped_clock_class == stream_class->clock->clock_class); ret = bt_ctf_clock_get_value( stream_class->clock, ×tamp); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); ret = set_integer_field_value(timestamp_field, timestamp); if (ret) { @@ -1366,7 +1369,7 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, } } - BT_LOGV("Automatically populated event's header field: " + BT_LOGT("Automatically populated event's header field: " "stream-addr=%p, stream-name=\"%s\", event-addr=%p", stream, bt_ctf_stream_get_name(stream), event); @@ -1394,7 +1397,7 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, goto end; } - BT_LOGV("Appending event to stream: " + BT_LOGT("Appending event to stream: " "stream-addr=%p, stream-name=\"%s\", event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, stream, bt_ctf_stream_get_name(stream), event, @@ -1417,7 +1420,7 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, } bt_ctf_object_set_parent(&event->common.base, &stream->common.base); - BT_LOGV_STR("Automatically populating the header of the event to append."); + BT_LOGT_STR("Automatically populating the header of the event to append."); ret = auto_populate_event_header(stream, event); if (ret) { /* auto_populate_event_header() reports errors */ @@ -1425,12 +1428,12 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, } /* Make sure the various scopes of the event are set */ - BT_LOGV_STR("Validating event to append."); + BT_LOGT_STR("Validating event to append."); BT_CTF_ASSERT_PRE(bt_ctf_event_common_validate(BT_CTF_TO_COMMON(event)) == 0, "Invalid event: event-addr=%p", event); /* Save the new event and freeze it */ - BT_LOGV_STR("Freezing the event to append."); + BT_LOGT_STR("Freezing the event to append."); bt_ctf_event_common_set_is_frozen(BT_CTF_TO_COMMON(event), true); g_ptr_array_add(stream->events, event); @@ -1440,9 +1443,9 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, * class share the same lifetime guarantees and the reference is no * longer needed. */ - BT_LOGV_STR("Putting the event's class."); + BT_LOGT_STR("Putting the event's class."); bt_ctf_object_put_ref(event->common.class); - BT_LOGV("Appended event to stream: " + BT_LOGT("Appended event to stream: " "stream-addr=%p, stream-name=\"%s\", event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, stream, bt_ctf_stream_get_name(stream), event, @@ -1508,7 +1511,7 @@ int bt_ctf_stream_set_packet_context(struct bt_ctf_stream *stream, bt_ctf_object_put_ref(field_type); bt_ctf_object_put_ref(stream->packet_context); stream->packet_context = bt_ctf_object_get_ref(field); - BT_LOGV("Set stream's packet context field: " + BT_LOGT("Set stream's packet context field: " "stream-addr=%p, stream-name=\"%s\", " "packet-context-field-addr=%p", stream, bt_ctf_stream_get_name(stream), field); @@ -1565,7 +1568,7 @@ int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, } field_type = bt_ctf_field_get_type(field); - BT_ASSERT(field_type); + BT_ASSERT_DBG(field_type); if (bt_ctf_field_type_common_compare((void *) field_type, trace->common.packet_header_field_type)) { @@ -1582,7 +1585,7 @@ int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, skip_validation: bt_ctf_object_put_ref(stream->packet_header); stream->packet_header = bt_ctf_object_get_ref(field); - BT_LOGV("Set stream's packet header field: " + BT_LOGT("Set stream's packet header field: " "stream-addr=%p, stream-name=\"%s\", " "packet-header-field-addr=%p", stream, bt_ctf_stream_get_name(stream), field); @@ -1626,7 +1629,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) packet_size_field = bt_ctf_field_structure_get_field_by_name( stream->packet_context, "packet_size"); - has_packet_size = (packet_size_field != NULL); + has_packet_size = packet_size_field; bt_ctf_object_put_ref(packet_size_field); } @@ -1644,12 +1647,12 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) } } - BT_LOGV("Flushing stream's current packet: stream-addr=%p, " + BT_LOGT("Flushing stream's current packet: stream-addr=%p, " "stream-name=\"%s\", packet-index=%u", stream, bt_ctf_stream_get_name(stream), stream->flushed_packet_count); trace = BT_CTF_FROM_COMMON(bt_ctf_stream_class_common_borrow_trace( stream->common.stream_class)); - BT_ASSERT(trace); + BT_ASSERT_DBG(trace); native_byte_order = bt_ctf_trace_get_native_byte_order(trace); ret = auto_populate_packet_header(stream); @@ -1675,7 +1678,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) } if (stream->packet_header) { - BT_LOGV_STR("Serializing packet header field (initial)."); + BT_LOGT_STR("Serializing packet header field (initial)."); ret = bt_ctf_field_serialize_recursive(stream->packet_header, &stream->ctfser, native_byte_order); if (ret) { @@ -1692,7 +1695,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) &stream->ctfser); /* Write packet context */ - BT_LOGV_STR("Serializing packet context field (initial)."); + BT_LOGT_STR("Serializing packet context field (initial)."); ret = bt_ctf_field_serialize_recursive(stream->packet_context, &stream->ctfser, native_byte_order); if (ret) { @@ -1702,7 +1705,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) } } - BT_LOGV("Serializing events: count=%u", stream->events->len); + BT_LOGT("Serializing events: count=%u", stream->events->len); for (i = 0; i < stream->events->len; i++) { struct bt_ctf_event *event = g_ptr_array_index( @@ -1711,7 +1714,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) BT_CTF_FROM_COMMON(bt_ctf_event_common_borrow_class( BT_CTF_TO_COMMON(event))); - BT_LOGV("Serializing event: index=%zu, event-addr=%p, " + BT_LOGT("Serializing event: index=%zu, event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "ser-offset=%" PRIu64, i, event, bt_ctf_event_class_get_name(event_class), @@ -1721,7 +1724,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) /* Write event header */ if (event->common.header_field) { - BT_LOGV_STR("Serializing event's header field."); + BT_LOGT_STR("Serializing event's header field."); ret = bt_ctf_field_serialize_recursive( (void *) event->common.header_field->field, &stream->ctfser, native_byte_order); @@ -1735,7 +1738,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) /* Write stream event context */ if (event->common.stream_event_context_field) { - BT_LOGV_STR("Serializing event's stream event context field."); + BT_LOGT_STR("Serializing event's stream event context field."); ret = bt_ctf_field_serialize_recursive( (void *) event->common.stream_event_context_field, &stream->ctfser, native_byte_order); @@ -1812,7 +1815,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) goto end; } - BT_LOGV("Rewriting (serializing) packet context field."); + BT_LOGT("Rewriting (serializing) packet context field."); ret = bt_ctf_field_serialize_recursive(stream->packet_context, &stream->ctfser, native_byte_order); if (ret) { @@ -1837,7 +1840,7 @@ end: } if (ret == 0) { - BT_LOGV("Flushed stream's current packet: " + BT_LOGT("Flushed stream's current packet: " "content-size=%" PRIu64 ", packet-size=%" PRIu64, content_size_bits, packet_size_bits); } @@ -1870,20 +1873,20 @@ void bt_ctf_stream_destroy(struct bt_ctf_object *obj) } static -int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, - uint64_t value, bt_bool force) +int _set_structure_field_integer(struct bt_ctf_field *structure, const char *name, + uint64_t value, bt_ctf_bool force) { int ret = 0; struct bt_ctf_field_type *field_type = NULL; struct bt_ctf_field *integer; - BT_ASSERT(structure); - BT_ASSERT(name); + BT_ASSERT_DBG(structure); + BT_ASSERT_DBG(name); integer = bt_ctf_field_structure_get_field_by_name(structure, name); if (!integer) { /* Field not found, not an error. */ - BT_LOGV("Field not found: struct-field-addr=%p, " + BT_LOGT("Field not found: struct-field-addr=%p, " "name=\"%s\", force=%d", structure, name, force); goto end; } @@ -1891,13 +1894,13 @@ int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, /* Make sure the payload has not already been set. */ if (!force && bt_ctf_field_is_set_recursive(integer)) { /* Payload already set, not an error */ - BT_LOGV("Field's payload is already set: struct-field-addr=%p, " + BT_LOGT("Field's payload is already set: struct-field-addr=%p, " "name=\"%s\", force=%d", structure, name, force); goto end; } field_type = bt_ctf_field_get_type(integer); - BT_ASSERT(field_type); + BT_ASSERT_DBG(field_type); if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { /* * The user most likely meant for us to populate this field @@ -1933,10 +1936,10 @@ end: * <0 if an error was encoutered */ static -int try_set_structure_field_integer(struct bt_ctf_field *structure, char *name, +int try_set_structure_field_integer(struct bt_ctf_field *structure, const char *name, uint64_t value) { - return _set_structure_field_integer(structure, name, value, BT_FALSE); + return _set_structure_field_integer(structure, name, value, BT_CTF_FALSE); } struct bt_ctf_stream_class *bt_ctf_stream_get_class(