template <typename MessageType>

class TracedProto

Defined at line 57 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

A Wrapper around a protozero message to allow C++ classes to specify how it

should be serialised into the trace:

class Foo {

public:

void WriteIntoTrace(perfetto::TracedProto

<pbzero

::Foo> message) {

message->set_int_field(int_field_);

}

};

This class also exposes EventContext, e.g. to enable data interning.

NOTE: the functionality below is not ready yet.

TODO(altimin): Make the interop below possible.

TracedProto also provides a seamless integration with writing untyped

values via TracedValue / TracedDictionary / TracedArray:

- TracedValue can be converted to a TracedProto, either by calling

TracedValue::WriteProto

<T

>() or implicitly.

- If a proto message has a repeating DebugAnnotation debug_annotations

field, it can be filled using the TracedDictionary obtained from

TracedProto::AddDebugAnnotations.

Public Methods

void TracedProto<MessageType> (TracedValue && value)

implicit

Defined at line 60 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

void ~TracedProto<MessageType> ()

Defined at line 62 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

void TracedProto<MessageType> (const TracedProto<MessageType> & )

Defined at line 64 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

TracedProto<MessageType> & operator= (const TracedProto<MessageType> & )

Defined at line 65 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

TracedProto<MessageType> & operator= (TracedProto<MessageType> && )

Defined at line 66 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

void TracedProto<MessageType> (TracedProto<MessageType> && )

Defined at line 67 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

MessageType * operator-> ()

Defined at line 69 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

MessageType * message ()

Defined at line 71 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

template <typename Check = void>
TracedDictionary AddDebugAnnotations ()

Write additional untyped values into the same context, which is useful

when a given C++ class has a typed representation, but also either has

members which can only be written into an untyped context (e.g. they are

autogenerated) or it's desirable to have a way to quickly extend the

trace representation of this class (e.g. for debugging).

The usage of the returned TracedDictionary should not be interleaved with

writing into |message| as this results in an inefficient proto layout. To

enforce this, AddDebugAnnotations should be called on TracedProto

&

&

, i.e.

std::move(message).AddDebugAnnotations().

This requires a 'repeated DebugAnnotations debug_annotations' field in

MessageType.

Defined at line 87 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

template <typename FieldMetadata>
TracedProto<typename FieldMetadata::cpp_field_type> WriteNestedMessage (FieldMetadata )

Start writing a single entry corresponding to the given |field| and return

TracedProto should be used to populate this further.

This method requires |field|'s type to be a nested message, but both

repeated and non-repeated complex fields are supported.

Defined at line 104 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

template <typename FieldMetadata, typename ValueType>
void Set (FieldMetadata , ValueType && value)

Write a given |value| into proto as a new |field| of the current message.

This method supports both nested messages and primitive types (i.e. int or

string), but requires the |field| to be non-repeateable (i.e. optional).

For repeatable fields, AppendValue or AppendFrom should be used.

Defined at line 124 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

template <typename FieldMetadata, typename ValueType>
void AppendValue (FieldMetadata , ValueType && value)

Write a given |value| a single entry into the repeated |field| of the

current message. If the field is not repeated, Set() should be used

instead.

Defined at line 150 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

template <typename FieldMetadata, typename ValueType>
void AppendFrom (FieldMetadata , ValueType && value)

Write a given |value| as a set of entries into the repeated |field| of the

current message. If the field is not repeated, Set() should be used

instead.

Defined at line 174 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

template <typename FieldMetadata>
TracedProto<typename FieldMetadata::cpp_field_type> WriteNestedMessage ()

Write a nested message into a field according to the provided metadata.

TODO(altimin): Replace the current usages in Chrome with the functions

above and make these methods private.

Defined at line 196 of file ../../third_party/perfetto/include/perfetto/tracing/traced_proto.h

Friends

template <typename T>
class TracedProto
template <typename MessageType>
class TracedValue
template <typename MessageType>
class EventContext