struct bt_component_class *component_class,
bt_component_class_notification_iterator_finalize_method notification_iterator_finalize_method);
-extern
-int bt_component_class_filter_set_notification_iterator_seek_time_method(
- struct bt_component_class *component_class,
- bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method);
-
#ifdef __cplusplus
}
#endif
bt_component_class_notification_iterator_init_method init;
bt_component_class_notification_iterator_finalize_method finalize;
bt_component_class_notification_iterator_next_method next;
- bt_component_class_notification_iterator_seek_time_method seek_time;
};
struct bt_component_class_source {
struct bt_component_class *component_class,
bt_component_class_notification_iterator_finalize_method notification_iterator_finalize_method);
-extern
-int bt_component_class_source_set_notification_iterator_seek_time_method(
- struct bt_component_class *component_class,
- bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method);
-
#ifdef __cplusplus
}
#endif
typedef struct bt_notification_iterator_next_return (*bt_component_class_notification_iterator_next_method)(
struct bt_private_notification_iterator *private_notification_iterator);
-typedef enum bt_notification_iterator_status
- (*bt_component_class_notification_iterator_seek_time_method)(
- struct bt_private_notification_iterator *private_notification_iterator,
- int64_t time);
-
typedef struct bt_component_class_query_return (*bt_component_class_query_method)(
struct bt_component_class *component_class,
struct bt_query_executor *query_executor,
#define BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_H
/*
- * BabelTrace - Plug-in Notification Iterator
+ * BabelTrace - Notification Iterator
*
* Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED = -2,
};
-/**
- * Notification iterator seek reference.
- */
-enum bt_notification_iterator_seek_origin {
- /** Seek at a time relative to the beginning of the trace. */
- BT_NOTIFICATION_ITERATOR_SEEK_ORIGIN_BEGIN = 0,
-
- /** Seek at a time relative to the current position. */
- BT_NOTIFICATION_ITERATOR_SEEK_ORIGIN_CURRENT = 1,
-
- /** Seek at a time relative to the end of the trace. */
- BT_NOTIFICATION_ITERATOR_SEEK_ORIGIN_END = 2,
-
- /** Seek at a time relative to EPOCH. */
- BT_NOTIFICATION_ITERATOR_SEEK_ORIGIN_EPOCH = 3,
-};
-
/**
* Get current notification at iterator's position.
*
extern enum bt_notification_iterator_status
bt_notification_iterator_next(struct bt_notification_iterator *iterator);
-/**
- * Seek iterator to time.
- *
- * Sets the iterator's position for the trace associated with the iterator.
- * The new position is computed by adding \p time to the position specified
- * by \p seek_origin.
- *
- * time is expressed in nanoseconds.
- *
- * @param iterator Iterator instance
- * @param seek_origin One of #bt_notification_iterator_seek_type values.
- * @returns One of #bt_notification_iterator_status values;
- * if \iterator does not support seeking,
- * #BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED is
- * returned.
- *
- * @see bt_notification_iterator_get_notification()
- */
-extern enum bt_notification_iterator_status bt_notification_iterator_seek_time(
- struct bt_notification_iterator *iterator,
- enum bt_notification_iterator_seek_origin seek_origin,
- int64_t time);
-
extern struct bt_component *bt_notification_iterator_get_component(
struct bt_notification_iterator *iterator);
BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_PORT_DISCONNECTED_METHOD = 8,
BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD = 9,
BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD = 10,
- BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD = 11,
};
/* Component class attribute (internal use) */
/* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD */
bt_component_class_notification_iterator_finalize_method notif_iter_finalize_method;
-
- /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD */
- bt_component_class_notification_iterator_seek_time_method notif_iter_seek_time_method;
} value;
} __attribute__((packed));
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(_id, _comp_class_id, _x) \
__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_finalize_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD, _id, _comp_class_id, source, _x)
-/*
- * Defines an iterator seek time method attribute attached to a specific
- * source component class descriptor.
- *
- * _id: Plugin descriptor ID (C identifier).
- * _comp_class_id: Component class descriptor ID (C identifier).
- * _x: Iterator seek time method
- * (bt_component_class_notification_iterator_seek_time_method).
- */
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \
- __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_seek_time_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD, _id, _comp_class_id, source, _x)
-
/*
* Defines an iterator initialization method attribute attached to a
* specific filter component class descriptor.
#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(_id, _comp_class_id, _x) \
__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_finalize_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD, _id, _comp_class_id, filter, _x)
-/*
- * Defines an iterator seek time method attribute attached to a specific
- * filter component class descriptor.
- *
- * _id: Plugin descriptor ID (C identifier).
- * _comp_class_id: Component class descriptor ID (C identifier).
- * _x: Iterator seek time method
- * (bt_component_class_notification_iterator_seek_time_method).
- */
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \
- __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_seek_time_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD, _id, _comp_class_id, filter, _x)
-
/*
* Defines a plugin descriptor with an automatic ID.
*
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(_name, _x) \
BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(auto, _name, _x)
-/*
- * Defines an iterator seek time method attribute attached to a source
- * component class descriptor which is attached to the automatic plugin
- * descriptor.
- *
- * _name: Component class name (C identifier).
- * _x: Iterator seek time method
- * (bt_component_class_notification_iterator_seek_time_method).
- */
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \
- BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x)
-
/*
* Defines an iterator initialization method attribute attached to a
* filter component class descriptor which is attached to the automatic
#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(_name, _x) \
BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(auto, _name, _x)
-/*
- * Defines an iterator seek time method attribute attached to a filter
- * component class descriptor which is attached to the automatic plugin
- * descriptor.
- *
- * _name: Component class name (C identifier).
- * _x: Iterator seek time method
- * (bt_component_class_notification_iterator_seek_time_method).
- */
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \
- BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x)
-
#define BT_PLUGIN_MODULE() \
static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_dummy __BT_PLUGIN_DESCRIPTOR_ATTRS = NULL; \
_BT_HIDDEN extern struct __bt_plugin_descriptor const *__BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL __BT_PLUGIN_DESCRIPTOR_BEGIN_EXTRA; \
return ret;
}
-int bt_component_class_source_set_notification_iterator_seek_time_method(
- struct bt_component_class *component_class,
- bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method)
-{
- struct bt_component_class_source *source_class;
- int ret = 0;
-
- if (!component_class) {
- BT_LOGW_STR("Invalid parameter: component class is NULL.");
- ret = -1;
- goto end;
- }
-
- if (!notification_iterator_seek_time_method) {
- BT_LOGW_STR("Invalid parameter: method is NULL.");
- ret = -1;
- goto end;
- }
-
- if (component_class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
- BT_LOGW("Invalid parameter: component class is not a source component class: "
- "addr=%p, name=\"%s\", type=%s",
- component_class,
- bt_component_class_get_name(component_class),
- bt_component_class_type_string(component_class->type));
- ret = -1;
- goto end;
- }
-
- if (component_class->frozen) {
- BT_LOGW("Invalid parameter: component class is frozen: "
- "addr=%p, name=\"%s\", type=%s",
- component_class,
- bt_component_class_get_name(component_class),
- bt_component_class_type_string(component_class->type));
- ret = -1;
- goto end;
- }
-
- source_class = container_of(component_class,
- struct bt_component_class_source, parent);
- source_class->methods.iterator.seek_time =
- notification_iterator_seek_time_method;
- BT_LOGV("Set source component class's notification iterator seek time method: "
- "addr=%p, name=\"%s\", method-addr=%p",
- component_class,
- bt_component_class_get_name(component_class),
- notification_iterator_seek_time_method);
-
-end:
- return ret;
-}
-
int bt_component_class_filter_set_notification_iterator_init_method(
struct bt_component_class *component_class,
bt_component_class_notification_iterator_init_method notification_iterator_init_method)
return ret;
}
-int bt_component_class_filter_set_notification_iterator_seek_time_method(
- struct bt_component_class *component_class,
- bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method)
-{
- struct bt_component_class_filter *filter_class;
- int ret = 0;
-
- if (!component_class) {
- BT_LOGW_STR("Invalid parameter: component class is NULL.");
- ret = -1;
- goto end;
- }
-
- if (!notification_iterator_seek_time_method) {
- BT_LOGW_STR("Invalid parameter: method is NULL.");
- ret = -1;
- goto end;
- }
-
- if (component_class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
- BT_LOGW("Invalid parameter: component class is not a filter component class: "
- "addr=%p, name=\"%s\", type=%s",
- component_class,
- bt_component_class_get_name(component_class),
- bt_component_class_type_string(component_class->type));
- ret = -1;
- goto end;
- }
-
- if (component_class->frozen) {
- BT_LOGW("Invalid parameter: component class is frozen: "
- "addr=%p, name=\"%s\", type=%s",
- component_class,
- bt_component_class_get_name(component_class),
- bt_component_class_type_string(component_class->type));
- ret = -1;
- goto end;
- }
-
- filter_class = container_of(component_class,
- struct bt_component_class_filter, parent);
- filter_class->methods.iterator.seek_time =
- notification_iterator_seek_time_method;
- BT_LOGV("Set filter component class's notification iterator seek time method: "
- "addr=%p, name=\"%s\", method-addr=%p",
- component_class,
- bt_component_class_get_name(component_class),
- notification_iterator_seek_time_method);
-
-end:
- return ret;
-}
-
int bt_component_class_set_description(
struct bt_component_class *component_class,
const char *description)
bt_notification_iterator_get_component(
bt_notification_iterator_from_private(private_iterator)));
}
-
-enum bt_notification_iterator_status bt_notification_iterator_seek_time(
- struct bt_notification_iterator *iterator,
- enum bt_notification_iterator_seek_origin seek_origin,
- int64_t time)
-{
- enum bt_notification_iterator_status ret =
- BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED;
- return ret;
-}
cc_full_descr->iterator_methods.finalize =
cur_cc_descr_attr->value.notif_iter_finalize_method;
break;
- case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD:
- cc_full_descr->iterator_methods.seek_time =
- cur_cc_descr_attr->value.notif_iter_seek_time_method;
- break;
default:
/*
* WARN-level logging because
goto end;
}
}
-
- if (cc_full_descr->iterator_methods.seek_time) {
- ret = bt_component_class_source_set_notification_iterator_seek_time_method(
- comp_class,
- cc_full_descr->iterator_methods.seek_time);
- if (ret) {
- BT_LOGE_STR("Cannot set source component class's notification iterator seek to time method.");
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
break;
case BT_COMPONENT_CLASS_TYPE_FILTER:
if (cc_full_descr->iterator_methods.init) {
goto end;
}
}
-
- if (cc_full_descr->iterator_methods.seek_time) {
- ret = bt_component_class_filter_set_notification_iterator_seek_time_method(
- comp_class,
- cc_full_descr->iterator_methods.seek_time);
- if (ret) {
- BT_LOGE_STR("Cannot set filter component class's notification iterator seek to time method.");
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
break;
case BT_COMPONENT_CLASS_TYPE_SINK:
break;
trimmer_iterator_init);
BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(trimmer,
trimmer_iterator_finalize);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(trimmer,
- trimmer_iterator_seek_time);
/* flt.utils.muxer */
BT_PLUGIN_FILTER_COMPONENT_CLASS(muxer, muxer_notif_iter_next);
bt_put(component);
return ret;
}
-
-BT_HIDDEN
-enum bt_notification_iterator_status trimmer_iterator_seek_time(
- struct bt_private_notification_iterator *iterator,
- int64_t time)
-{
- return BT_NOTIFICATION_ITERATOR_STATUS_OK;
-}
struct bt_notification_iterator_next_return trimmer_iterator_next(
struct bt_private_notification_iterator *iterator);
-BT_HIDDEN
-enum bt_notification_iterator_status trimmer_iterator_seek_time(
- struct bt_private_notification_iterator *iterator,
- int64_t time);
-
#endif /* BABELTRACE_PLUGIN_TRIMMER_ITERATOR_H */
return next_return;
}
-static enum bt_notification_iterator_status dummy_iterator_seek_time_method(
- struct bt_private_notification_iterator *private_iterator,
- int64_t time)
-{
- return BT_NOTIFICATION_ITERATOR_STATUS_OK;
-}
-
static struct bt_component_class_query_return query_method(
struct bt_component_class *component_class,
struct bt_query_executor *query_exec,
dummy_iterator_init_method);
BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(source,
dummy_iterator_finalize_method);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(source,
- dummy_iterator_seek_time_method);
BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume);
BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(sink, "A sink.");
dummy_iterator_init_method);
BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(filter,
dummy_iterator_finalize_method);
-BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(filter,
- dummy_iterator_seek_time_method);
BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, query_method);