# The C variable name prefixes for the six kinds of root field types.
class _RootFtPrefixes:
- TPH = 'tph'
- SPC = 'spc'
- SEH = 'seh'
- SEC = 'sec'
- EC = 'ec'
- EP = 'ep'
+ PH = 'ph'
+ PC = 'pc'
+ EH = 'eh'
+ ECC = 'ecc'
+ SC = 'sc'
+ P = 'p'
# The human-readable names of the `_RootFtPrefixes` members.
_ROOT_FT_PREFIX_NAMES = {
- _RootFtPrefixes.TPH: 'packet header',
- _RootFtPrefixes.SPC: 'packet context',
- _RootFtPrefixes.SEH: 'event header',
- _RootFtPrefixes.SEC: 'event common context',
- _RootFtPrefixes.EC: 'specific context',
- _RootFtPrefixes.EP: 'payload',
+ _RootFtPrefixes.PH: 'packet header',
+ _RootFtPrefixes.PC: 'packet context',
+ _RootFtPrefixes.EH: 'event header',
+ _RootFtPrefixes.ECC: 'event common context',
+ _RootFtPrefixes.SC: 'specific context',
+ _RootFtPrefixes.P: 'payload',
}
# stream type `stream_type`.
def _open_func_params_str(self, stream_type):
parts = []
- parts.append(self._proto_params_str(self._trace_type._pkt_header_ft, _RootFtPrefixes.TPH,
+ parts.append(self._proto_params_str(self._trace_type._pkt_header_ft, _RootFtPrefixes.PH,
{'magic', 'stream_id', 'uuid'}))
exclude_set = {
'content_size',
'events_discarded',
}
- parts.append(self._proto_params_str(stream_type._pkt_ctx_ft, _RootFtPrefixes.SPC,
+ parts.append(self._proto_params_str(stream_type._pkt_ctx_ft, _RootFtPrefixes.PC,
exclude_set))
return ''.join(parts)
parts = []
if stream_type._ev_header_ft is not None:
- parts.append(self._proto_params_str(stream_type._ev_header_ft, _RootFtPrefixes.SEH,
+ parts.append(self._proto_params_str(stream_type._ev_header_ft, _RootFtPrefixes.EH,
{'id', 'timestamp'}))
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.SEC))
+ _RootFtPrefixes.ECC))
if ev_type.specific_context_field_type is not None:
parts.append(self._proto_params_str(ev_type.specific_context_field_type,
- _RootFtPrefixes.EC))
+ _RootFtPrefixes.SC))
if ev_type.payload_field_type is not None:
- parts.append(self._proto_params_str(ev_type.payload_field_type, _RootFtPrefixes.EP))
+ parts.append(self._proto_params_str(ev_type.payload_field_type, _RootFtPrefixes.P))
return ''.join(parts)
# parameters for the stream type `stream_type`.
def _serialize_ev_common_ctx_func_params_str(self, stream_type):
return self._proto_params_str(stream_type.event_common_context_field_type,
- _RootFtPrefixes.SEC);
+ _RootFtPrefixes.ECC);
# Generates the bitfield header file contents.
def generate_bitfield_header(self):
'uuid': self._serialize_write_uuid_statements_templ,
'stream_id': self._serialize_write_stream_type_id_statements_templ,
}
- builder.append_root_ft(pkt_header_ft, _RootFtPrefixes.TPH,
+ builder.append_root_ft(pkt_header_ft, _RootFtPrefixes.PH,
spec_serialize_write_templates)
pkt_header_ser_ops = copy.copy(builder.ops)
'events_discarded': self._serialize_write_skip_save_statements_templ,
'content_size': self._serialize_write_skip_save_statements_templ,
}
- builder.append_root_ft(stream_type._pkt_ctx_ft, _RootFtPrefixes.SPC,
+ builder.append_root_ft(stream_type._pkt_ctx_ft, _RootFtPrefixes.PC,
spec_serialize_write_templates)
pkt_ctx_ser_ops = copy.copy(builder.ops[first_op_index:])
'timestamp': self._serialize_write_time_statements_templ,
'id': self._serialize_write_ev_type_id_statements_templ,
}
- builder.append_root_ft(stream_type._ev_header_ft, _RootFtPrefixes.SEH,
+ builder.append_root_ft(stream_type._ev_header_ft, _RootFtPrefixes.EH,
spec_serialize_write_templates)
ev_header_ser_ops = copy.copy(builder.ops)
if stream_type.event_common_context_field_type is not None:
first_op_index = len(builder.ops)
builder.append_root_ft(stream_type.event_common_context_field_type,
- _RootFtPrefixes.SEC)
+ _RootFtPrefixes.ECC)
ev_common_ctx_ser_ops = copy.copy(builder.ops[first_op_index:])
# serialization operations specific to each event type
if ev_type.specific_context_field_type is not None:
first_op_index = len(ev_builder.ops)
ev_builder.append_root_ft(ev_type.specific_context_field_type,
- _RootFtPrefixes.EC)
+ _RootFtPrefixes.SC)
spec_ctx_ser_ops = copy.copy(ev_builder.ops[first_op_index:])
# payload serialization operations
if ev_type.payload_field_type is not None:
first_op_index = len(ev_builder.ops)
- ev_builder.append_root_ft(ev_type.payload_field_type, _RootFtPrefixes.EP)
+ ev_builder.append_root_ft(ev_type.payload_field_type, _RootFtPrefixes.P)
payload_ser_ops = copy.copy(ev_builder.ops[first_op_index:])
ev_ser_ops[ev_type] = _EventOps(spec_ctx_ser_ops, payload_ser_ops)
{% if stream_type.event_common_context_field_type %}
/* serialize common context */
- {% set params = macros.ft_call_params(root_ft_prefixes.SEC, stream_type.event_common_context_field_type) %}
+ {% set params = macros.ft_call_params(root_ft_prefixes.ECC, stream_type.event_common_context_field_type) %}
_serialize_ev_common_ctx_{{ stream_type.name }}(ctx{{ params }});
{% endif %}
{% set this_ev_ops = this_stream_ops.ev_ops[ev_type] %}
ctx->in_tracing_section = 1;
/* compute event size */
- {% set ev_common_ctx_params = macros.ft_call_params(root_ft_prefixes.SEC, stream_type.event_common_context_field_type) %}
- {% set spec_ctx_params = macros.ft_call_params(root_ft_prefixes.EC, ev_type.specific_context_field_type) %}
- {% set payload_params = macros.ft_call_params(root_ft_prefixes.EP, 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) %}
+ {% 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 %}
ev_size = _ev_size_{{ stream_type.name }}_{{ ev_type.name }}(_TO_VOID_PTR(ctx){{ params }});