xctrace gpu-counter-value: what do sample-index and timestamp mean?

I export GPU counters with xcrun xctrace export --xpath '/trace-toc/run[@number="1"]/data/table[@schema="gpu-counter-value"]' (Metal System Trace + Metal GPU Counters, compute workload) and need to confirm two columns.

On an M5 Max (macOS 27.0.1, Xcode 26.5, counter profile "Performance Limiters", 88 counters) the rows come in three groups with different periods: 74 counters every 20.2 µs, 6 texture counters every 30.9 µs, 8 bandwidth/MMU/LLC counters every 50.0 µs. Each group has its own sample-index sequence; the indices of the groups drift apart by thousands within seconds. On an M1 Pro (macOS 26.7.1, Xcode 26.4.1, 31 counters) every period appears twice, with ring-buffer-index 0 and 1, the second copy timestamped ~35 µs later.

  1. Is timestamp the sampling time of the row, and does value describe the interval since the previous sample of that counter or an instantaneous reading?
  2. Is sample-index a per-group sequence number, or a key meant to join all counters of one sampling period? How should counters from groups with different periods be combined for one time window?
  3. On M1 Pro, are ring-buffer-index 0 and 1 two readings of the same period (use one) or two independent samples?

Thanks in advance!

Best,
Lin

Hi, the sample indices represent the index of the samples for each unit that collects GPU counters.

Depending on the GPU generation (M1 – M5), the units may vary, so you may observe a variation of intervals based on the counter itself and the GPU generation.

Each unit could also have a different cadence of sample periods. The value and timestamp represent the sampled hardware counter value at a specific point in time, covering the period from the last sample to the current sample.