*/
#include <babeltrace/plugin/plugin-dev.h>
-#include <babeltrace/component/component.h>
-#include <babeltrace/component/private-component.h>
-#include <babeltrace/component/component-sink.h>
-#include <babeltrace/component/port.h>
-#include <babeltrace/component/private-port.h>
-#include <babeltrace/component/connection.h>
-#include <babeltrace/component/private-connection.h>
-#include <babeltrace/component/notification/notification.h>
-#include <babeltrace/component/notification/iterator.h>
-#include <babeltrace/component/notification/event.h>
+#include <babeltrace/graph/component.h>
+#include <babeltrace/graph/private-component.h>
+#include <babeltrace/graph/component-sink.h>
+#include <babeltrace/graph/port.h>
+#include <babeltrace/graph/private-port.h>
+#include <babeltrace/graph/connection.h>
+#include <babeltrace/graph/private-connection.h>
+#include <babeltrace/graph/notification.h>
+#include <babeltrace/graph/notification-iterator.h>
+#include <babeltrace/graph/notification-event.h>
#include <babeltrace/values.h>
#include <babeltrace/compiler.h>
#include <babeltrace/common-internal.h>
"field-trace:vpid",
"field-loglevel",
"field-emf",
+ "field-callsite",
};
static
{
bt_put(text->input_iterator);
(void) g_string_free(text->string, TRUE);
+ if (text->out != stdout) {
+ int ret;
+
+ ret = fclose(text->out);
+ if (ret) {
+ perror("close output file");
+ }
+ }
g_free(text->options.output_path);
g_free(text->options.debug_info_dir);
g_free(text->options.debug_info_target_prefix);
switch (bt_notification_get_type(notification)) {
case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
- puts("<packet>");
break;
case BT_NOTIFICATION_TYPE_PACKET_END:
- puts("</packet>");
break;
case BT_NOTIFICATION_TYPE_EVENT:
{
break;
}
case BT_NOTIFICATION_TYPE_STREAM_END:
- puts("</stream>");
break;
default:
puts("Unhandled notification type");
"[warning] Accepted values for the \"color\" parameter are:\n \"always\", \"auto\", \"never\"\n");
}
+static
+enum bt_component_status open_output_file(struct text_component *text)
+{
+ enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+
+ if (!text->options.output_path) {
+ goto end;
+ }
+
+ text->out = fopen(text->options.output_path, "w");
+ if (!text->out) {
+ goto error;
+ }
+
+ goto end;
+
+error:
+ ret = BT_COMPONENT_STATUS_ERROR;
+end:
+ return ret;
+}
+
static
enum bt_component_status apply_params(struct text_component *text,
struct bt_value *params)
if (ret != BT_COMPONENT_STATUS_OK) {
goto end;
}
+ ret = open_output_file(text);
+ if (ret != BT_COMPONENT_STATUS_OK) {
+ goto end;
+ }
ret = apply_one_string("debug-info-dir",
params,
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;
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;
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;
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: