Sha256: a5d03196a0268c45b1be1a9a813d7c69889e7f5404b216f0d18d8d9f8a5909ec

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'open3'
RUNS = 30
SCRIPT = "time #{__dir__}/ls"
Dir.chdir ARGV[0] do
  times = Array.new(RUNS).map do
    run_times = Open3.capture3(SCRIPT)[1]
    puts run_times.lstrip
    run_times.scan(/(?:\d+(?:.\d+)?)/)
  end

  puts format(
    "\e[1mAverage:\n\e[32m%0.2f real         %0.2f user         %0.2f sys\e[0m", # rubocop:disable Style/FormatStringToken
    *times.transpose.map { |n| (n.map(&:to_f).sum / RUNS) }
  )
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fast_ignore-0.10.1 bin/time