proto: Add Tracks for TrackEvents

Adds support for defining tracks (TrackDescriptor) and associating
a TrackEvent with a track.

Bug: 123864183
Change-Id: I777c8b85b1e0a302e2fdab4fca7f26b2bd26af6f
diff --git a/Android.bp b/Android.bp
index 648279a..bd64765 100644
--- a/Android.bp
+++ b/Android.bp
@@ -3445,6 +3445,7 @@
     "protos/perfetto/trace/track_event/source_location.proto",
     "protos/perfetto/trace/track_event/task_execution.proto",
     "protos/perfetto/trace/track_event/thread_descriptor.proto",
+    "protos/perfetto/trace/track_event/track_descriptor.proto",
     "protos/perfetto/trace/track_event/track_event.proto",
   ],
   tools: [
@@ -3458,6 +3459,7 @@
     "external/perfetto/protos/perfetto/trace/track_event/source_location.pb.cc",
     "external/perfetto/protos/perfetto/trace/track_event/task_execution.pb.cc",
     "external/perfetto/protos/perfetto/trace/track_event/thread_descriptor.pb.cc",
+    "external/perfetto/protos/perfetto/trace/track_event/track_descriptor.pb.cc",
     "external/perfetto/protos/perfetto/trace/track_event/track_event.pb.cc",
   ],
 }
@@ -3472,6 +3474,7 @@
     "protos/perfetto/trace/track_event/source_location.proto",
     "protos/perfetto/trace/track_event/task_execution.proto",
     "protos/perfetto/trace/track_event/thread_descriptor.proto",
+    "protos/perfetto/trace/track_event/track_descriptor.proto",
     "protos/perfetto/trace/track_event/track_event.proto",
   ],
   tools: [
@@ -3485,6 +3488,7 @@
     "external/perfetto/protos/perfetto/trace/track_event/source_location.pb.h",
     "external/perfetto/protos/perfetto/trace/track_event/task_execution.pb.h",
     "external/perfetto/protos/perfetto/trace/track_event/thread_descriptor.pb.h",
+    "external/perfetto/protos/perfetto/trace/track_event/track_descriptor.pb.h",
     "external/perfetto/protos/perfetto/trace/track_event/track_event.pb.h",
   ],
   export_include_dirs: [
@@ -3503,6 +3507,7 @@
     "protos/perfetto/trace/track_event/source_location.proto",
     "protos/perfetto/trace/track_event/task_execution.proto",
     "protos/perfetto/trace/track_event/thread_descriptor.proto",
+    "protos/perfetto/trace/track_event/track_descriptor.proto",
     "protos/perfetto/trace/track_event/track_event.proto",
   ],
   tools: [
@@ -3517,6 +3522,7 @@
     "external/perfetto/protos/perfetto/trace/track_event/source_location.pbzero.cc",
     "external/perfetto/protos/perfetto/trace/track_event/task_execution.pbzero.cc",
     "external/perfetto/protos/perfetto/trace/track_event/thread_descriptor.pbzero.cc",
+    "external/perfetto/protos/perfetto/trace/track_event/track_descriptor.pbzero.cc",
     "external/perfetto/protos/perfetto/trace/track_event/track_event.pbzero.cc",
   ],
 }
@@ -3531,6 +3537,7 @@
     "protos/perfetto/trace/track_event/source_location.proto",
     "protos/perfetto/trace/track_event/task_execution.proto",
     "protos/perfetto/trace/track_event/thread_descriptor.proto",
+    "protos/perfetto/trace/track_event/track_descriptor.proto",
     "protos/perfetto/trace/track_event/track_event.proto",
   ],
   tools: [
@@ -3545,6 +3552,7 @@
     "external/perfetto/protos/perfetto/trace/track_event/source_location.pbzero.h",
     "external/perfetto/protos/perfetto/trace/track_event/task_execution.pbzero.h",
     "external/perfetto/protos/perfetto/trace/track_event/thread_descriptor.pbzero.h",
+    "external/perfetto/protos/perfetto/trace/track_event/track_descriptor.pbzero.h",
     "external/perfetto/protos/perfetto/trace/track_event/track_event.pbzero.h",
   ],
   export_include_dirs: [
diff --git a/protos/BUILD b/protos/BUILD
index 80ac23a..f1d46cc 100644
--- a/protos/BUILD
+++ b/protos/BUILD
@@ -1802,6 +1802,7 @@
         "perfetto/trace/track_event/source_location.proto",
         "perfetto/trace/track_event/task_execution.proto",
         "perfetto/trace/track_event/thread_descriptor.proto",
+        "perfetto/trace/track_event/track_descriptor.proto",
         "perfetto/trace/track_event/track_event.proto",
     ],
     has_services = 1,
@@ -1844,6 +1845,7 @@
         "perfetto/trace/track_event/source_location.proto",
         "perfetto/trace/track_event/task_execution.proto",
         "perfetto/trace/track_event/thread_descriptor.proto",
+        "perfetto/trace/track_event/track_descriptor.proto",
         "perfetto/trace/track_event/track_event.proto",
     ],
 )
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index bb543da..218faed 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -3394,7 +3394,7 @@
 // TracePacket(s).
 //
 // Next reserved id: 13 (up to 15).
-// Next id: 60.
+// Next id: 61.
 message TracePacket {
   // The timestamp of the TracePacket.
   // By default this timestamps refers to the trace clock (CLOCK_BOOTTIME on
@@ -3447,7 +3447,12 @@
     ProfiledFrameSymbols profiled_frame_symbols = 55;
 
     // Only used by TrackEvent.
+    TrackDescriptor track_descriptor = 60;
+
+    // Deprecated, use TrackDescriptor instead.
     ProcessDescriptor process_descriptor = 43;
+
+    // Deprecated, use TrackDescriptor instead.
     ThreadDescriptor thread_descriptor = 44;
 
     // This field is emitted at periodic intervals (~10s) and
@@ -3556,13 +3561,12 @@
 // with matching IDs. When provided, these fields define the default values
 // that should be applied, at import time, to all TracePacket(s) with the same
 // |trusted_packet_sequence_id|, unless otherwise specified in each packet.
+//
+// Should be reemitted whenever incremental state is cleared on the sequence.
 message TracePacketDefaults {
   optional uint32 timestamp_clock_id = 58;
 
-  // TODO(eseckler): Add default values for TrackEvents (e.g. default track).
-  message TrackEventDefaults {
-    // optional int32 tid = ...;
-  }
+  // Default values for TrackEvents (e.g. default track).
   optional TrackEventDefaults track_event = 11;
 }
 // End of protos/perfetto/trace/trace_packet_defaults.proto
@@ -3753,11 +3757,44 @@
 
 // End of protos/perfetto/trace/track_event/thread_descriptor.proto
 
+// Begin of protos/perfetto/trace/track_event/track_descriptor.proto
+
+// Defines a track for TrackEvents. Slices and instant events on the same track
+// will be nested based on their timestamps, see TrackEvent::Type.
+//
+// A packet sequence needs to emit a TrackDescriptor for every track on which
+// it emits TrackEvents. TrackDescriptors should be reemitted whenever
+// incremental state is cleared.
+//
+// Next id: 1.
+message TrackDescriptor {
+  // Unique ID that identifies this track. This ID is global to the whole trace.
+  // Producers should ensure that it is unlikely to clash with IDs emitted by
+  // other producers.
+  //
+  // For example, legacy TRACE_EVENT macros may use a hash involving the async
+  // event id + id_scope, pid, and/or tid to compute this ID.
+  optional uint64 uuid = 1;
+
+  // TODO(eseckler): Support track hierarchies.
+  // uint64 parent_uuid = X;
+
+  // Name of the track.
+  optional string name = 2;
+
+  // Optional arguments for specific types of tracks.
+  optional ProcessDescriptor process = 3;
+  optional ThreadDescriptor thread = 4;
+}
+
+// End of protos/perfetto/trace/track_event/track_descriptor.proto
+
 // Begin of protos/perfetto/trace/track_event/track_event.proto
 
 // Trace events emitted by client instrumentation library (TRACE_EVENT macros),
-// which describe activity on a track, such as a thread, task sequence, or
-// asynchronous track.
+// which describe activity on a track, such as a thread or asynchronous event
+// track. The track is specified using separate TrackDescriptor messages and
+// referred to via the track's UUID.
 //
 // This message is optimized for writing and makes heavy use of data interning
 // and delta encoding (e.g. of timestamps) to reduce data repetition and encoded
@@ -3767,12 +3804,11 @@
 // emitted by the same producer + writer) and refers to data in preceding
 // TracePackets emitted on the same sequence, both directly and indirectly. For
 // example, interned data entries are emitted as part of a TracePacket and
-// directly referred to from TrackEvents by their interning IDs. Attributes
-// shared by all events on the same sequence (e.g. their thread and process
-// association) are emitted as part of ProcessDescriptor and ThreadDescriptor
-// messages in separate TracePackets instead.
+// directly referred to from TrackEvents by their interning IDs. Default values
+// for attributes of events on the same sequence (e.g. their default track
+// association) can be emitted as part of a TrackEventDefaults message.
 //
-// Next reserved id: 11 (up to 15).
+// Next reserved id: 12 (up to 15).
 // Next id: 24.
 message TrackEvent {
   // Timestamp in microseconds (usually CLOCK_MONOTONIC).
@@ -3864,6 +3900,13 @@
   }
   optional Type type = 9;
 
+  // Identifies the track of the event. The default value may be overridden
+  // using TrackEventDefaults, e.g., to specify the track of the TraceWriter's
+  // sequence (in most cases sequence = one thread). If no value is specified
+  // here or in TrackEventDefaults, the TrackEvent will be associated with an
+  // implicit trace-global track. See TrackDescriptor::uuid.
+  optional uint64 track_uuid = 11;
+
   // Unstable key/value annotations shown in the trace viewer but not intended
   // for metrics use.
   repeated DebugAnnotation debug_annotations = 4;
@@ -3938,6 +3981,16 @@
   optional LegacyEvent legacy_event = 6;
 }
 
+// Default values for fields of all TrackEvents on the same packet sequence.
+// Should be emitted as part of TracePacketDefaults whenever incremental state
+// is cleared. It's defined here because field IDs should match those of the
+// corresponding fields in TrackEvent.
+message TrackEventDefaults {
+  optional uint64 track_uuid = 10;
+
+  // TODO(eseckler): Support default values for more TrackEvent fields.
+}
+
 // --------------------
 // Interned data types:
 // --------------------
diff --git a/protos/perfetto/trace/trace_packet.proto b/protos/perfetto/trace/trace_packet.proto
index eaa3a11..c050a5c 100644
--- a/protos/perfetto/trace/trace_packet.proto
+++ b/protos/perfetto/trace/trace_packet.proto
@@ -45,6 +45,7 @@
 import "protos/perfetto/trace/trace_packet_defaults.proto";
 import "protos/perfetto/trace/track_event/process_descriptor.proto";
 import "protos/perfetto/trace/track_event/thread_descriptor.proto";
+import "protos/perfetto/trace/track_event/track_descriptor.proto";
 import "protos/perfetto/trace/track_event/track_event.proto";
 import "protos/perfetto/trace/trigger.proto";
 import "protos/perfetto/trace/test_event.proto";
@@ -55,7 +56,7 @@
 // TracePacket(s).
 //
 // Next reserved id: 13 (up to 15).
-// Next id: 60.
+// Next id: 61.
 message TracePacket {
   // The timestamp of the TracePacket.
   // By default this timestamps refers to the trace clock (CLOCK_BOOTTIME on
@@ -108,7 +109,12 @@
     ProfiledFrameSymbols profiled_frame_symbols = 55;
 
     // Only used by TrackEvent.
+    TrackDescriptor track_descriptor = 60;
+
+    // Deprecated, use TrackDescriptor instead.
     ProcessDescriptor process_descriptor = 43;
+
+    // Deprecated, use TrackDescriptor instead.
     ThreadDescriptor thread_descriptor = 44;
 
     // This field is emitted at periodic intervals (~10s) and
diff --git a/protos/perfetto/trace/trace_packet_defaults.proto b/protos/perfetto/trace/trace_packet_defaults.proto
index 8b973de..6b6e571 100644
--- a/protos/perfetto/trace/trace_packet_defaults.proto
+++ b/protos/perfetto/trace/trace_packet_defaults.proto
@@ -17,6 +17,8 @@
 syntax = "proto2";
 option optimize_for = LITE_RUNTIME;
 
+import "protos/perfetto/trace/track_event/track_event.proto";
+
 package perfetto.protos;
 
 // Default values for TracePacket fields that hold for a particular TraceWriter
@@ -24,12 +26,11 @@
 // with matching IDs. When provided, these fields define the default values
 // that should be applied, at import time, to all TracePacket(s) with the same
 // |trusted_packet_sequence_id|, unless otherwise specified in each packet.
+//
+// Should be reemitted whenever incremental state is cleared on the sequence.
 message TracePacketDefaults {
   optional uint32 timestamp_clock_id = 58;
 
-  // TODO(eseckler): Add default values for TrackEvents (e.g. default track).
-  message TrackEventDefaults {
-    // optional int32 tid = ...;
-  }
+  // Default values for TrackEvents (e.g. default track).
   optional TrackEventDefaults track_event = 11;
 }
\ No newline at end of file
diff --git a/protos/perfetto/trace/track_event/BUILD.gn b/protos/perfetto/trace/track_event/BUILD.gn
index ad1002d..929d51c 100644
--- a/protos/perfetto/trace/track_event/BUILD.gn
+++ b/protos/perfetto/trace/track_event/BUILD.gn
@@ -22,6 +22,7 @@
     "source_location.proto",
     "task_execution.proto",
     "thread_descriptor.proto",
+    "track_descriptor.proto",
     "track_event.proto",
   ]
 }
diff --git a/protos/perfetto/trace/track_event/track_descriptor.proto b/protos/perfetto/trace/track_event/track_descriptor.proto
new file mode 100644
index 0000000..15c55ec
--- /dev/null
+++ b/protos/perfetto/trace/track_event/track_descriptor.proto
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+option optimize_for = LITE_RUNTIME;
+
+import "protos/perfetto/trace/track_event/process_descriptor.proto";
+import "protos/perfetto/trace/track_event/thread_descriptor.proto";
+
+package perfetto.protos;
+
+// Defines a track for TrackEvents. Slices and instant events on the same track
+// will be nested based on their timestamps, see TrackEvent::Type.
+//
+// A packet sequence needs to emit a TrackDescriptor for every track on which
+// it emits TrackEvents. TrackDescriptors should be reemitted whenever
+// incremental state is cleared.
+//
+// Next id: 1.
+message TrackDescriptor {
+  // Unique ID that identifies this track. This ID is global to the whole trace.
+  // Producers should ensure that it is unlikely to clash with IDs emitted by
+  // other producers.
+  //
+  // For example, legacy TRACE_EVENT macros may use a hash involving the async
+  // event id + id_scope, pid, and/or tid to compute this ID.
+  optional uint64 uuid = 1;
+
+  // TODO(eseckler): Support track hierarchies.
+  // uint64 parent_uuid = X;
+
+  // Name of the track.
+  optional string name = 2;
+
+  // Optional arguments for specific types of tracks.
+  optional ProcessDescriptor process = 3;
+  optional ThreadDescriptor thread = 4;
+}
diff --git a/protos/perfetto/trace/track_event/track_event.proto b/protos/perfetto/trace/track_event/track_event.proto
index 7a55c18..5e25db4 100644
--- a/protos/perfetto/trace/track_event/track_event.proto
+++ b/protos/perfetto/trace/track_event/track_event.proto
@@ -24,8 +24,9 @@
 package perfetto.protos;
 
 // Trace events emitted by client instrumentation library (TRACE_EVENT macros),
-// which describe activity on a track, such as a thread, task sequence, or
-// asynchronous track.
+// which describe activity on a track, such as a thread or asynchronous event
+// track. The track is specified using separate TrackDescriptor messages and
+// referred to via the track's UUID.
 //
 // This message is optimized for writing and makes heavy use of data interning
 // and delta encoding (e.g. of timestamps) to reduce data repetition and encoded
@@ -35,12 +36,11 @@
 // emitted by the same producer + writer) and refers to data in preceding
 // TracePackets emitted on the same sequence, both directly and indirectly. For
 // example, interned data entries are emitted as part of a TracePacket and
-// directly referred to from TrackEvents by their interning IDs. Attributes
-// shared by all events on the same sequence (e.g. their thread and process
-// association) are emitted as part of ProcessDescriptor and ThreadDescriptor
-// messages in separate TracePackets instead.
+// directly referred to from TrackEvents by their interning IDs. Default values
+// for attributes of events on the same sequence (e.g. their default track
+// association) can be emitted as part of a TrackEventDefaults message.
 //
-// Next reserved id: 11 (up to 15).
+// Next reserved id: 12 (up to 15).
 // Next id: 24.
 message TrackEvent {
   // Timestamp in microseconds (usually CLOCK_MONOTONIC).
@@ -132,6 +132,13 @@
   }
   optional Type type = 9;
 
+  // Identifies the track of the event. The default value may be overridden
+  // using TrackEventDefaults, e.g., to specify the track of the TraceWriter's
+  // sequence (in most cases sequence = one thread). If no value is specified
+  // here or in TrackEventDefaults, the TrackEvent will be associated with an
+  // implicit trace-global track. See TrackDescriptor::uuid.
+  optional uint64 track_uuid = 11;
+
   // Unstable key/value annotations shown in the trace viewer but not intended
   // for metrics use.
   repeated DebugAnnotation debug_annotations = 4;
@@ -206,6 +213,16 @@
   optional LegacyEvent legacy_event = 6;
 }
 
+// Default values for fields of all TrackEvents on the same packet sequence.
+// Should be emitted as part of TracePacketDefaults whenever incremental state
+// is cleared. It's defined here because field IDs should match those of the
+// corresponding fields in TrackEvent.
+message TrackEventDefaults {
+  optional uint64 track_uuid = 10;
+
+  // TODO(eseckler): Support default values for more TrackEvent fields.
+}
+
 // --------------------
 // Interned data types:
 // --------------------
diff --git a/src/perfetto_cmd/perfetto_config.descriptor.h b/src/perfetto_cmd/perfetto_config.descriptor.h
index 719ff33..52cd893 100644
--- a/src/perfetto_cmd/perfetto_config.descriptor.h
+++ b/src/perfetto_cmd/perfetto_config.descriptor.h
@@ -12,15 +12,15 @@
 // SHA1(tools/gen_binary_descriptors)
 // 8958deee3293aa8e5cc4fd677a868f14f1178f73
 // SHA1(protos/perfetto/config/perfetto_config.proto)
-// 23f855f8b8b1834607b54b2d65ee13124d902552
+// 69fca0725c782c63655b8922c1b3ca4646ae03bb
 
 // This is the proto PerfettoConfig encoded as a ProtoFileDescriptor to allow
 // for reflection without libprotobuf full/non-lite protos.
 
 namespace perfetto {
 
-constexpr std::array<uint8_t, 15652> kPerfettoConfigDescriptor{
-    {0x0a, 0xa1, 0x7a, 0x0a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f,
+constexpr std::array<uint8_t, 15904> kPerfettoConfigDescriptor{
+    {0x0a, 0x9d, 0x7c, 0x0a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f,
      0x70, 0x65, 0x72, 0x66, 0x65, 0x74, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e,
      0x66, 0x69, 0x67, 0x2f, 0x70, 0x65, 0x72, 0x66, 0x65, 0x74, 0x74, 0x6f,
      0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74,
@@ -59,7 +59,7 @@
      0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
      0x6f, 0x72, 0x42, 0x02, 0x28, 0x01, 0x52, 0x14, 0x74, 0x72, 0x61, 0x63,
      0x6b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
-     0x70, 0x74, 0x6f, 0x72, 0x22, 0xf1, 0x07, 0x0a, 0x14, 0x47, 0x70, 0x75,
+     0x70, 0x74, 0x6f, 0x72, 0x22, 0xed, 0x09, 0x0a, 0x14, 0x47, 0x70, 0x75,
      0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x44, 0x65, 0x73, 0x63, 0x72,
      0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x4a, 0x0a, 0x05, 0x73, 0x70, 0x65,
      0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x70,
@@ -67,40 +67,61 @@
      0x6f, 0x73, 0x2e, 0x47, 0x70, 0x75, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65,
      0x72, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e,
      0x47, 0x70, 0x75, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x70,
-     0x65, 0x63, 0x52, 0x05, 0x73, 0x70, 0x65, 0x63, 0x73, 0x1a, 0x8b, 0x03,
-     0x0a, 0x0e, 0x47, 0x70, 0x75, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72,
-     0x53, 0x70, 0x65, 0x63, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x75, 0x6e,
-     0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
-     0x52, 0x09, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12,
-     0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
-     0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64,
-     0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
-     0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
-     0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x6e, 0x74,
-     0x5f, 0x70, 0x65, 0x61, 0x6b, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
-     0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0c, 0x69, 0x6e, 0x74,
-     0x50, 0x65, 0x61, 0x6b, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a,
-     0x11, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x70, 0x65, 0x61, 0x6b,
-     0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01,
-     0x48, 0x00, 0x52, 0x0f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x50, 0x65,
-     0x61, 0x6b, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x5a, 0x0a, 0x0f, 0x6e,
-     0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x75, 0x6e, 0x69,
-     0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x70,
-     0x65, 0x72, 0x66, 0x65, 0x74, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74,
-     0x6f, 0x73, 0x2e, 0x47, 0x70, 0x75, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65,
-     0x72, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e,
-     0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x52,
-     0x0e, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x6e,
-     0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x11, 0x64, 0x65, 0x6e, 0x6f, 0x6d,
-     0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73,
-     0x18, 0x08, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x70, 0x65, 0x72,
-     0x66, 0x65, 0x74, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73,
-     0x2e, 0x47, 0x70, 0x75, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x44,
-     0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x4d, 0x65,
-     0x61, 0x73, 0x75, 0x72, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x10, 0x64,
-     0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x6e,
-     0x69, 0x74, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x70, 0x65, 0x61, 0x6b, 0x5f,
-     0x76, 0x61, 0x6c, 0x75, 0x65, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22,
+     0x65, 0x63, 0x52, 0x05, 0x73, 0x70, 0x65, 0x63, 0x73, 0x12, 0x4d, 0x0a,
+     0x06, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
+     0x0b, 0x32, 0x35, 0x2e, 0x70, 0x65, 0x72, 0x66, 0x65, 0x74, 0x74, 0x6f,
+     0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x70, 0x75, 0x43,
+     0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
+     0x70, 0x74, 0x6f, 0x72, 0x2e, 0x47, 0x70, 0x75, 0x43, 0x6f, 0x75, 0x6e,
+     0x74, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x06, 0x62, 0x6c,
+     0x6f, 0x63, 0x6b, 0x73, 0x1a, 0x8b, 0x03, 0x0a, 0x0e, 0x47, 0x70, 0x75,
+     0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x12,
+     0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x5f, 0x69,
+     0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x6f, 0x75,
+     0x6e, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+     0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
+     0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+     0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+     0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+     0x12, 0x26, 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x5f, 0x70, 0x65, 0x61, 0x6b,
+     0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
+     0x48, 0x00, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x50, 0x65, 0x61, 0x6b, 0x56,
+     0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x64, 0x6f, 0x75, 0x62,
+     0x6c, 0x65, 0x5f, 0x70, 0x65, 0x61, 0x6b, 0x5f, 0x76, 0x61, 0x6c, 0x75,
+     0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0f, 0x64,
+     0x6f, 0x75, 0x62, 0x6c, 0x65, 0x50, 0x65, 0x61, 0x6b, 0x56, 0x61, 0x6c,
+     0x75, 0x65, 0x12, 0x5a, 0x0a, 0x0f, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61,
+     0x74, 0x6f, 0x72, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x07, 0x20,
+     0x03, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x70, 0x65, 0x72, 0x66, 0x65, 0x74,
+     0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x70,
+     0x75, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x44, 0x65, 0x73, 0x63,
+     0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x4d, 0x65, 0x61, 0x73, 0x75,
+     0x72, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x0e, 0x6e, 0x75, 0x6d, 0x65,
+     0x72, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x5e,
+     0x0a, 0x11, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f,
+     0x72, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28,
+     0x0e, 0x32, 0x31, 0x2e, 0x70, 0x65, 0x72, 0x66, 0x65, 0x74, 0x74, 0x6f,
+     0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x47, 0x70, 0x75, 0x43,
+     0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
+     0x70, 0x74, 0x6f, 0x72, 0x2e, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65,
+     0x55, 0x6e, 0x69, 0x74, 0x52, 0x10, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x69,
+     0x6e, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x42, 0x0c,
+     0x0a, 0x0a, 0x70, 0x65, 0x61, 0x6b, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
+     0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x1a, 0xaa, 0x01, 0x0a, 0x0f, 0x47,
+     0x70, 0x75, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x42, 0x6c, 0x6f,
+     0x63, 0x6b, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f,
+     0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x62, 0x6c,
+     0x6f, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x62, 0x6c, 0x6f,
+     0x63, 0x6b, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18,
+     0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
+     0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04,
+     0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+     0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63,
+     0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28,
+     0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
+     0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65,
+     0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0d, 0x52,
+     0x0a, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22,
      0xfe, 0x03, 0x0a, 0x0b, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x55,
      0x6e, 0x69, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10,
      0x00, 0x12, 0x07, 0x0a, 0x03, 0x42, 0x49, 0x54, 0x10, 0x01, 0x12, 0x0b,
diff --git a/tools/gen_merged_protos b/tools/gen_merged_protos
index 310038b..c6fa0de 100755
--- a/tools/gen_merged_protos
+++ b/tools/gen_merged_protos
@@ -98,6 +98,7 @@
   'protos/perfetto/trace/track_event/source_location.proto',
   'protos/perfetto/trace/track_event/task_execution.proto',
   'protos/perfetto/trace/track_event/thread_descriptor.proto',
+  'protos/perfetto/trace/track_event/track_descriptor.proto',
   'protos/perfetto/trace/track_event/track_event.proto',
   'protos/perfetto/trace/trigger.proto',
   'protos/perfetto/trace/gpu/gpu_counter_event.proto',