Move to kernel style SPDX license identifiers
[babeltrace.git] / src / plugins / text / pretty / pretty.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 */
6
7 #ifndef BABELTRACE_PLUGIN_TEXT_PRETTY_PRETTY_H
8 #define BABELTRACE_PLUGIN_TEXT_PRETTY_PRETTY_H
9
10 #include <glib.h>
11 #include <stdio.h>
12 #include <stdbool.h>
13 #include "common/macros.h"
14 #include <babeltrace2/babeltrace.h>
15
16 enum pretty_default {
17 PRETTY_DEFAULT_UNSET,
18 PRETTY_DEFAULT_SHOW,
19 PRETTY_DEFAULT_HIDE,
20 };
21
22 enum pretty_color_option {
23 PRETTY_COLOR_OPT_NEVER,
24 PRETTY_COLOR_OPT_AUTO,
25 PRETTY_COLOR_OPT_ALWAYS,
26 };
27
28 struct pretty_options {
29 char *output_path;
30
31 enum pretty_default name_default;
32 enum pretty_default field_default;
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;
42 bool print_callsite_field;
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;
53 enum pretty_color_option color;
54 bool verbose;
55 };
56
57 struct pretty_component {
58 struct pretty_options options;
59 bt_message_iterator *iterator;
60 FILE *out, *err;
61 int depth; /* nesting, used for tabulation alignment. */
62 bool start_line;
63 GString *string;
64 GString *tmp_string;
65 bool use_colors;
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;
72
73 bool negative_timestamp_warning_done;
74 };
75
76 BT_HIDDEN
77 bt_component_class_initialize_method_status pretty_init(
78 bt_self_component_sink *component,
79 bt_self_component_sink_configuration *config,
80 const bt_value *params,
81 void *init_method_data);
82
83 BT_HIDDEN
84 bt_component_class_sink_consume_method_status pretty_consume(
85 bt_self_component_sink *component);
86
87 BT_HIDDEN
88 bt_component_class_sink_graph_is_configured_method_status pretty_graph_is_configured(
89 bt_self_component_sink *component);
90
91 BT_HIDDEN
92 void pretty_finalize(bt_self_component_sink *component);
93
94 BT_HIDDEN
95 int pretty_print_event(struct pretty_component *pretty,
96 const bt_message *event_msg);
97
98 BT_HIDDEN
99 int pretty_print_discarded_items(struct pretty_component *pretty,
100 const bt_message *msg);
101
102 BT_HIDDEN
103 void pretty_print_init(void);
104
105 #endif /* BABELTRACE_PLUGIN_TEXT_PRETTY_PRETTY_H */
This page took 0.03052 seconds and 4 git commands to generate.