#!/usr/bin/env ruby

# --------socket thread num=20--------
# 2020-11-10 19:51:31 /lkp/benchmarks/hackbench-git/hackbench/hackbench 20 thread 1000
# Running with 20*40 (== 800) tasks.
# Time: 0.495
# ...

time = []

while (line = gets)
  case line
  when /^-+(\w+ \w+ \w+)/
    args = $1.tr(' ', '_')
  when /^Running with .* \(== (\d+)\) tasks/
    tasks = $1.to_i
  when /^Time:/
    seconds = line.split[1]
    time << seconds.to_f
  end
end

exit if time.empty?

puts "#{args}_#{tasks}: #{time.sum / time.size}"
