1# Sequence 1 defaults to track for "t1". 2packet { 3 trusted_packet_sequence_id: 1 4 timestamp: 0 5 incremental_state_cleared: true 6 track_descriptor { 7 uuid: 1 8 parent_uuid: 10 9 thread { 10 pid: 5 11 tid: 1 12 thread_name: "t1" 13 } 14 } 15 trace_packet_defaults { 16 track_event_defaults { 17 track_uuid: 1 18 } 19 } 20} 21# Sequence 2 defaults to track for "t2". 22packet { 23 trusted_packet_sequence_id: 2 24 timestamp: 0 25 incremental_state_cleared: true 26 track_descriptor { 27 uuid: 2 28 parent_uuid: 10 29 thread { 30 pid: 5 31 tid: 2 32 thread_name: "t2" 33 } 34 } 35 trace_packet_defaults { 36 track_event_defaults { 37 track_uuid: 2 38 } 39 } 40} 41# Both thread tracks are nested underneath this process track. 42packet { 43 trusted_packet_sequence_id: 1 44 timestamp: 0 45 track_descriptor { 46 uuid: 10 47 process { 48 pid: 5 49 process_name: "p1" 50 } 51 chrome_process { 52 host_app_package_name: "host_app" 53 } 54 } 55} 56# And we have an async track underneath the process too. 57packet { 58 trusted_packet_sequence_id: 1 59 timestamp: 0 60 track_descriptor { 61 uuid: 11 62 parent_uuid: 10 63 name: "async" 64 } 65} 66packet { 67 trusted_packet_sequence_id: 1 68 timestamp: 100 69 track_descriptor { 70 uuid: 12 71 parent_uuid: 10 72 name: "async2" 73 } 74} 75packet { 76 trusted_packet_sequence_id: 2 77 timestamp: 200 78 track_descriptor { 79 uuid: 12 80 parent_uuid: 10 81 name: "async2" 82 } 83} 84 85# Should appear on default track "t1". 86packet { 87 trusted_packet_sequence_id: 1 88 timestamp: 1000 89 track_event { 90 categories: "cat" 91 name: "event1_on_t1" 92 type: 3 93 } 94} 95# Should appear on default track "t2". 96packet { 97 trusted_packet_sequence_id: 2 98 timestamp: 2000 99 track_event { 100 categories: "cat" 101 name: "event1_on_t2" 102 type: 3 103 } 104} 105# Should appear on overridden track "t2". 106packet { 107 trusted_packet_sequence_id: 1 108 timestamp: 3000 109 track_event { 110 track_uuid: 2 111 categories: "cat" 112 name: "event2_on_t2" 113 type: 3 114 } 115} 116# Should appear on process track. 117packet { 118 trusted_packet_sequence_id: 1 119 timestamp: 4000 120 track_event { 121 track_uuid: 10 122 categories: "cat" 123 name: "event1_on_p1" 124 type: 3 125 } 126} 127# Should appear on async track. 128packet { 129 trusted_packet_sequence_id: 1 130 timestamp: 5000 131 track_event { 132 track_uuid: 11 133 categories: "cat" 134 name: "event1_on_async" 135 type: 3 136 } 137} 138# Event for the "async2" track starting on one thread and ending on another. 139packet { 140 trusted_packet_sequence_id: 1 141 timestamp: 5100 142 track_event { 143 track_uuid: 12 144 categories: "cat" 145 name: "event1_on_async2" 146 type: 1 147 } 148} 149packet { 150 trusted_packet_sequence_id: 2 151 timestamp: 5200 152 track_event { 153 track_uuid: 12 154 categories: "cat" 155 name: "event1_on_async2" 156 type: 2 157 } 158} 159 160# If we later see another track descriptor for tid 1, but with a different uuid, 161# we should detect tid reuse and start a new thread. 162packet { 163 trusted_packet_sequence_id: 3 164 timestamp: 10000 165 incremental_state_cleared: true 166 track_descriptor { 167 uuid: 3 168 parent_uuid: 10 169 thread { 170 pid: 5 171 tid: 1 172 thread_name: "t3" 173 } 174 } 175} 176# Should appear on t3. 177packet { 178 trusted_packet_sequence_id: 3 179 timestamp: 11000 180 track_event { 181 track_uuid: 3 182 categories: "cat" 183 name: "event1_on_t3" 184 type: 3 185 } 186} 187 188# If we later see another track descriptor for pid 5, but with a different uuid, 189# we should detect pid reuse and start a new process. 190packet { 191 trusted_packet_sequence_id: 4 192 timestamp: 20000 193 incremental_state_cleared: true 194 track_descriptor { 195 uuid: 20 196 process { 197 pid: 5 198 process_name: "p2" 199 } 200 } 201} 202# Should appear on p2. 203packet { 204 trusted_packet_sequence_id: 4 205 timestamp: 21000 206 track_event { 207 track_uuid: 20 208 categories: "cat" 209 name: "event1_on_p2" 210 type: 3 211 } 212} 213# Another thread t4 in the new process. 214packet { 215 trusted_packet_sequence_id: 4 216 timestamp: 22000 217 incremental_state_cleared: true 218 track_descriptor { 219 uuid: 21 220 parent_uuid: 20 221 thread { 222 pid: 5 223 tid: 4 224 thread_name: "t4" 225 } 226 } 227} 228# Should appear on t4. 229packet { 230 trusted_packet_sequence_id: 4 231 timestamp: 22000 232 track_event { 233 track_uuid: 21 234 categories: "cat" 235 name: "event1_on_t4" 236 type: 3 237 } 238} 239 240# Another packet for a thread track in the old process, badly sorted. 241packet { 242 trusted_packet_sequence_id: 2 243 timestamp: 6000 244 track_event { 245 track_uuid: 1 246 categories: "cat" 247 name: "event3_on_t1" 248 type: 3 249 } 250} 251 252# Override the track to the default descriptor track for an event with a 253# TrackEvent type. Should appear on the default descriptor track instead of 254# "t1". 255packet { 256 trusted_packet_sequence_id: 1 257 timestamp: 30000 258 track_event { 259 track_uuid: 0 260 categories: "cat" 261 name: "event1_on_t1" 262 type: 3 263 } 264} 265 266# But a legacy event without TrackEvent type falls back to legacy tracks (based 267# on ThreadDescriptor / async IDs / legacy instant scopes). This instant event 268# should appear on the process track "p2". 269packet { 270 trusted_packet_sequence_id: 1 271 timestamp: 31000 272 track_event { 273 track_uuid: 0 274 categories: "cat" 275 name: "event2_on_p2" 276 legacy_event { 277 phase: 73 # 'I' 278 instant_event_scope: 2 # Process scope 279 } 280 } 281} 282 283# And pid/tid overrides take effect even for TrackEvent type events. 284packet { 285 trusted_packet_sequence_id: 1 286 timestamp: 32000 287 track_event { 288 track_uuid: 0 289 categories: "cat" 290 name: "event2_on_t4" 291 type: 3 292 legacy_event { 293 pid_override: 5 294 tid_override: 4 295 } 296 } 297} 298 299# Track descriptor without name and process/thread association derives its 300# name from the first event on the track. 301packet { 302 trusted_packet_sequence_id: 1 303 timestamp: 40000 304 track_descriptor { 305 uuid: 13 306 parent_uuid: 10 307 } 308} 309 310packet { 311 trusted_packet_sequence_id: 1 312 timestamp: 40000 313 track_event { 314 track_uuid: 13 315 categories: "cat" 316 name: "event_and_track_async3" 317 type: 3 318 } 319} 320