Commit | Line | Data |
---|---|---|
af9a82eb | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
af9a82eb | 3 | * |
0235b0db | 4 | * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
af9a82eb JG |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef BABELTRACE_PLUGIN_TEXT_PRETTY_PRETTY_H |
8 | #define BABELTRACE_PLUGIN_TEXT_PRETTY_PRETTY_H | |
9 | ||
91d81473 MJ |
10 | #include <glib.h> |
11 | #include <stdio.h> | |
af9a82eb | 12 | #include <stdbool.h> |
91d81473 | 13 | #include "common/macros.h" |
3fadfbc0 | 14 | #include <babeltrace2/babeltrace.h> |
3228cc1d PP |
15 | |
16 | enum pretty_default { | |
17 | PRETTY_DEFAULT_UNSET, | |
18 | PRETTY_DEFAULT_SHOW, | |
19 | PRETTY_DEFAULT_HIDE, | |
6e1bc0df MD |
20 | }; |
21 | ||
3228cc1d PP |
22 | enum pretty_color_option { |
23 | PRETTY_COLOR_OPT_NEVER, | |
24 | PRETTY_COLOR_OPT_AUTO, | |
25 | PRETTY_COLOR_OPT_ALWAYS, | |
ad96d936 PP |
26 | }; |
27 | ||
3228cc1d | 28 | struct pretty_options { |
6e1bc0df | 29 | char *output_path; |
6e1bc0df | 30 | |
3228cc1d PP |
31 | enum pretty_default name_default; |
32 | enum pretty_default field_default; | |
6e1bc0df MD |
33 | |
34 | bool print_scope_field_names; | |
35 | bool print_header_field_names; | |
36 | bool print_context_field_names; | |
37 | bool print_payload_field_names; | |
38 | ||
39 | bool print_delta_field; | |
40 | bool print_loglevel_field; | |
41 | bool print_emf_field; | |
60535549 | 42 | bool print_callsite_field; |
6e1bc0df MD |
43 | bool print_trace_field; |
44 | bool print_trace_domain_field; | |
45 | bool print_trace_procname_field; | |
46 | bool print_trace_vpid_field; | |
47 | bool print_trace_hostname_field; | |
48 | ||
49 | bool print_timestamp_cycles; | |
50 | bool clock_seconds; | |
51 | bool clock_date; | |
52 | bool clock_gmt; | |
3228cc1d | 53 | enum pretty_color_option color; |
a263021c | 54 | bool verbose; |
af9a82eb JG |
55 | }; |
56 | ||
3228cc1d PP |
57 | struct pretty_component { |
58 | struct pretty_options options; | |
9a2c8b8e | 59 | bt_message_iterator *iterator; |
af9a82eb | 60 | FILE *out, *err; |
6a18b281 | 61 | int depth; /* nesting, used for tabulation alignment. */ |
6e1bc0df | 62 | bool start_line; |
6a18b281 | 63 | GString *string; |
5280f742 | 64 | GString *tmp_string; |
ad96d936 | 65 | bool use_colors; |
3af83b5a MD |
66 | |
67 | uint64_t last_cycles_timestamp; | |
68 | uint64_t delta_cycles; | |
69 | ||
70 | uint64_t last_real_timestamp; | |
71 | uint64_t delta_real_timestamp; | |
18adbd19 MD |
72 | |
73 | bool negative_timestamp_warning_done; | |
af9a82eb JG |
74 | }; |
75 | ||
76 | BT_HIDDEN | |
21a9f056 | 77 | bt_component_class_initialize_method_status pretty_init( |
59225a3e SM |
78 | bt_self_component_sink *component, |
79 | bt_self_component_sink_configuration *config, | |
80 | const bt_value *params, | |
3228cc1d PP |
81 | void *init_method_data); |
82 | ||
83 | BT_HIDDEN | |
d24d5663 | 84 | bt_component_class_sink_consume_method_status pretty_consume( |
b19ff26f | 85 | bt_self_component_sink *component); |
3228cc1d PP |
86 | |
87 | BT_HIDDEN | |
d24d5663 | 88 | bt_component_class_sink_graph_is_configured_method_status pretty_graph_is_configured( |
5badd463 | 89 | bt_self_component_sink *component); |
3228cc1d PP |
90 | |
91 | BT_HIDDEN | |
b19ff26f | 92 | void pretty_finalize(bt_self_component_sink *component); |
3228cc1d PP |
93 | |
94 | BT_HIDDEN | |
d94d92ac | 95 | int pretty_print_event(struct pretty_component *pretty, |
d6e69534 | 96 | const bt_message *event_msg); |
af9a82eb | 97 | |
0f6bea4e | 98 | BT_HIDDEN |
8e53bed4 PP |
99 | int pretty_print_discarded_items(struct pretty_component *pretty, |
100 | const bt_message *msg); | |
0f6bea4e | 101 | |
04609487 PP |
102 | BT_HIDDEN |
103 | void pretty_print_init(void); | |
104 | ||
3228cc1d | 105 | #endif /* BABELTRACE_PLUGIN_TEXT_PRETTY_PRETTY_H */ |