1# Sequence 1 defaults to track for "t1" and extra_counter_values for "c1". 2packet { 3 trusted_packet_sequence_id: 1 4 timestamp: 0 5 incremental_state_cleared: true 6 track_descriptor { 7 uuid: 1 8 parent_uuid: 3 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 extra_counter_track_uuids: 10 # Counter "c1", defined below. 19 } 20 } 21} 22 23# Process track for the thread. 24packet { 25 trusted_packet_sequence_id: 1 26 timestamp: 0 27 track_descriptor { 28 uuid: 3 29 process { 30 pid: 5 31 process_name: "Browser" 32 } 33 chrome_process {} 34 } 35} 36 37# Counter track "c1", a thread-scoped counter for "t1". 38packet { 39 trusted_packet_sequence_id: 1 40 timestamp: 0 41 track_descriptor { 42 uuid: 10 43 parent_uuid: 1 44 counter { 45 type: 1 # COUNTER_THREAD_TIME_NS. 46 unit_multiplier: 1000 # provided in ys. 47 is_incremental: true # use delta encoding. 48 } 49 } 50} 51 52# Sequence 2 has no defaults. Define a new global counter "MySizeCounter". 53packet { 54 trusted_packet_sequence_id: 2 55 timestamp: 0 56 incremental_state_cleared: true 57 track_descriptor { 58 uuid: 11 59 name: "MySizeCounter" 60 counter { 61 unit: 3 # UNIT_SIZE_BYTES. 62 } 63 } 64} 65 66# Should appear on default track "t1" with extra_counter_values for "c1". 67packet { 68 trusted_packet_sequence_id: 1 69 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 70 timestamp: 1000 71 track_event { 72 categories: "cat" 73 name: "event1_on_t1" 74 type: 1 # TYPE_SLICE_BEGIN. 75 extra_counter_values: 1000 # First value, so effectively absolute. 76 } 77} 78 79# End for event above. 80packet { 81 trusted_packet_sequence_id: 1 82 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 83 timestamp: 1100 84 track_event { 85 type: 2 # TYPE_SLICE_END. 86 extra_counter_values: 10 # Absolute: 1010. 87 } 88} 89 90# Resetting incremental state on sequence 1 will restart counter at 0. 91packet { 92 trusted_packet_sequence_id: 1 93 timestamp: 2000 94 incremental_state_cleared: true 95 track_descriptor { 96 uuid: 1 97 parent_uuid: 3 98 thread { 99 pid: 5 100 tid: 1 101 thread_name: "t1" 102 } 103 } 104 trace_packet_defaults { 105 track_event_defaults { 106 track_uuid: 1 107 extra_counter_track_uuids: 10 # Counter "c1", defined below. 108 } 109 } 110} 111 112# Reemit process track for the thread. 113packet { 114 trusted_packet_sequence_id: 1 115 timestamp: 2000 116 track_descriptor { 117 uuid: 3 118 process { 119 pid: 5 120 process_name: "Browser" 121 } 122 } 123} 124 125# Reemit counter descriptor, too. 126packet { 127 trusted_packet_sequence_id: 1 128 timestamp: 2000 129 track_descriptor { 130 uuid: 10 131 parent_uuid: 1 132 counter { 133 type: 1 # COUNTER_THREAD_TIME_NS. 134 unit_multiplier: 1000 # provided in us. 135 is_incremental: true # use delta encoding. 136 } 137 } 138} 139 140# Should appear on default track "t1" with extra_counter_values for "c1". 141packet { 142 trusted_packet_sequence_id: 1 143 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 144 timestamp: 2000 145 track_event { 146 categories: "cat" 147 name: "event2_on_t1" 148 type: 1 # TYPE_SLICE_BEGIN. 149 extra_counter_values: 2000 # First value after reset, so absolute. 150 } 151} 152 153# Nested value that happens to be emitted at the same timestamp but different 154# thread time value. 155packet { 156 trusted_packet_sequence_id: 1 157 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 158 timestamp: 2000 159 track_event { 160 categories: "cat" 161 name: "event3_on_t1" 162 type: 1 # TYPE_SLICE_BEGIN. 163 extra_counter_values: 10 # Absolute: 2010 164 } 165} 166 167# End for event above. 168packet { 169 trusted_packet_sequence_id: 1 170 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 171 timestamp: 2200 172 track_event { 173 type: 2 # TYPE_SLICE_END. 174 extra_counter_values: 10 # Absolute: 2020. 175 } 176} 177 178# End for event for "event2_on_t1". 179packet { 180 trusted_packet_sequence_id: 1 181 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 182 timestamp: 2200 183 track_event { 184 type: 2 # TYPE_SLICE_END. 185 extra_counter_values: 10 # Absolute: 2030. 186 } 187} 188 189# Counter type event for "MySizeCounter" on sequence 1. 190packet { 191 trusted_packet_sequence_id: 1 192 timestamp: 3000 193 track_event { 194 track_uuid: 11 # "MySizeCounter". 195 type: 4 # TYPE_COUNTER. 196 counter_value: 1024 # Absolute. 197 } 198} 199 200# Counter type event for "MySizeCounter" on sequence 2. 201packet { 202 trusted_packet_sequence_id: 2 203 timestamp: 3100 204 track_event { 205 track_uuid: 11 # "MySizeCounter". 206 type: 4 # TYPE_COUNTER. 207 counter_value: 2048 # Absolute. 208 } 209} 210 211# Override the default extra_counter_values. 212packet { 213 trusted_packet_sequence_id: 1 214 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 215 timestamp: 4000 216 track_event { 217 categories: "cat" 218 name: "event4_on_t1" 219 type: 3 # TYPE_INSTANT. 220 extra_counter_track_uuids: 10 # "c1". 221 extra_counter_track_uuids: 11 # "MySizeCounter". 222 extra_counter_values: 10 # Absolute: 2040. 223 extra_counter_values: 1024 # Absolute: 2040. 224 } 225} 226 227# Sequence 3 defaults to track for "t4" and uses legacy thread time and 228# instruction count. 229packet { 230 trusted_packet_sequence_id: 3 231 timestamp: 0 232 incremental_state_cleared: true 233 track_descriptor { 234 uuid: 4 235 parent_uuid: 3 236 thread { 237 pid: 5 238 tid: 4 239 thread_name: "t4" 240 } 241 } 242 trace_packet_defaults { 243 track_event_defaults { 244 track_uuid: 4 245 } 246 } 247} 248 249packet { 250 trusted_packet_sequence_id: 3 251 timestamp: 4000 252 track_event { 253 categories: "cat" 254 name: "event1_on_t3" 255 type: 1 # TYPE_SLICE_BEGIN. 256 thread_time_absolute_us: 10 257 thread_instruction_count_absolute: 20 258 } 259} 260 261packet { 262 trusted_packet_sequence_id: 3 263 timestamp: 4100 264 track_event { 265 categories: "cat" 266 name: "event1_on_t3" 267 type: 2 # TYPE_SLICE_END. 268 thread_time_absolute_us: 15 269 thread_instruction_count_absolute: 25 270 } 271} 272 273packet { 274 trusted_packet_sequence_id: 1 275 timestamp: 4200 276 incremental_state_cleared: true 277 track_descriptor { 278 uuid: 12 279 name: "MyDoubleCounter" 280 counter { 281 } 282 } 283} 284 285# Floating point counter value. 286packet { 287 trusted_packet_sequence_id: 1 288 timestamp: 4200 289 track_event { 290 track_uuid: 12 # "MyDoubleCounter". 291 type: 4 # TYPE_COUNTER. 292 double_counter_value: 3.1415926 # Floating point. 293 } 294} 295 296# Floating point extra counter value. 297packet { 298 trusted_packet_sequence_id: 1 299 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 300 timestamp: 4300 301 track_event { 302 categories: "cat" 303 name: "float_counter_on_t1" 304 type: 3 # TYPE_INSTANT. 305 extra_double_counter_track_uuids: 12 # "MyDoubleCounter". 306 extra_double_counter_values: 0.5 307 } 308} 309 310# Floating point extra counter value with sequence defaults (used together with 311# an integer counter). 312packet { 313 trusted_packet_sequence_id: 1 314 timestamp: 4400 315 trace_packet_defaults { 316 track_event_defaults { 317 track_uuid: 1 318 extra_counter_track_uuids: 11 # "MySizeCounter" 319 extra_double_counter_track_uuids: 12 # "MyDoubleCounter" 320 } 321 } 322} 323 324packet { 325 trusted_packet_sequence_id: 1 326 sequence_flags: 2 # SEQ_NEEDS_INCREMENTAL_STATE 327 timestamp: 4500 328 track_event { 329 categories: "cat" 330 name: "float_counter_on_t1" 331 type: 3 # TYPE_INSTANT. 332 extra_counter_values: 4096 333 extra_double_counter_values: 2.71828 334 } 335}