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