class ParallelTests::Test::Runner

def with_runtime_info(tests, options = {})

def with_runtime_info(tests, options = {})
  log = options[:runtime_log] || runtime_log
  lines = File.read(log).split("\n") rescue []
  # use recorded test runtime if we got enough data
  if lines.size * 1.5 > tests.size
    puts "Using recorded test runtime: #{log}"
    times = Hash.new(1)
    lines.each do |line|
      test, time = line.split(":")
      next unless test and time
      times[File.expand_path(test)] = time.to_f
    end
    tests.sort.map{|test| [test, times[File.expand_path(test)]] }
  else # use file sizes
    with_filesize_info(tests)
  end
end