barectf.c.j2: only declare `ts` variable when needed
[barectf.git] / barectf / templates / c / barectf.c.j2
CommitLineData
fdbf8740
PP
1{#
2 # The MIT License (MIT)
3 #
4 # Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining
7 # a copy of this software and associated documentation files (the
8 # "Software"), to deal in the Software without restriction, including
9 # without limitation the rights to use, copy, modify, merge, publish,
10 # distribute, sublicense, and/or sell copies of the Software, and to
11 # permit persons to whom the Software is furnished to do so, subject to
12 # the following conditions:
13 #
14 # The above copyright notice and this permission notice shall be
15 # included in all copies or substantial portions of the Software.
16 #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #}
d6483c83
PP
25{% import 'common.j2' as common %}
26{% import 'c/common.j2' as c_common %}
27{% import 'c/barectf.c-macros.j2' as macros %}
28{% set prefix = common.prefix %}
29{% set ucprefix = common.ucprefix %}
30{% set ctx_struct_name = c_common.ctx_struct_name %}
31{% set cg_opts = cfg.options.code_generation_options %}
e18cf9d6 32{% set const_params = true %}
1cf325c4 33{% include 'license-header.j2' %}
e72875eb 34
d6483c83
PP
35
36#include <stdint.h>
37#include <string.h>
38#include <assert.h>
39
40#include "{{ header_file_name }}"
41#include "{{ bitfield_header_file_name }}"
42
629cfd44
PP
43#define _ALIGN(_at_var, _align) \
44 do { \
45 (_at_var) = ((_at_var) + ((_align) - 1)) & -(_align); \
d6483c83
PP
46 } while (0)
47
48#ifdef __cplusplus
49# define _TO_VOID_PTR(_value) static_cast<void *>(_value)
50# define _FROM_VOID_PTR(_type, _value) static_cast<_type *>(_value)
51#else
52# define _TO_VOID_PTR(_value) ((void *) (_value))
53# define _FROM_VOID_PTR(_type, _value) ((_type *) (_value))
54#endif
55
56#define _BITS_TO_BYTES(_x) ((_x) >> 3)
57#define _BYTES_TO_BITS(_x) ((_x) << 3)
58
59union _f2u {
60 float f;
61 uint32_t u;
62};
63
64union _d2u {
65 double f;
66 uint64_t u;
67};
68
0ccb7f47 69uint32_t {{ prefix }}packet_size(const void * const vctx)
d6483c83 70{
0ccb7f47 71 return _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->packet_size;
d6483c83
PP
72}
73
e18cf9d6 74int {{ prefix }}packet_is_full(const void * const vctx)
d6483c83 75{
e18cf9d6 76 const struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx);
d6483c83
PP
77
78 return ctx->at == ctx->packet_size;
79}
80
e18cf9d6 81int {{ prefix }}packet_is_empty(const void * const vctx)
d6483c83 82{
e18cf9d6 83 const struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx);
d6483c83
PP
84
85 return ctx->at <= ctx->off_content;
86}
87
e18cf9d6 88uint32_t {{ prefix }}packet_events_discarded(const void * const vctx)
d6483c83 89{
e18cf9d6 90 return _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->events_discarded;
d6483c83
PP
91}
92
ed4a69c0
PP
93uint32_t {{ prefix }}discarded_event_records_count(const void * const vctx)
94{
95 return {{ prefix }}packet_events_discarded(vctx);
96}
97
e18cf9d6 98uint8_t *{{ prefix }}packet_buf(const void * const vctx)
d6483c83 99{
e18cf9d6 100 return _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->buf;
d6483c83
PP
101}
102
3bf37cb9
PP
103uint8_t *{{ prefix }}packet_buf_addr(const void * const vctx)
104{
105 return {{ prefix }}packet_buf(vctx);
106}
107
e18cf9d6 108uint32_t {{ prefix }}packet_buf_size(const void * const vctx)
d6483c83 109{
e18cf9d6 110 const struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx);
d6483c83
PP
111
112 return _BITS_TO_BYTES(ctx->packet_size);
113}
114
e18cf9d6
PP
115void {{ prefix }}packet_set_buf(void * const vctx, uint8_t * const buf,
116 const uint32_t buf_size)
d6483c83 117{
e18cf9d6 118 struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
d6483c83
PP
119
120 ctx->buf = buf;
121 ctx->packet_size = _BYTES_TO_BITS(buf_size);
122}
123
e18cf9d6 124int {{ prefix }}packet_is_open(const void * const vctx)
d6483c83 125{
e18cf9d6 126 return _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->packet_is_open;
d6483c83
PP
127}
128
e18cf9d6 129int {{ prefix }}is_in_tracing_section(const void * const vctx)
d6483c83 130{
e18cf9d6 131 return _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->in_tracing_section;
d6483c83
PP
132}
133
e18cf9d6 134volatile const int *{{ prefix }}is_in_tracing_section_ptr(const void * const vctx)
d6483c83 135{
e18cf9d6 136 return &_FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->in_tracing_section;
d6483c83
PP
137}
138
e18cf9d6 139int {{ prefix }}is_tracing_enabled(const void * const vctx)
d6483c83 140{
e18cf9d6 141 return _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->is_tracing_enabled;
d6483c83
PP
142}
143
e18cf9d6 144void {{ prefix }}enable_tracing(void * const vctx, const int enable)
d6483c83
PP
145{
146 _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx)->is_tracing_enabled = enable;
147}
148
149static
e18cf9d6 150void _write_c_str(struct {{ ctx_struct_name }} * const ctx, const char * const src)
d6483c83 151{
e18cf9d6 152 const uint32_t sz = strlen(src) + 1;
d6483c83
PP
153
154 memcpy(&ctx->buf[_BITS_TO_BYTES(ctx->at)], src, sz);
155 ctx->at += _BYTES_TO_BITS(sz);
156}
157
158static
e8f0d548 159int _reserve_er_space(void * const vctx, const uint32_t er_size)
d6483c83 160{
d02c7d33 161 int ret;
e18cf9d6 162 struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
d6483c83 163
9318c705 164 /* Event _cannot_ fit? */
e8f0d548 165 if (er_size > (ctx->packet_size - ctx->off_content)) {
d02c7d33 166 goto no_space;
d6483c83
PP
167 }
168
9318c705 169 /* Packet is full? */
d6483c83 170 if ({{ prefix }}packet_is_full(ctx)) {
644b3b4f 171 /* Yes: is the back end full? */
d6483c83 172 if (ctx->cbs.is_backend_full(ctx->data)) {
e8f0d548 173 /* Yes: discard event record */
d02c7d33 174 goto no_space;
d6483c83
PP
175 }
176
9318c705 177 /* Back-end is _not_ full: open new packet */
d6483c83
PP
178 ctx->use_cur_last_event_ts = 1;
179 ctx->cbs.open_packet(ctx->data);
180 ctx->use_cur_last_event_ts = 0;
181 }
182
9318c705 183 /* Event fits the current packet? */
e8f0d548 184 if (er_size > (ctx->packet_size - ctx->at)) {
9318c705 185 /* No: close packet now */
d6483c83
PP
186 ctx->use_cur_last_event_ts = 1;
187 ctx->cbs.close_packet(ctx->data);
188 ctx->use_cur_last_event_ts = 0;
189
644b3b4f 190 /* Is the back end full? */
d6483c83 191 if (ctx->cbs.is_backend_full(ctx->data)) {
e8f0d548 192 /* Yes: discard event record */
d02c7d33 193 goto no_space;
d6483c83
PP
194 }
195
9318c705 196 /* Back-end is _not_ full: open new packet */
d6483c83
PP
197 ctx->use_cur_last_event_ts = 1;
198 ctx->cbs.open_packet(ctx->data);
199 ctx->use_cur_last_event_ts = 0;
e8f0d548 200 assert(er_size <= (ctx->packet_size - ctx->at));
d6483c83
PP
201 }
202
d02c7d33
PP
203 ret = 1;
204 goto end;
205
206no_space:
207 ctx->events_discarded++;
208 ret = 0;
209
210end:
211 return ret;
d6483c83
PP
212}
213
214static
e8f0d548 215void _commit_er(void * const vctx)
d6483c83 216{
e18cf9d6 217 struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
d6483c83 218
9318c705 219 /* Is the packet full? */
d6483c83 220 if ({{ prefix }}packet_is_full(ctx)) {
9318c705 221 /* Yes: close it now */
d6483c83
PP
222 ctx->cbs.close_packet(ctx->data);
223 }
224}
225
226{% include 'c/ctx-init-func-proto.j2' %}
227
228{
e18cf9d6 229 struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
d6483c83
PP
230 ctx->cbs = cbs;
231 ctx->data = data;
232 ctx->buf = buf;
233 ctx->packet_size = _BYTES_TO_BITS(buf_size);
234 ctx->at = 0;
235 ctx->events_discarded = 0;
236 ctx->packet_is_open = 0;
237 ctx->in_tracing_section = 0;
238 ctx->is_tracing_enabled = 1;
239 ctx->use_cur_last_event_ts = 0;
240}
241
e8f0d548
PP
242{% for dst in cfg.trace.type.data_stream_types | sort %}
243 {% set def_clk_type = dst.default_clock_type %}
244 {% set sctx_name %}{{ prefix }}{{ dst.name }}{% endset %}
245 {% set this_ds_ops = ds_ops[dst] %}
d6483c83
PP
246 {% include 'c/open-func-proto.j2' %}
247
248{
f5c70e1e 249 {{ macros.open_close_func_preamble(dst, dst.features.packet_features.beginning_timestamp_field_type) | indent_tab }}
d6483c83
PP
250
251 /*
252 * This function is either called by a tracing function, or
253 * directly by the platform.
254 *
255 * If it's called by a tracing function, then
256 * `ctx->in_tracing_section` is 1, so it's safe to open
257 * the packet here (alter the packet), even if tracing was
258 * disabled in the meantime because we're already in a tracing
259 * section (which finishes at the end of the tracing function
260 * call).
261 *
262 * If it's called directly by the platform, then if tracing is
263 * disabled, we don't want to alter the packet, and return
264 * immediately.
265 */
266 if (!ctx->is_tracing_enabled && !saved_in_tracing_section) {
267 ctx->in_tracing_section = 0;
d02c7d33 268 goto end;
d6483c83
PP
269 }
270
9318c705 271 /* We can alter the packet */
d6483c83
PP
272 ctx->in_tracing_section = 1;
273
9318c705 274 /* Do not open a packet that is already open */
d6483c83
PP
275 if (ctx->packet_is_open) {
276 ctx->in_tracing_section = saved_in_tracing_section;
d02c7d33 277 goto end;
d6483c83
PP
278 }
279
280 ctx->at = 0;
e8f0d548 281 {% set pkt_header_op = this_ds_ops.pkt_header_op %}
2394a4b4 282 {% if pkt_header_op %}
d6483c83 283
e8f0d548 284 {{ pkt_header_op.serialize_str(dst=dst) | indent_tab }}
d6483c83
PP
285 {% endif %}
286
e8f0d548 287 {{ this_ds_ops.pkt_ctx_op.serialize_str(dst=dst) | indent_tab }}
d6483c83 288
9318c705 289 /* Save content beginning's offset */
d6483c83
PP
290 ctx->off_content = ctx->at;
291
9318c705 292 /* Mark current packet as open */
d6483c83
PP
293 ctx->packet_is_open = 1;
294
9318c705 295 /* Not tracing anymore */
d6483c83 296 ctx->in_tracing_section = saved_in_tracing_section;
d02c7d33
PP
297
298end:
299 return;
d6483c83
PP
300}
301
302 {% include 'c/close-func-proto.j2' %}
303
304{
f5c70e1e 305 {{ macros.open_close_func_preamble(dst, dst.features.packet_features.end_timestamp_field_type) | indent_tab }}
d6483c83
PP
306
307 /*
308 * This function is either called by a tracing function, or
309 * directly by the platform.
310 *
311 * If it's called by a tracing function, then
312 * `ctx->in_tracing_section` is 1, so it's safe to close
313 * the packet here (alter the packet), even if tracing was
314 * disabled in the meantime, because we're already in a tracing
315 * section (which finishes at the end of the tracing function
316 * call).
317 *
318 * If it's called directly by the platform, then if tracing is
319 * disabled, we don't want to alter the packet, and return
320 * immediately.
321 */
322 if (!ctx->is_tracing_enabled && !saved_in_tracing_section) {
323 ctx->in_tracing_section = 0;
d02c7d33 324 goto end;
d6483c83
PP
325 }
326
9318c705 327 /* We can alter the packet */
d6483c83
PP
328 ctx->in_tracing_section = 1;
329
9318c705 330 /* Do not close a packet that is not open */
d6483c83
PP
331 if (!ctx->packet_is_open) {
332 ctx->in_tracing_section = saved_in_tracing_section;
d02c7d33 333 goto end;
d6483c83
PP
334 }
335
9318c705 336 /* Save content size */
d6483c83 337 ctx->content_size = ctx->at;
03088329 338 {% set name = 'timestamp_end' %}
e8f0d548
PP
339 {% if name in dst._pkt_ctx_ft.members %}
340 {% set op = ds_op_pkt_ctx_op(dst, name) %}
d6483c83 341
9318c705 342 /* Go back to `timestamp_end` field offset */
6bc97055 343 ctx->at = sctx->off_{{ op | op_src_var_name }};
d6483c83
PP
344
345 {% set src = 'ts' %}
adb5316b 346 {% filter indent_tab(indent_first=true) %}
d6483c83
PP
347 {% include 'c/serialize-write-saved-int-statements.j2' %}
348
349 {% endfilter %}
350 {% endif %}
03088329 351 {% set name = 'content_size' %}
e8f0d548
PP
352 {% if name in dst._pkt_ctx_ft.members %}
353 {% set op = ds_op_pkt_ctx_op(dst, name) %}
d6483c83 354
9318c705 355 /* Go back to `content_size` field offset */
6bc97055 356 ctx->at = sctx->off_{{ op | op_src_var_name }};
d6483c83 357
03088329 358 {% set src %}ctx->{{ name }}{% endset %}
adb5316b 359 {% filter indent_tab(indent_first=true) %}
d6483c83
PP
360 {% include 'c/serialize-write-saved-int-statements.j2' %}
361
362 {% endfilter %}
363 {% endif %}
03088329 364 {% set name = 'events_discarded' %}
e8f0d548
PP
365 {% if name in dst._pkt_ctx_ft.members %}
366 {% set op = ds_op_pkt_ctx_op(dst, name) %}
d6483c83 367
9318c705 368 /* Go back to `events_discarded` field offset */
6bc97055 369 ctx->at = sctx->off_{{ op | op_src_var_name }};
d6483c83 370
03088329 371 {% set src %}ctx->{{ name }}{% endset %}
adb5316b 372 {% filter indent_tab(indent_first=true) %}
d6483c83
PP
373 {% include 'c/serialize-write-saved-int-statements.j2' %}
374
375 {% endfilter %}
376 {% endif %}
377
9318c705 378 /* Go back to end of packet */
d6483c83
PP
379 ctx->at = ctx->packet_size;
380
9318c705 381 /* Mark packet as closed */
d6483c83
PP
382 ctx->packet_is_open = 0;
383
9318c705 384 /* Not tracing anymore */
d6483c83 385 ctx->in_tracing_section = saved_in_tracing_section;
d02c7d33
PP
386
387end:
388 return;
d6483c83 389}
d6483c83 390
f42a1daf 391 {% if dst._er_header_ft %}
e8f0d548
PP
392static void _serialize_er_header_{{ dst.name }}(void * const vctx,
393 const uint32_t ert_id)
d6483c83 394{
e18cf9d6 395 struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
f5c70e1e 396 {% if def_clk_type and dst.features.event_record_features.timestamp_field_type %}
e18cf9d6 397 struct {{ sctx_name }}_ctx * const sctx = _FROM_VOID_PTR(struct {{ sctx_name }}_ctx, vctx);
d6483c83
PP
398 const {{ cg_opts.clock_type_c_types[def_clk_type] }} ts = sctx->cur_last_event_ts;
399 {% endif %}
400
e8f0d548 401 {{ this_ds_ops.er_header_op.serialize_str(dst=dst) | indent_tab }}
d6483c83 402}
f42a1daf 403
d6483c83 404 {% endif %}
e8f0d548 405 {% if dst.event_record_common_context_field_type %}
e8f0d548 406static void _serialize_er_common_ctx_{{ dst.name }}(void * const vctx{{ dst | serialize_er_common_ctx_func_params_str(const_params) }})
d6483c83 407{
e18cf9d6 408 struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
d6483c83 409
e8f0d548 410 {{ this_ds_ops.er_common_ctx_op.serialize_str(dst=dst) | indent_tab }}
d6483c83 411}
f42a1daf 412
d6483c83
PP
413 {% endif %}
414 {# internal serialization functions #}
e8f0d548 415 {% for ert in dst.event_record_types | sort %}
e8f0d548 416static void _serialize_er_{{ dst.name }}_{{ ert.name }}(void * const vctx{{ (dst, ert) | trace_func_params_str(const_params) }})
d6483c83 417{
e18cf9d6 418 struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
e8f0d548 419 {% if dst._er_header_ft %}
d6483c83 420
9318c705 421 /* Serialize header */
e8f0d548 422 _serialize_er_header_{{ dst.name }}(ctx, {{ ert.id }});
d6483c83 423 {% endif %}
e8f0d548 424 {% if dst.event_record_common_context_field_type %}
d6483c83 425
9318c705 426 /* Serialize common context */
e8f0d548
PP
427 {% set params = macros.ft_call_params(root_ft_prefixes.ERCC, dst.event_record_common_context_field_type) %}
428 _serialize_er_common_ctx_{{ dst.name }}(ctx{{ params }});
d6483c83 429 {% endif %}
e8f0d548
PP
430 {% set this_er_ops = this_ds_ops.er_ops[ert] %}
431 {% if this_er_ops.spec_ctx_op %}
d6483c83 432
e8f0d548 433 {{ this_er_ops.spec_ctx_op.serialize_str(dst=dst, ert=ert) | indent_tab }}
d6483c83 434 {% endif %}
e8f0d548 435 {% if this_er_ops.payload_op %}
d6483c83 436
e8f0d548 437 {{ this_er_ops.payload_op.serialize_str(dst=dst, ert=ert) | indent_tab }}
d6483c83
PP
438 {% endif %}
439}
f42a1daf 440
d6483c83
PP
441 {% endfor %}
442 {# internal size functions #}
e8f0d548
PP
443 {% for ert in dst.event_record_types | sort %}
444 {% set this_er_ops = this_ds_ops.er_ops[ert] %}
e8f0d548 445static uint32_t _er_size_{{ dst.name }}_{{ ert.name }}(void * const vctx{{ (dst, ert) | trace_func_params_str(const_params, only_dyn=true) }})
d6483c83 446{
e18cf9d6 447 struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
d6483c83 448 uint32_t at = ctx->at;
e8f0d548 449 {% if this_ds_ops.er_header_op %}
d6483c83 450
e8f0d548 451 {{ this_ds_ops.er_header_op.size_str(dst=dst) | indent_tab }}
d6483c83 452 {% endif %}
e8f0d548 453 {% if this_ds_ops.er_common_ctx_op %}
d6483c83 454
e8f0d548 455 {{ this_ds_ops.er_common_ctx_op.size_str(dst=dst) | indent_tab }}
d6483c83 456 {% endif %}
e8f0d548 457 {% if this_er_ops.spec_ctx_op %}
d6483c83 458
e8f0d548 459 {{ this_er_ops.spec_ctx_op.size_str(dst=dst, ert=ert) | indent_tab }}
d6483c83 460 {% endif %}
e8f0d548 461 {% if this_er_ops.payload_op %}
d6483c83 462
e8f0d548 463 {{ this_er_ops.payload_op.size_str(dst=dst, ert=ert) | indent_tab }}
d6483c83
PP
464 {% endif %}
465
466 return at - ctx->at;
467}
f42a1daf 468
d6483c83
PP
469 {% endfor %}
470 {# public tracing functions #}
e8f0d548 471 {% for ert in dst.event_record_types | sort %}
d6483c83
PP
472 {% include 'c/trace-func-proto.j2' %}
473
474{
e18cf9d6 475 struct {{ ctx_struct_name }} * const ctx = &sctx->parent;
e8f0d548 476 uint32_t er_size;
d6483c83
PP
477
478 {% if def_clk_type %}
462e49b3 479 /* Save timestamp */
d6483c83
PP
480 sctx->cur_last_event_ts = ctx->cbs.{{ def_clk_type.name }}_clock_get_value(ctx->data);
481
482 {% endif %}
d6483c83 483 if (!ctx->is_tracing_enabled) {
d02c7d33 484 goto end;
d6483c83
PP
485 }
486
9318c705 487 /* We can alter the packet */
d6483c83
PP
488 ctx->in_tracing_section = 1;
489
e8f0d548
PP
490 /* Compute event record size */
491 {% set er_common_ctx_params = macros.ft_call_params(root_ft_prefixes.ERCC, dst.event_record_common_context_field_type, true) %}
a7e54146
PP
492 {% set spec_ctx_params = macros.ft_call_params(root_ft_prefixes.ERSC, ert.specific_context_field_type, true) %}
493 {% set payload_params = macros.ft_call_params(root_ft_prefixes.ERP, ert.payload_field_type, true) %}
e8f0d548
PP
494 {% set params %}{{ er_common_ctx_params }}{{ spec_ctx_params }}{{ payload_params }}{% endset %}
495 er_size = _er_size_{{ dst.name }}_{{ ert.name }}(_TO_VOID_PTR(ctx){{ params }});
d6483c83 496
9318c705 497 /* Is there enough space to serialize? */
e8f0d548 498 if (!_reserve_er_space(_TO_VOID_PTR(ctx), er_size)) {
d6483c83
PP
499 /* no: forget this */
500 ctx->in_tracing_section = 0;
d02c7d33 501 goto end;
d6483c83
PP
502 }
503
e8f0d548
PP
504 /* Serialize event record */
505 {% set er_common_ctx_params = macros.ft_call_params(root_ft_prefixes.ERCC, dst.event_record_common_context_field_type) %}
a7e54146
PP
506 {% set spec_ctx_params = macros.ft_call_params(root_ft_prefixes.ERSC, ert.specific_context_field_type) %}
507 {% set payload_params = macros.ft_call_params(root_ft_prefixes.ERP, ert.payload_field_type) %}
e8f0d548
PP
508 {% set params %}{{ er_common_ctx_params }}{{ spec_ctx_params }}{{ payload_params }}{% endset %}
509 _serialize_er_{{ dst.name }}_{{ ert.name }}(_TO_VOID_PTR(ctx){{ params }});
d6483c83 510
e8f0d548
PP
511 /* Commit event record */
512 _commit_er(_TO_VOID_PTR(ctx));
d6483c83 513
9318c705 514 /* Not tracing anymore */
d6483c83 515 ctx->in_tracing_section = 0;
d02c7d33
PP
516
517end:
518 return;
d6483c83 519}
f42a1daf 520 {% if not loop.last %}{{ '\n' }}{% endif %}
d6483c83
PP
521 {% endfor %}
522{% endfor %}
This page took 0.049328 seconds and 4 git commands to generate.