# Each parameter has the prefix `name_prefix` followed with `_`.
#
# Members of which the name is in `exclude_set` are excluded.
- def _proto_params_str(self, root_ft, name_prefix, const_params, exclude_set=None):
+ def _proto_params_str(self, root_ft, name_prefix, const_params, exclude_set=None,
+ only_dyn=False):
if root_ft is None:
return
if member_name in exclude_set:
continue
+ if only_dyn and not member.field_type.size_is_dynamic:
+ continue
+
params.append(_FtParam(member.field_type, member_name))
return self._func_proto_params_templ.render(params=params, prefix=name_prefix,
# Returns the tracing function prototype parameters for the stream
# and event types `stream_ev_types`.
- def _trace_func_params_str(self, stream_ev_types, const_params):
+ def _trace_func_params_str(self, stream_ev_types, const_params, only_dyn=False):
stream_type = stream_ev_types[0]
ev_type = stream_ev_types[1]
parts = []
if stream_type._ev_header_ft is not None:
parts.append(self._proto_params_str(stream_type._ev_header_ft, _RootFtPrefixes.EH,
- const_params, {'id', 'timestamp'}))
+ const_params, {'id', 'timestamp'},
+ only_dyn=only_dyn))
if stream_type.event_common_context_field_type is not None:
parts.append(self._proto_params_str(stream_type.event_common_context_field_type,
- _RootFtPrefixes.ECC, const_params))
+ _RootFtPrefixes.ECC, const_params,
+ only_dyn=only_dyn))
if ev_type.specific_context_field_type is not None:
parts.append(self._proto_params_str(ev_type.specific_context_field_type,
- _RootFtPrefixes.SC, const_params))
+ _RootFtPrefixes.SC, const_params,
+ only_dyn=only_dyn))
if ev_type.payload_field_type is not None:
parts.append(self._proto_params_str(ev_type.payload_field_type, _RootFtPrefixes.P,
- const_params))
+ const_params, only_dyn=only_dyn))
return ''.join(parts)
#
# , ecc_peer_id, ecc_addr, p_msg_id, p_msg
#}
-{% macro ft_call_params(param_prefix, ft) %}
+{% macro ft_call_params(param_prefix, ft, only_dyn=false) %}
{% if ft %}
- {% for member_name in ft.members %}
+ {% for member_name, member in ft.members.items() %}
+ {% if not only_dyn or member.field_type.size_is_dynamic %}
, {{ param_prefix }}_{{ member_name }}
- {%- endfor %}
+ {%- endif %}
+ {% endfor %}
{% endif %}
{% endmacro %}
{% for ev_type in stream_type.event_types | sort %}
{% set this_ev_ops = this_stream_ops.ev_ops[ev_type] %}
-static uint32_t _ev_size_{{ stream_type.name }}_{{ ev_type.name }}(void * const vctx{{ (stream_type, ev_type) | trace_func_params_str(const_params) }})
+static uint32_t _ev_size_{{ stream_type.name }}_{{ ev_type.name }}(void * const vctx{{ (stream_type, ev_type) | trace_func_params_str(const_params, only_dyn=true) }})
{
struct {{ ctx_struct_name }} * const ctx = _FROM_VOID_PTR(struct {{ ctx_struct_name }}, vctx);
uint32_t at = ctx->at;
ctx->in_tracing_section = 1;
/* Compute event size */
- {% set ev_common_ctx_params = macros.ft_call_params(root_ft_prefixes.ECC, stream_type.event_common_context_field_type) %}
- {% set spec_ctx_params = macros.ft_call_params(root_ft_prefixes.SC, ev_type.specific_context_field_type) %}
- {% set payload_params = macros.ft_call_params(root_ft_prefixes.P, ev_type.payload_field_type) %}
+ {% set ev_common_ctx_params = macros.ft_call_params(root_ft_prefixes.ECC, stream_type.event_common_context_field_type, true) %}
+ {% set spec_ctx_params = macros.ft_call_params(root_ft_prefixes.SC, ev_type.specific_context_field_type, true) %}
+ {% set payload_params = macros.ft_call_params(root_ft_prefixes.P, ev_type.payload_field_type, true) %}
{% set params %}{{ ev_common_ctx_params }}{{ spec_ctx_params }}{{ payload_params }}{% endset %}
ev_size = _ev_size_{{ stream_type.name }}_{{ ev_type.name }}(_TO_VOID_PTR(ctx){{ params }});
}
/* Serialize event */
+ {% set ev_common_ctx_params = macros.ft_call_params(root_ft_prefixes.ECC, stream_type.event_common_context_field_type) %}
+ {% set spec_ctx_params = macros.ft_call_params(root_ft_prefixes.SC, ev_type.specific_context_field_type) %}
+ {% set payload_params = macros.ft_call_params(root_ft_prefixes.P, ev_type.payload_field_type) %}
+ {% set params %}{{ ev_common_ctx_params }}{{ spec_ctx_params }}{{ payload_params }}{% endset %}
_serialize_ev_{{ stream_type.name }}_{{ ev_type.name }}(_TO_VOID_PTR(ctx){{ params }});
/* Commit event */