class Vernier::Output::Firefox::Thread

def samples_table

def samples_table
  samples = @samples
  weights = @weights
  categories = @sample_categories
  size = samples.size
  if categories.empty?
    categories = [0] * size
  end
  if @timestamps
    times = @timestamps.map { _1 / 1_000_000.0 }
  else
    # FIXME: record timestamps for memory samples
    times = (0...size).to_a
  end
  raise unless weights.size == size
  raise unless times.size == size
  samples = samples.zip(categories).map do |sample, category|
    if category == 0
      sample
    else
      @categorized_stacks[[sample, category]]
    end
  end
  {
    stack: samples,
    time: times,
    weight: weights,
    weightType: profile.meta[:mode] == :retained ? "bytes" : "samples",
    length: samples.length
  }
end