1 {% import 'common.j2' as common %}
5 * The MIT License (MIT)
7 * Copyright (c) 2015-2020 Philippe Proulx <pproulx@efficios.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29 * The following TSDL code was generated by barectf v{{ barectf_version.__version__ }}
30 * on {{ common.gen_date }}.
32 * For more details, see <https://barectf.org/>.
35 # Generates a root field type string named `name` for the field type
36 # `rft` with all the lines except the first one indented with a single
39 {% macro root_ft(name, rft) -%}
40 {{ name }} := {{ rft | ft_str | indent_tab }};
46 byte_order = {{ cfg.trace.type.default_byte_order | bo_str }};
47 {% if cfg.trace.type.uuid %}
48 uuid = "{{ cfg.trace.type.uuid }}";
50 {% if cfg.trace.type._pkt_header_ft %}
51 {{ root_ft('packet.header', cfg.trace.type._pkt_header_ft) }}
56 {% for name, value in cfg.trace.environment.items() %}
57 {{ name }} = {{ value if value is number else '"{}"'.format(value | escape_dq) }};
61 {# all clock types (stream types's default clock types) #}
62 {% for clk_type in cfg.trace.type.clock_types | sort %}
64 name = {{ clk_type.name }};
65 {% if clk_type.description %}
66 description = "{{ clk_type.description | escape_dq }}";
68 {% if clk_type.uuid %}
69 uuid = "{{ clk_type.uuid }}";
71 freq = {{ clk_type.frequency }};
72 precision = {{ clk_type.precision }};
73 offset_s = {{ clk_type.offset.seconds }};
74 offset = {{ clk_type.offset.cycles }};
75 absolute = {{ 'true' if clk_type.origin_is_unix_epoch else 'false' }};
79 {# stream types and their event types #}
80 {%- for stream_type in cfg.trace.type.stream_types | sort %}
81 /* Stream type `{{ stream_type.name }}` */
83 id = {{ stream_type.id }};
84 {{ root_ft('packet.context', stream_type._pkt_ctx_ft) }}
85 {% if stream_type._ev_header_ft %}
86 {{ root_ft('event.header', stream_type._ev_header_ft) }}
88 {% if stream_type.event_common_context_field_type %}
89 {{ root_ft('event.context', stream_type.event_common_context_field_type) }}
93 {# stream type's event types #}
94 {% for ev_type in stream_type.event_types | sort %}
96 id = {{ ev_type.id }};
97 stream_id = {{ stream_type.id }};
98 name = "{{ ev_type.name }}";
99 {% if ev_type.log_level %}
100 loglevel = {{ ev_type.log_level }};
102 {% if ev_type.specific_context_field_type %}
103 {{ root_ft('context', ev_type.specific_context_field_type) }}
105 {% if ev_type.payload_field_type %}
106 {{ root_ft('fields', ev_type.payload_field_type) }}