#include "pretty.h"
-GQuark stream_packet_context_quarks[STREAM_PACKET_CONTEXT_QUARKS_LEN];
-
static
const char *plugin_options[] = {
"color",
}
}
-static
-void init_stream_packet_context_quarks(void)
-{
- stream_packet_context_quarks[Q_TIMESTAMP_BEGIN] =
- g_quark_from_string("timestamp_begin");
- stream_packet_context_quarks[Q_TIMESTAMP_BEGIN] =
- g_quark_from_string("timestamp_begin");
- stream_packet_context_quarks[Q_TIMESTAMP_END] =
- g_quark_from_string("timestamp_end");
- stream_packet_context_quarks[Q_EVENTS_DISCARDED] =
- g_quark_from_string("events_discarded");
- stream_packet_context_quarks[Q_CONTENT_SIZE] =
- g_quark_from_string("content_size");
- stream_packet_context_quarks[Q_PACKET_SIZE] =
- g_quark_from_string("packet_size");
- stream_packet_context_quarks[Q_PACKET_SEQ_NUM] =
- g_quark_from_string("packet_seq_num");
-}
-
BT_HIDDEN
bt_component_class_init_method_status pretty_init(
bt_self_component_sink *comp, const bt_value *params,
set_use_colors(pretty);
bt_self_component_set_data(
bt_self_component_sink_as_self_component(comp), pretty);
- init_stream_packet_context_quarks();
end:
return ret;
static
int print_field(struct pretty_component *pretty,
- const bt_field *field, bool print_names,
- GQuark *filters_fields, int filter_array_len);
+ const bt_field *field, bool print_names);
static
void print_name_equal(struct pretty_component *pretty, const char *name)
return ret;
}
-static
-int filter_field_name(struct pretty_component *pretty, const char *field_name,
- GQuark *filter_fields, int filter_array_len)
-{
- int i;
- GQuark field_quark = g_quark_try_string(field_name);
-
- if (!field_quark || pretty->options.verbose) {
- return 1;
- }
-
- for (i = 0; i < filter_array_len; i++) {
- if (field_quark == filter_fields[i]) {
- return 0;
- }
- }
- return 1;
-}
-
static
int print_struct_field(struct pretty_component *pretty,
const bt_field *_struct,
const bt_field_class *struct_class,
- uint64_t i, bool print_names, uint64_t *nr_printed_fields,
- GQuark *filter_fields, int filter_array_len)
+ uint64_t i, bool print_names, uint64_t *nr_printed_fields)
{
int ret = 0;
const char *field_name;
struct_class, i);
field_name = bt_field_class_structure_member_get_name(member);
- if (filter_fields && !filter_field_name(pretty, field_name,
- filter_fields, filter_array_len)) {
- ret = 0;
- goto end;
- }
-
if (*nr_printed_fields > 0) {
g_string_append(pretty->string, ", ");
} else {
if (print_names) {
print_field_name_equal(pretty, field_name);
}
- ret = print_field(pretty, field, print_names, NULL, 0);
+ ret = print_field(pretty, field, print_names);
*nr_printed_fields += 1;
end:
static
int print_struct(struct pretty_component *pretty,
- const bt_field *_struct, bool print_names,
- GQuark *filter_fields, int filter_array_len)
+ const bt_field *_struct, bool print_names)
{
int ret = 0;
const bt_field_class *struct_class = NULL;
nr_printed_fields = 0;
for (i = 0; i < nr_fields; i++) {
ret = print_struct_field(pretty, _struct, struct_class, i,
- print_names, &nr_printed_fields, filter_fields,
- filter_array_len);
+ print_names, &nr_printed_fields);
if (ret != 0) {
goto end;
}
field = bt_field_array_borrow_element_field_by_index_const(array, i);
BT_ASSERT(field);
- return print_field(pretty, field, print_names, NULL, 0);
+ return print_field(pretty, field, print_names);
}
static
field = bt_field_array_borrow_element_field_by_index_const(seq, i);
BT_ASSERT(field);
- return print_field(pretty, field, print_names, NULL, 0);
+ return print_field(pretty, field, print_names);
}
static
// TODO: find tag's name using field path
// print_field_name_equal(pretty, tag_choice);
}
- ret = print_field(pretty, field, print_names, NULL, 0);
+ ret = print_field(pretty, field, print_names);
if (ret != 0) {
goto end;
}
static
int print_field(struct pretty_component *pretty,
- const bt_field *field, bool print_names,
- GQuark *filter_fields, int filter_array_len)
+ const bt_field *field, bool print_names)
{
bt_field_class_type class_id;
return 0;
}
case BT_FIELD_CLASS_TYPE_STRUCTURE:
- return print_struct(pretty, field, print_names, filter_fields,
- filter_array_len);
+ return print_struct(pretty, field, print_names);
case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR:
case BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR:
case BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR:
print_name_equal(pretty, "stream.packet.context");
}
ret = print_field(pretty, main_field,
- pretty->options.print_context_field_names,
- stream_packet_context_quarks,
- STREAM_PACKET_CONTEXT_QUARKS_LEN);
+ pretty->options.print_context_field_names);
end:
return ret;
print_name_equal(pretty, "stream.event.context");
}
ret = print_field(pretty, main_field,
- pretty->options.print_context_field_names, NULL, 0);
+ pretty->options.print_context_field_names);
end:
return ret;
print_name_equal(pretty, "event.context");
}
ret = print_field(pretty, main_field,
- pretty->options.print_context_field_names, NULL, 0);
+ pretty->options.print_context_field_names);
end:
return ret;
print_name_equal(pretty, "event.fields");
}
ret = print_field(pretty, main_field,
- pretty->options.print_payload_field_names, NULL, 0);
+ pretty->options.print_payload_field_names);
end:
return ret;