* SOFTWARE.
*/
-#include <babeltrace/plugin/plugin-macros.h>
-#include <babeltrace/plugin/component.h>
-#include <babeltrace/plugin/filter.h>
-#include <babeltrace/plugin/notification/notification.h>
-#include <babeltrace/plugin/notification/iterator.h>
-#include <babeltrace/plugin/notification/event.h>
+#include <babeltrace/plugin/plugin-dev.h>
+#include <babeltrace/component/component.h>
+#include <babeltrace/component/filter.h>
+#include <babeltrace/component/notification/notification.h>
+#include <babeltrace/component/notification/iterator.h>
+#include <babeltrace/component/notification/event.h>
#include "trimmer.h"
#include "iterator.h"
#include <assert.h>
value_ret = bt_value_bool_get(value, &gmt);
if (value_ret) {
ret = BT_COMPONENT_STATUS_INVALID;
- printf_error("Failed to retrieve clock-gmt value. Expecting a boolean.\n");
+ printf_error("Failed to retrieve clock-gmt value. Expecting a boolean");
}
}
bt_put(value);
if (value_ret || timestamp_from_arg(str,
trimmer, &trimmer->begin, gmt)) {
ret = BT_COMPONENT_STATUS_INVALID;
- printf_error("Failed to retrieve begin value. Expecting a timestamp string.\n");
+ printf_error("Failed to retrieve begin value. Expecting a timestamp string");
}
}
bt_put(value);
if (value_ret || timestamp_from_arg(str,
trimmer, &trimmer->end, gmt)) {
ret = BT_COMPONENT_STATUS_INVALID;
- printf_error("Failed to retrieve end value. Expecting a timestamp string.\n");
+ printf_error("Failed to retrieve end value. Expecting a timestamp string");
}
}
bt_put(value);
end:
+ if (trimmer->begin.set && trimmer->end.set) {
+ if (trimmer->begin.value > trimmer->end.value) {
+ printf_error("Unexpected: time range begin value is above end value");
+ ret = BT_COMPONENT_STATUS_INVALID;
+ }
+ }
return ret;
}
}
/* Initialize plug-in entry points. */
-BT_PLUGIN_NAME("utils");
+BT_PLUGIN(utils);
BT_PLUGIN_DESCRIPTION("Babeltrace Trace Trimmer Plug-In.");
BT_PLUGIN_AUTHOR("Jérémie Galarneau");
BT_PLUGIN_LICENSE("MIT");
-
-BT_PLUGIN_COMPONENT_CLASSES_BEGIN
-BT_PLUGIN_FILTER_COMPONENT_CLASS_ENTRY("trimmer",
- "Ensure that trace notifications outside of a given range are filtered-out.",
- trimmer_component_init)
-BT_PLUGIN_COMPONENT_CLASSES_END
+BT_PLUGIN_COMPONENT_CLASS(BT_COMPONENT_TYPE_FILTER, trimmer,
+ trimmer_component_init);
+BT_PLUGIN_COMPONENT_CLASS_DESCRIPTION(BT_COMPONENT_TYPE_FILTER, trimmer,
+ "Ensure that trace notifications outside of a given range are filtered-out.");