X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Ftext%2Ftext.c;h=3e2727622dca85cef6309ed2cc99103dac71cc39;hb=60535549d314d7784f2e5fcfcf8883ea6c428997;hp=ecd6bbea65e54fc2a2336e5cc1896192a799ce68;hpb=890882eff34b4cba6f08a25f8ca56866c20b3fbe;p=babeltrace.git diff --git a/plugins/text/text.c b/plugins/text/text.c index ecd6bbea..3e272762 100644 --- a/plugins/text/text.c +++ b/plugins/text/text.c @@ -28,16 +28,16 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -74,6 +74,7 @@ const char *plugin_options[] = { "field-trace:vpid", "field-loglevel", "field-emf", + "field-callsite", }; static @@ -109,7 +110,7 @@ error: } static -void destroy_text(struct bt_private_component *component) +void finalize_text(struct bt_private_component *component) { void *data = bt_private_component_get_user_data(component); @@ -129,10 +130,8 @@ enum bt_component_status handle_notification(struct text_component *text, switch (bt_notification_get_type(notification)) { case BT_NOTIFICATION_TYPE_PACKET_BEGIN: - puts(""); break; case BT_NOTIFICATION_TYPE_PACKET_END: - puts(""); break; case BT_NOTIFICATION_TYPE_EVENT: { @@ -151,7 +150,6 @@ enum bt_component_status handle_notification(struct text_component *text, break; } case BT_NOTIFICATION_TYPE_STREAM_END: - puts(""); break; default: puts("Unhandled notification type"); @@ -163,7 +161,8 @@ end: static enum bt_component_status text_accept_port_connection( struct bt_private_component *component, - struct bt_private_port *self_port) + struct bt_private_port *self_port, + struct bt_port *other_port) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; struct bt_private_connection *connection; @@ -193,31 +192,25 @@ enum bt_component_status run(struct bt_private_component *component) struct bt_notification_iterator *it; struct text_component *text = bt_private_component_get_user_data(component); + enum bt_notification_iterator_status it_ret; it = text->input_iterator; - if (likely(text->processed_first_event)) { - enum bt_notification_iterator_status it_ret; - - it_ret = bt_notification_iterator_next(it); - switch (it_ret) { - case BT_NOTIFICATION_ITERATOR_STATUS_ERROR: - ret = BT_COMPONENT_STATUS_ERROR; - goto end; - case BT_NOTIFICATION_ITERATOR_STATUS_END: - ret = BT_COMPONENT_STATUS_END; - BT_PUT(text->input_iterator); - goto end; - default: - break; - } - } - notification = bt_notification_iterator_get_notification(it); - if (!notification) { + it_ret = bt_notification_iterator_next(it); + switch (it_ret) { + case BT_NOTIFICATION_ITERATOR_STATUS_ERROR: ret = BT_COMPONENT_STATUS_ERROR; goto end; + case BT_NOTIFICATION_ITERATOR_STATUS_END: + ret = BT_COMPONENT_STATUS_END; + BT_PUT(text->input_iterator); + goto end; + default: + break; } + notification = bt_notification_iterator_get_notification(it); + assert(notification); ret = handle_notification(text, notification); text->processed_first_event = true; end: @@ -564,7 +557,7 @@ enum bt_component_status apply_params(struct text_component *text, text->options.print_trace_vpid_field = true; text->options.print_loglevel_field = false; text->options.print_emf_field = false; - text->options.print_emf_field = false; + text->options.print_callsite_field = false; break; case TEXT_DEFAULT_SHOW: text->options.print_trace_field = true; @@ -574,7 +567,7 @@ enum bt_component_status apply_params(struct text_component *text, text->options.print_trace_vpid_field = true; text->options.print_loglevel_field = true; text->options.print_emf_field = true; - text->options.print_emf_field = true; + text->options.print_callsite_field = true; break; case TEXT_DEFAULT_HIDE: text->options.print_trace_field = false; @@ -584,7 +577,7 @@ enum bt_component_status apply_params(struct text_component *text, text->options.print_trace_vpid_field = false; text->options.print_loglevel_field = false; text->options.print_emf_field = false; - text->options.print_emf_field = false; + text->options.print_callsite_field = false; break; default: ret = BT_COMPONENT_STATUS_ERROR; @@ -663,12 +656,12 @@ enum bt_component_status apply_params(struct text_component *text, value = false; found = false; - ret = apply_one_bool("field-emf", params, &value, &found); + ret = apply_one_bool("field-callsite", params, &value, &found); if (ret != BT_COMPONENT_STATUS_OK) { goto end; } if (found) { - text->options.print_emf_field = value; + text->options.print_callsite_field = value; } end: @@ -766,6 +759,6 @@ BT_PLUGIN_LICENSE("MIT"); BT_PLUGIN_SINK_COMPONENT_CLASS(text, run); BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD(text, text_component_init); BT_PLUGIN_SINK_COMPONENT_CLASS_ACCEPT_PORT_CONNECTION_METHOD(text, text_accept_port_connection); -BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD(text, destroy_text); +BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(text, finalize_text); BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(text, "Formats CTF-IR to text. Formerly known as ctf-text.");