+ ret = bt_trace_collection_add(ctx->tc, td);
+ if (ret != 0)
+ goto error;
+
+ ret = fmt->convert_index_timestamp(td);
+ if (ret < 0)
+ goto error;
+
+ handle->real_timestamp_begin = fmt->timestamp_begin(td, handle, BT_CLOCK_REAL);
+ handle->real_timestamp_end = fmt->timestamp_end(td, handle, BT_CLOCK_REAL);
+ handle->cycles_timestamp_begin = fmt->timestamp_begin(td, handle, BT_CLOCK_CYCLES);
+ handle->cycles_timestamp_end = fmt->timestamp_end(td, handle, BT_CLOCK_CYCLES);
+
+ return handle->id;
+
+error:
+ closeret = fmt->close_trace(td);
+ if (closeret) {
+ fprintf(stderr, "Error in close_trace callback\n");
+ }