class TraceContext
Defined at line 293 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
Argument passed to the lambda function passed to Trace() (below).
Public Methods
void TraceContext (TraceContext && )
Defined at line 298 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
void ~TraceContext ()
Defined at line 299 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
void AddEmptyTracePacket ()
Adds an empty trace packet to the trace to ensure that the service can
safely read the last event from the trace buffer.
See PERFETTO_INTERNAL_ADD_EMPTY_EVENT macros for context.
Defined at line 309 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
TracePacketHandle NewTracePacket ()
Defined at line 321 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
void Flush (std::function<void ()> cb)
Forces a commit of the thread-local tracing data written so far to the
service. This is almost never required (tracing data is periodically
committed as trace pages are filled up) and has a non-negligible
performance hit (requires an IPC + refresh of the current thread-local
chunk). The only case when this should be used is when handling OnStop()
asynchronously, to ensure sure that the data is committed before the
Stop timeout expires.
The TracePacketHandle obtained by the last NewTracePacket() call must be
finalized before calling Flush() (either implicitly by going out of scope
or by explicitly calling Finalize()).
|cb| is an optional callback. When non-null it will request the
service to ACK the flush and will be invoked on an internal thread after
the service has acknowledged it. The callback might be NEVER INVOKED if
the service crashes or the IPC connection is dropped.
Defined at line 339 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
uint64_t written ()
Returns the number of bytes written on the current thread by the current
data-source since its creation.
This can be useful for splitting protos that might grow very large.
Defined at line 346 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
LockedHandle<DerivedDataSource> GetDataSourceLocked ()
Returns a RAII handle to access the data source instance, guaranteeing
that it won't be deleted on another thread (because of trace stopping)
while accessing it from within the Trace() lambda.
The returned handle can be invalid (nullptr) if tracing is stopped
immediately before calling this. The caller is supposed to check for its
validity before using it. After checking, the handle is guaranteed to
remain valid until the handle goes out of scope.
Defined at line 355 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
typename DataSourceTraits::TlsStateType * GetCustomTlsState ()
Post-condition: returned ptr will be non-null.
Defined at line 367 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
typename DataSourceTraits::IncrementalStateType * GetIncrementalState ()
Defined at line 373 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
uint32_t instance_index ()
Defined at line 378 of file ../../third_party/perfetto/include/perfetto/tracing/data_source.h
Friends
template <const internal::TrackEventCategoryRegistry*>
class TrackEvent
class DataSource