@@ -16144,6 +16144,7 @@ message TrackDescriptor {
16144
16144
16145
16145
// If true, forces Trace Processor to use separate tracks for track events
16146
16146
// and system events for the same thread.
16147
+ //
16147
16148
// Track events timestamps in Chrome have microsecond resolution, while
16148
16149
// system events use nanoseconds. It results in broken event nesting when
16149
16150
// track events and system events share a track.
@@ -16180,9 +16181,128 @@ message TrackDescriptor {
16180
16181
// tracks with higher ranks. An unspecified rank will be treated as a rank of
16181
16182
// 0.
16182
16183
//
16184
+ // Note: this option is only relevant for tracks where the parent has
16185
+ // `child_ordering` set to `EXPLICIT`. It is ignored otherwise.
16186
+ //
16183
16187
// Note: for tracks where the parent has `thread` or `process` are set, this
16184
- // option is *ignored*. See `parent_uuid` for details.
16188
+ // option is *ignored* (even if the parent's `child_ordering` is `EXPLICIT``).
16189
+ // See `parent_uuid` for details.
16185
16190
optional int32 sibling_order_rank = 12;
16191
+
16192
+ // Specifies how the UI (and potentially in the future, the trace processor)
16193
+ // should "merge" different sibling TrackEvent tracks into a single "analysis"
16194
+ // track. This is useful for reducing the vertical space used in the UI when
16195
+ // there are many tracks all showing the same "type" of events (e.g. network
16196
+ // requests, Android broadcasts, Linux wakelocks).
16197
+ //
16198
+ // When tracks are merged togther, the properties for the merged track will be
16199
+ // chosen from the source tracks based on the following rules:
16200
+ // - for `sibling_order_rank`: the rank of the merged track will be the
16201
+ // smallest rank among the source tracks.
16202
+ // - for all other properties: the property taken is unspecified and can
16203
+ // be any value provided by one of the source tracks
16204
+ // - examples of other properties include `name`, `child_ordering` etc.
16205
+ // - because of this, it's recommended to ensure that all source tracks
16206
+ // have the same value for these properties.
16207
+ // - the trace processor will also emit an error stat if it detects
16208
+ // that the properties are not the same across all source tracks.
16209
+ //
16210
+ // Note: merging is done *recursively* so entire trees of tracks can be merged
16211
+ // together. To make this clearer, consider an example track hierarchy (in
16212
+ // the diagrams: "smk" refers to "sibling_merge_key", the first word on a
16213
+ // track line, like "Updater", is its 'name' property):
16214
+ //
16215
+ // Initial track hierarchy:
16216
+ // SystemActivity
16217
+ // ├── AuthService (smk: "auth_main_cluster")
16218
+ // │ └── LoginOp (smk: "login_v1")
16219
+ // ├── AuthService (smk: "auth_main_cluster")
16220
+ // │ └── LoginOp (smk: "login_v1")
16221
+ // ├── AuthService (smk: "auth_backup_cluster")
16222
+ // │ └── GuestOp (smk: "guest_v1")
16223
+ // └── UserProfileService (smk: "profile_cluster")
16224
+ // └── GetProfileOp (smk: "getprofile_v1")
16225
+ //
16226
+ // Merging outcomes:
16227
+ //
16228
+ // Scenario 1: Merging by `SIBLING_MERGE_BEHAVIOR_BY_SIBLING_MERGE_KEY`
16229
+ // - The first two "AuthService" tracks merge because they share
16230
+ // `smk: "auth_main_cluster"`. Their names are consistent ("AuthService"),
16231
+ // aligning with recommendations. The merged track is named "AuthService".
16232
+ // - The third "AuthService" track (with `smk: "auth_backup_cluster"`)
16233
+ // remains separate, as its `sibling_merge_key` is different.
16234
+ // - "UserProfileService" also remains separate.
16235
+ // - Within the merged "AuthService" (from "auth_main_cluster"):
16236
+ // "LoginOp" get merged as they have the same sibling merge key.
16237
+ //
16238
+ // Resulting UI (when merging by SIBLING_MERGE_KEY):
16239
+ // SystemActivity
16240
+ // ├── AuthService (merged by smk: "auth_main_cluster")
16241
+ // │ ├── LoginOp (merged by smk: "login_v1")
16242
+ // ├── AuthService (smk: "auth_backup_cluster")
16243
+ // │ └── GuestOp (smk: "guest_v1")
16244
+ // └── UserProfileService (smk: "profile_cluster")
16245
+ // └── GetProfileOp (smk: "getprofile_v1")
16246
+ //
16247
+ // Scenario 2: Merging by `SIBLING_MERGE_BEHAVIOR_BY_TRACK_NAME`
16248
+ // - All three tracks named "AuthService" merge because they share the same
16249
+ // name. The merged track is named "AuthService". The `sibling_merge_key`
16250
+ // for this merged track would be taken from one of the source tracks
16251
+ // (e.g., "auth_main_cluster" or "auth_backup_cluster"), which could be
16252
+ // relevant if its children had key-based merge behaviors.
16253
+ // - "UserProfileService" remains separate due to its different name.
16254
+ // - Within the single merged "AuthService" track:
16255
+ // "LoginOp", "GuestOp" become siblings. "LoginOp" tracks gets merged as
16256
+ // they have the same name.
16257
+ //
16258
+ // Resulting UI (when merging by SIBLING_MERGE_BEHAVIOR_BY_TRACK_NAME):
16259
+ // SystemActivity
16260
+ // ├── AuthService (merged from 3 "AuthService" tracks)
16261
+ // │ ├── LoginOp (smk: "login_v1")
16262
+ // │ └── GuestOp (smk: "guest_v1")
16263
+ // └── UserProfileService (smk: "profile_cluster")
16264
+ // └── GetProfileOp (smk: "getprofile_v1")
16265
+ //
16266
+ // Note: for tracks where `thread` or `process` are set, this option is
16267
+ // *ignored*. See `parent_uuid` for details.
16268
+ //
16269
+ // Note: this flag only affects the UI for now but we expect this also to be
16270
+ // respected by the trace processor in the future to allow for consistency
16271
+ // between you see and what you query.
16272
+ enum SiblingMergeBehavior {
16273
+ // When unspecified or not set, defaults to `SIBLING_MERGE_BEHAVIOR_LEGACY`.
16274
+ SIBLING_MERGE_BEHAVIOR_UNSPECIFIED = 0;
16275
+
16276
+ // The "legacy" behaviour for merging which predates the introduction of
16277
+ // this field. Any siblings tracks with the same `name` will be merged
16278
+ // together *except* when those tracks have a child *themselves*.
16279
+ //
16280
+ // A bit of history on why this exists: this behaviour was inherited from
16281
+ // chrome://tracing (Catapult) and exists mainly to not break existing
16282
+ // traces. In general, if possible don't use this and prefer to instead
16283
+ // explicitly set the `sibling_merge_behavior` to one of the other
16284
+ // options.
16285
+ SIBLING_MERGE_BEHAVIOR_LEGACY = 1;
16286
+
16287
+ // Never merge this track with any siblings. Useful if if this track has a
16288
+ // specific meaning and you want to see separately from any others.
16289
+ SIBLING_MERGE_BEHAVIOR_NONE = 2;
16290
+
16291
+ // Merge this track with eligible siblings which have the same `name`.
16292
+ SIBLING_MERGE_BEHAVIOR_BY_TRACK_NAME = 3;
16293
+
16294
+ // Merge this track with eligible siblings which have the same
16295
+ // `sibling_merge_key`.
16296
+ SIBLING_MERGE_BEHAVIOR_BY_SIBLING_MERGE_KEY = 4;
16297
+ }
16298
+ optional SiblingMergeBehavior sibling_merge_behavior = 14;
16299
+
16300
+ // An opaque value which allows specifying which tracks should be merged
16301
+ // together.
16302
+ //
16303
+ // Only meaningful when `sibling_merge_behavior` is set to
16304
+ // `SIBLING_MERGE_BEHAVIOR_BY_SIBLING_MERGE_KEY`.
16305
+ optional string sibling_merge_key = 15;
16186
16306
}
16187
16307
16188
16308
// End of protos/perfetto/trace/track_event/track_descriptor.proto
0 commit comments