struct Track

Defined at line 89 of file ../../third_party/perfetto/include/perfetto/tracing/track.h

Events which aren't strictly scoped to a thread or a process, or don't

correspond to synchronous code execution on a thread can use a custom

track (Track, ThreadTrack or ProcessTrack). A Track object can also

optionally be parented to a thread or a process.

A track is represented by a uuid, which must be unique across the entire

recorded trace.

For example, to record an event that begins and ends on different threads,

use a matching id to tie the begin and end events together:

TRACE_EVENT_BEGIN("category", "AsyncEvent", perfetto::Track(8086));

...

TRACE_EVENT_END("category", perfetto::Track(8086));

Tracks can also be annotated with metadata:

auto desc = track.Serialize();

desc.set_name("MyTrack");

perfetto::TrackEvent::SetTrackDescriptor(track, desc);

Threads and processes can also be named in a similar way, e.g.:

auto desc = perfetto::ProcessTrack::Current().Serialize();

desc.mutable_process()->set_process_name("MyProcess");

perfetto::TrackEvent::SetTrackDescriptor(

perfetto::ProcessTrack::Current(), desc);

The metadata remains valid between tracing sessions. To free up data for a

track, call EraseTrackDescriptor:

perfetto::TrackEvent::EraseTrackDescriptor(track);

Public Members

const uint64_t uuid
const uint64_t parent_uuid

Public Methods

void Serialize (protos::pbzero::TrackDescriptor * )
protos::gen::TrackDescriptor Serialize ()
void Track ()

Defined at line 92 of file ../../third_party/perfetto/include/perfetto/tracing/track.h

void Track (uint64_t id, Track parent)

Construct a track with identifier |id|, optionally parented under |parent|.

If no parent is specified, the track's parent is the current process's

track.

To minimize the chances for accidental id collisions across processes, the

track's effective uuid is generated by xorring |id| with a random,

per-process cookie.

Defined at line 101 of file ../../third_party/perfetto/include/perfetto/tracing/track.h

bool operator bool ()

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

Track Global (uint64_t id)

Construct a global track with identifier |id|.

Beware: the globally unique |id| should be chosen carefully to avoid

accidental clashes with track identifiers emitted by other producers.

Defined at line 112 of file ../../third_party/perfetto/include/perfetto/tracing/track.h

Track FromPointer (const void * ptr, Track parent)

Construct a track using |ptr| as identifier.

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

Track ThreadScoped (const void * ptr, Track parent)

Construct a track using |ptr| as identifier within thread-scope.

Shorthand for `Track::FromPointer(ptr, ThreadTrack::Current())`

Usage: TRACE_EVENT_BEGIN("...", "...", perfetto::Track::ThreadScoped(this))

Protected Methods

void Track (uint64_t uuid_, uint64_t parent_uuid_)

Defined at line 132 of file ../../third_party/perfetto/include/perfetto/tracing/track.h

Track MakeThreadTrack (base::PlatformThreadId tid)

Defined at line 135 of file ../../third_party/perfetto/include/perfetto/tracing/track.h

Track MakeProcessTrack ()

Defined at line 142 of file ../../third_party/perfetto/include/perfetto/tracing/track.h

uint64_t CompileTimeHash (const char * string)

Defined at line 144 of file ../../third_party/perfetto/include/perfetto/tracing/track.h

Friends

template <class T>
class FlowImpl
class TrackRegistry