class EventContext

Defined at line 46 of file ../../third_party/perfetto/include/perfetto/tracing/event_context.h

Allows adding custom arguments into track events. Example:

TRACE_EVENT_BEGIN("category", "Title",

[](perfetto::EventContext ctx) {

auto* log = ctx.event()->set_log_message();

log->set_body_iid(1234);

ctx.AddDebugAnnotation("name", 1234);

});

Public Methods

void EventContext (EventContext && )

Defined at line 48 of file ../../third_party/perfetto/include/perfetto/tracing/event_context.h

void EventContext (protos::pbzero::TrackEvent * event, internal::TrackEventIncrementalState * incremental_state, bool )

Defined at line 50 of file ../../third_party/perfetto/include/perfetto/tracing/event_context.h

internal::TrackEventIncrementalState * GetIncrementalState ()

Defined at line 58 of file ../../third_party/perfetto/include/perfetto/tracing/event_context.h

bool ShouldFilterDebugAnnotations ()

Disclaimer: Experimental method, subject to change.

Exposed publicly to emit some TrackEvent fields in Chromium only in local

tracing. Long-term, we really shouldn't be (ab)using the

filter_debug_annotation setting for this.

TODO(kraskevich): Come up with a more precise name once we have more than

one usecase.

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

bool ShouldFilterDynamicEventNames ()

Disclaimer: Experimental method, subject to change. Exposed publicly to

emit some DynamicFilter fields in Chromium only in local tracing.

Defined at line 77 of file ../../third_party/perfetto/include/perfetto/tracing/event_context.h

template <typename EventType = protos::pbzero::TrackEvent>
EventType * event ()

Get a TrackEvent message to write typed arguments to.

event() is a template method to allow callers to specify a subclass of

TrackEvent instead. Those subclasses correspond to TrackEvent message with

application-specific extensions. More information in

design-docs/extensions.md.

Defined at line 90 of file ../../third_party/perfetto/include/perfetto/tracing/event_context.h

template <typename MessageType>
TracedProto<MessageType> Wrap (MessageType * message)

Convert a raw pointer to protozero message to TracedProto which captures

the reference to this EventContext.

Defined at line 102 of file ../../third_party/perfetto/include/perfetto/tracing/event_context.h

template <typename EventNameType, typename T>
void AddDebugAnnotation (EventNameType && name, T && value)

Add a new `debug_annotation` proto message and populate it from |value|

using perfetto::TracedValue API. Users should generally prefer passing

values directly to TRACE_EVENT (i.e. TRACE_EVENT(..., "arg", value, ...);)

but in rare cases (e.g. when an argument should be written conditionally)

EventContext::AddDebugAnnotation provides an explicit equivalent.

Defined at line 115 of file ../../third_party/perfetto/include/perfetto/tracing/event_context.h

void ~EventContext ()
TrackEventTlsStateUserData * GetTlsUserData (const void * key)

Read arbitrary user data that is associated with the thread-local per

instance state of the track event. `key` must be non-null and unique

per TrackEventTlsStateUserData subclass.

void SetTlsUserData (const void * key, std::unique_ptr<TrackEventTlsStateUserData> data)

Set arbitrary user data that is associated with the thread-local per

instance state of the track event. `key` must be non-null and unique

per TrackEventTlsStateUserData subclass.

Friends

class TracedProtoTest
class TrackEventInternal
template <typenamesize_ttypenametypename>
class TrackEventInternedDataIndex