bt_common_get_page_size(static_cast<int>(ctf_fs_trace->logger.level())) * 8,
ctf_fs_ds_file_medops, ds_file.get(), nullptr, ctf_fs_trace->logger);
if (!msg_iter) {
- BT_CPPLOGE_STR_SPEC(ctf_fs_trace->logger, "Cannot create a CTF message iterator.");
+ BT_CPPLOGE_SPEC(ctf_fs_trace->logger, "Cannot create a CTF message iterator.");
return -1;
}
* there's no timestamp to order the file within its
* group.
*/
- auto new_ds_file_group =
- ctf_fs_ds_file_group_create(ctf_fs_trace, sc, UINT64_C(-1), std::move(*index));
-
- if (!new_ds_file_group) {
- return -1;
- }
-
- new_ds_file_group->insert_ds_file_info_sorted(std::move(ds_file_info));
- ctf_fs_trace->ds_file_groups.emplace_back(std::move(new_ds_file_group));
+ ctf_fs_trace->ds_file_groups.emplace_back(bt2s::make_unique<ctf_fs_ds_file_group>(
+ ctf_fs_trace, sc, UINT64_C(-1), std::move(*index)));
+ ctf_fs_trace->ds_file_groups.back()->insert_ds_file_info_sorted(std::move(ds_file_info));
return 0;
}
}
}
- ctf_fs_ds_file_group::UP new_ds_file_group;
-
if (!ds_file_group) {
- new_ds_file_group =
- ctf_fs_ds_file_group_create(ctf_fs_trace, sc, stream_instance_id, std::move(*index));
- if (!new_ds_file_group) {
- return -1;
- }
-
- ds_file_group = new_ds_file_group.get();
- ctf_fs_trace->ds_file_groups.emplace_back(std::move(new_ds_file_group));
+ ctf_fs_trace->ds_file_groups.emplace_back(bt2s::make_unique<ctf_fs_ds_file_group>(
+ ctf_fs_trace, sc, static_cast<std::uint64_t>(stream_instance_id), std::move(*index)));
+ ds_file_group = ctf_fs_trace->ds_file_groups.back().get();
} else {
merge_ctf_fs_ds_indexes(ds_file_group->index, *index);
}
dest_trace->metadata->tc, src_group->sc->id);
BT_ASSERT(sc);
- auto new_dest_group =
- ctf_fs_ds_file_group_create(dest_trace, sc, src_group->stream_id, {});
-
- if (!new_dest_group) {
- return -1;
- }
-
- dest_group = new_dest_group.get();
- dest_trace->ds_file_groups.emplace_back(std::move(new_dest_group));
+ dest_trace->ds_file_groups.emplace_back(bt2s::make_unique<ctf_fs_ds_file_group>(
+ dest_trace, sc, src_group->stream_id, ctf_fs_ds_index {}));
+ dest_group = dest_trace->ds_file_groups.back().get();
}
BT_ASSERT(dest_group);
*
* To fix up this erroneous data we do the following:
* 1. If it's not the stream file's last packet: set the packet index entry's
- * end time to the next packet's beginning time.
+ * end time to the next packet's beginning time.
* 2. If it's the stream file's last packet, set the packet index entry's end
- * time to the packet's last event's time, if any, or to the packet's
- * beginning time otherwise.
+ * time to the packet's last event's time, if any, or to the packet's
+ * beginning time otherwise.
*
* Known buggy tracer versions:
* - before lttng-ust 2.11.0
* are needed. Failing to extract these entries is not
* an error.
*/
- BT_CPPLOGI_STR_SPEC(
+ BT_CPPLOGI_SPEC(
trace->logger,
"Cannot extract tracer information necessary to compare with buggy versions.");
return 0;
/* Check if the trace may be affected by old tracer bugs. */
if (is_tracer_affected_by_lttng_event_after_packet_bug(¤t_tracer_info)) {
- BT_CPPLOGI_STR_SPEC(
- trace->logger,
- "Trace may be affected by LTTng tracer packet timestamp bug. Fixing up.");
+ BT_CPPLOGI_SPEC(trace->logger,
+ "Trace may be affected by LTTng tracer packet timestamp bug. Fixing up.");
ret = fix_index_lttng_event_after_packet_bug(trace);
if (ret) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(trace->logger,
}
if (is_tracer_affected_by_barectf_event_before_packet_bug(¤t_tracer_info)) {
- BT_CPPLOGI_STR_SPEC(
- trace->logger,
- "Trace may be affected by barectf tracer packet timestamp bug. Fixing up.");
+ BT_CPPLOGI_SPEC(trace->logger,
+ "Trace may be affected by barectf tracer packet timestamp bug. Fixing up.");
ret = fix_index_barectf_event_before_packet_bug(trace);
if (ret) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(trace->logger,
BT_ASSERT(ds_file_group->sc->ir_sc);
BT_ASSERT(ctf_fs_trace->trace);
- bt_stream *stream;
+ const bt2::StreamClass sc {ds_file_group->sc->ir_sc};
if (ds_file_group->stream_id == UINT64_C(-1)) {
/* No stream ID: use 0 */
- stream =
- bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace->libObjPtr(),
- ctf_fs_trace->next_stream_id);
+ ds_file_group->stream =
+ sc.instantiate(*ctf_fs_trace->trace, ctf_fs_trace->next_stream_id);
ctf_fs_trace->next_stream_id++;
} else {
/* Specific stream ID */
- stream =
- bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace->libObjPtr(),
- (uint64_t) ds_file_group->stream_id);
- }
-
- if (!stream) {
- BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger,
- "Cannot create stream for DS file group: "
- "addr={}, stream-name=\"{}\"",
- fmt::ptr(ds_file_group), name);
- return -1;
+ ds_file_group->stream = sc.instantiate(*ctf_fs_trace->trace, ds_file_group->stream_id);
}
- ds_file_group->stream = bt2::Stream::Shared::createWithoutRef(stream);
-
int ret = bt_stream_set_name(ds_file_group->stream->libObjPtr(), name.c_str());
if (ret) {
BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger,