+ if (path) {
+ strncpy(handle->path, path, PATH_MAX);
+ handle->path[PATH_MAX - 1] = '\0';
+ }
+
+ ret = bt_trace_collection_add(ctx->tc, td);
+ if (ret != 0)
+ goto error_destroy_handle;
+
+ if (fmt->set_handle)
+ fmt->set_handle(td, handle);
+ if (fmt->set_context)
+ fmt->set_context(td, ctx);
+
+ if (fmt->convert_index_timestamp) {
+ ret = fmt->convert_index_timestamp(td);
+ if (ret < 0)
+ goto error_collection_del;
+ }
+
+ if (fmt->timestamp_begin)
+ handle->real_timestamp_begin = fmt->timestamp_begin(td,
+ handle, BT_CLOCK_REAL);
+ if (fmt->timestamp_end)
+ handle->real_timestamp_end = fmt->timestamp_end(td, handle,
+ BT_CLOCK_REAL);
+ if (fmt->timestamp_begin)
+ handle->cycles_timestamp_begin = fmt->timestamp_begin(td,
+ handle, BT_CLOCK_CYCLES);
+ if (fmt->timestamp_end)
+ handle->cycles_timestamp_end = fmt->timestamp_end(td, handle,
+ BT_CLOCK_CYCLES);