-struct bt_ctf_event *create_event(struct bt_ctf_notif_iter *notit)
-{
- int ret;
- struct bt_ctf_event *event;
-
- BT_LOGV("Creating event for event notification: "
- "notit-addr=%p, event-class-addr=%p, "
- "event-class-name=\"%s\", "
- "event-class-id=%" PRId64,
- notit, notit->meta.event_class,
- bt_ctf_event_class_get_name(notit->meta.event_class),
- bt_ctf_event_class_get_id(notit->meta.event_class));
-
- /* Create event object. */
- event = bt_ctf_event_create(notit->meta.event_class);
- if (!event) {
- BT_LOGE("Cannot create event: "
- "notit-addr=%p, event-class-addr=%p, "
- "event-class-name=\"%s\", "
- "event-class-id=%" PRId64,
- notit, notit->meta.event_class,
- bt_ctf_event_class_get_name(notit->meta.event_class),
- bt_ctf_event_class_get_id(notit->meta.event_class));
- goto error;
- }
-
- /* Set header, stream event context, context, and payload fields. */
- ret = bt_ctf_event_set_header(event,
- notit->dscopes.stream_event_header);
- if (ret) {
- BT_LOGE("Cannot set event's header field: "
- "notit-addr=%p, event-addr=%p, event-class-addr=%p, "
- "event-class-name=\"%s\", "
- "event-class-id=%" PRId64 ", field-addr=%p",
- notit, event, notit->meta.event_class,
- bt_ctf_event_class_get_name(notit->meta.event_class),
- bt_ctf_event_class_get_id(notit->meta.event_class),
- notit->dscopes.stream_event_header);
- goto error;
- }
-
- ret = bt_ctf_event_set_stream_event_context(event,
- notit->dscopes.stream_event_context);
- if (ret) {
- BT_LOGE("Cannot set event's context field: "
- "notit-addr=%p, event-addr=%p, event-class-addr=%p, "
- "event-class-name=\"%s\", "
- "event-class-id=%" PRId64 ", field-addr=%p",
- notit, event, notit->meta.event_class,
- bt_ctf_event_class_get_name(notit->meta.event_class),
- bt_ctf_event_class_get_id(notit->meta.event_class),
- notit->dscopes.stream_event_context);
- goto error;
- }
-
- ret = bt_ctf_event_set_event_context(event,
- notit->dscopes.event_context);
- if (ret) {
- BT_LOGE("Cannot set event's stream event context field: "
- "notit-addr=%p, event-addr=%p, event-class-addr=%p, "
- "event-class-name=\"%s\", "
- "event-class-id=%" PRId64 ", field-addr=%p",
- notit, event, notit->meta.event_class,
- bt_ctf_event_class_get_name(notit->meta.event_class),
- bt_ctf_event_class_get_id(notit->meta.event_class),
- notit->dscopes.event_context);
- goto error;
- }
-
- ret = bt_ctf_event_set_event_payload(event,
- notit->dscopes.event_payload);
- if (ret) {
- BT_LOGE("Cannot set event's payload field: "
- "notit-addr=%p, event-addr=%p, event-class-addr=%p, "
- "event-class-name=\"%s\", "
- "event-class-id=%" PRId64 ", field-addr=%p",
- notit, event, notit->meta.event_class,
- bt_ctf_event_class_get_name(notit->meta.event_class),
- bt_ctf_event_class_get_id(notit->meta.event_class),
- notit->dscopes.event_payload);
- goto error;
- }
-
- ret = set_event_clocks(event, notit);
- if (ret) {
- BT_LOGE("Cannot set event's clock values: "
- "notit-addr=%p, event-addr=%p, event-class-addr=%p, "
- "event-class-name=\"%s\", "
- "event-class-id=%" PRId64,
- notit, event, notit->meta.event_class,
- bt_ctf_event_class_get_name(notit->meta.event_class),
- bt_ctf_event_class_get_id(notit->meta.event_class));
- goto error;
- }
-
- /* Associate with current packet. */
- assert(notit->packet);
- ret = bt_ctf_event_set_packet(event, notit->packet);
- if (ret) {
- BT_LOGE("Cannot set event's header field: "
- "notit-addr=%p, event-addr=%p, event-class-addr=%p, "
- "event-class-name=\"%s\", "
- "event-class-id=%" PRId64 ", packet-addr=%p",
- notit, event, notit->meta.event_class,
- bt_ctf_event_class_get_name(notit->meta.event_class),
- bt_ctf_event_class_get_id(notit->meta.event_class),
- notit->packet);
- goto error;
- }
-
- goto end;
-
-error:
- BT_PUT(event);
-
-end:
- return event;
-}
-
-static
-uint64_t get_cur_stream_instance_id(struct bt_ctf_notif_iter *notit)