• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19import "protos/perfetto/trace/track_event/chrome_process_descriptor.proto";
20import "protos/perfetto/trace/track_event/chrome_thread_descriptor.proto";
21import "protos/perfetto/trace/track_event/process_descriptor.proto";
22import "protos/perfetto/trace/track_event/thread_descriptor.proto";
23import "protos/perfetto/trace/track_event/counter_descriptor.proto";
24
25package perfetto.protos;
26
27// Defines a track for TrackEvents. Slices and instant events on the same track
28// will be nested based on their timestamps, see TrackEvent::Type.
29//
30// A TrackDescriptor only needs to be emitted by one trace writer / producer and
31// is valid for the entirety of the trace. To ensure the descriptor isn't lost
32// when the ring buffer wraps, it should be reemitted whenever incremental state
33// is cleared.
34//
35// As a fallback, TrackEvents emitted without an explicit track association will
36// be associated with an implicit trace-global track (uuid = 0), see also
37// |TrackEvent::track_uuid|. It is possible but not necessary to emit a
38// TrackDescriptor for this implicit track.
39//
40// Next id: 9.
41message TrackDescriptor {
42  // Unique ID that identifies this track. This ID is global to the whole trace.
43  // Producers should ensure that it is unlikely to clash with IDs emitted by
44  // other producers. A value of 0 denotes the implicit trace-global track.
45  //
46  // For example, legacy TRACE_EVENT macros may use a hash involving the async
47  // event id + id_scope, pid, and/or tid to compute this ID.
48  optional uint64 uuid = 1;
49
50  // A parent track reference can be used to describe relationships between
51  // tracks. For example, to define an asynchronous track which is scoped to a
52  // specific process, specify the uuid for that process's process track here.
53  // Similarly, to associate a COUNTER_THREAD_TIME_NS counter track with a
54  // thread, specify the uuid for that thread's thread track here.
55  optional uint64 parent_uuid = 5;
56
57  // Name of the track. Optional - if unspecified, it may be derived from the
58  // process/thread name (process/thread tracks), the first event's name (async
59  // tracks), or counter name (counter tracks).
60  optional string name = 2;
61
62  // Associate the track with a process, making it the process-global track.
63  // There should only be one such track per process (usually for instant
64  // events; trace processor uses this fact to detect pid reuse). If you need
65  // more (e.g. for asynchronous events), create child tracks using parent_uuid.
66  //
67  // Trace processor will merge events on a process track with slice-type events
68  // from other sources (e.g. ftrace) for the same process into a single
69  // timeline view.
70  optional ProcessDescriptor process = 3;
71  optional ChromeProcessDescriptor chrome_process = 6;
72
73  // Associate the track with a thread, indicating that the track's events
74  // describe synchronous code execution on the thread. There should only be one
75  // such track per thread (trace processor uses this fact to detect tid reuse).
76  //
77  // Trace processor will merge events on a thread track with slice-type events
78  // from other sources (e.g. ftrace) for the same thread into a single timeline
79  // view.
80  optional ThreadDescriptor thread = 4;
81  optional ChromeThreadDescriptor chrome_thread = 7;
82
83  // Descriptor for a counter track. If set, the track will only support
84  // TYPE_COUNTER TrackEvents (and values provided via TrackEvent's
85  // |extra_counter_values|).
86  optional CounterDescriptor counter = 8;
87}
88