bt2c::Logger: remove unused cLevel() method
[babeltrace.git] / src / plugins / text / pretty / pretty.h
CommitLineData
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 15
5288c8ae 16/*
e7401568 17 * `bt_field_*_enumeration` are backed by 64 bits integers so the maximum
5288c8ae
GB
18 * number of bitflags in any enumeration is 64.
19 */
20#define ENUMERATION_MAX_BITFLAGS_COUNT (sizeof(uint64_t) * 8)
21
3228cc1d
PP
22enum pretty_default {
23 PRETTY_DEFAULT_UNSET,
24 PRETTY_DEFAULT_SHOW,
25 PRETTY_DEFAULT_HIDE,
6e1bc0df
MD
26};
27
3228cc1d
PP
28enum pretty_color_option {
29 PRETTY_COLOR_OPT_NEVER,
30 PRETTY_COLOR_OPT_AUTO,
31 PRETTY_COLOR_OPT_ALWAYS,
ad96d936
PP
32};
33
3228cc1d 34struct pretty_options {
6e1bc0df 35 char *output_path;
6e1bc0df 36
3228cc1d
PP
37 enum pretty_default name_default;
38 enum pretty_default field_default;
6e1bc0df
MD
39
40 bool print_scope_field_names;
41 bool print_header_field_names;
42 bool print_context_field_names;
43 bool print_payload_field_names;
44
45 bool print_delta_field;
5288c8ae 46 bool print_enum_flags;
6e1bc0df
MD
47 bool print_loglevel_field;
48 bool print_emf_field;
60535549 49 bool print_callsite_field;
6e1bc0df
MD
50 bool print_trace_field;
51 bool print_trace_domain_field;
52 bool print_trace_procname_field;
53 bool print_trace_vpid_field;
54 bool print_trace_hostname_field;
55
56 bool print_timestamp_cycles;
57 bool clock_seconds;
58 bool clock_date;
59 bool clock_gmt;
3228cc1d 60 enum pretty_color_option color;
a263021c 61 bool verbose;
af9a82eb
JG
62};
63
3228cc1d
PP
64struct pretty_component {
65 struct pretty_options options;
9a2c8b8e 66 bt_message_iterator *iterator;
af9a82eb 67 FILE *out, *err;
6a18b281 68 int depth; /* nesting, used for tabulation alignment. */
6e1bc0df 69 bool start_line;
6a18b281 70 GString *string;
5280f742 71 GString *tmp_string;
ad96d936 72 bool use_colors;
3af83b5a
MD
73
74 uint64_t last_cycles_timestamp;
75 uint64_t delta_cycles;
76
77 uint64_t last_real_timestamp;
78 uint64_t delta_real_timestamp;
18adbd19
MD
79
80 bool negative_timestamp_warning_done;
a8e4caa0 81
5288c8ae
GB
82 /*
83 * For each bit of the integer backing the enumeration we have a list
84 * (GPtrArray) of labels (char *) for that bit.
85 *
86 * Allocate all label arrays during the initialization of the component
87 * and reuse the same set of arrays for all enumerations. This prevents
88 * allocation and deallocation everytime the component encounters a
89 * enumeration field. Allocating and deallocating that often could
90 * severely impact performance.
91 */
92 GPtrArray *enum_bit_labels[ENUMERATION_MAX_BITFLAGS_COUNT];
93
a8e4caa0
SM
94 bt_logging_level log_level;
95 bt_self_component *self_comp;
af9a82eb
JG
96};
97
21a9f056 98bt_component_class_initialize_method_status pretty_init(
59225a3e
SM
99 bt_self_component_sink *component,
100 bt_self_component_sink_configuration *config,
101 const bt_value *params,
3228cc1d
PP
102 void *init_method_data);
103
d24d5663 104bt_component_class_sink_consume_method_status pretty_consume(
b19ff26f 105 bt_self_component_sink *component);
3228cc1d 106
d24d5663 107bt_component_class_sink_graph_is_configured_method_status pretty_graph_is_configured(
5badd463 108 bt_self_component_sink *component);
3228cc1d 109
b19ff26f 110void pretty_finalize(bt_self_component_sink *component);
3228cc1d 111
d94d92ac 112int pretty_print_event(struct pretty_component *pretty,
d6e69534 113 const bt_message *event_msg);
af9a82eb 114
8e53bed4
PP
115int pretty_print_discarded_items(struct pretty_component *pretty,
116 const bt_message *msg);
0f6bea4e 117
04609487
PP
118void pretty_print_init(void);
119
3228cc1d 120#endif /* BABELTRACE_PLUGIN_TEXT_PRETTY_PRETTY_H */
This page took 0.096678 seconds and 5 git commands to generate.