class Vernier::ParsedProfile

def self.read_file(filename)

def self.read_file(filename)
  # Print the inverted tree from a Vernier profile
  is_gzip = File.binread(filename, 2) == "\x1F\x8B".b # check for gzip header
  json = if is_gzip
    require "zlib"
    Zlib::GzipReader.open(filename) { |gz| gz.read }
  else
    File.read filename
  end
  info = JSON.load json
  new(info)
end

def initialize(data)

def initialize(data)
  @data = data
end

def main_thread

def main_thread
  threads.detect(&:main_thread?)
end

def threads

def threads
  @threads ||=
    @data["threads"].map do |thread_data|
      Thread.new(thread_data)
    end
end