Sha256: 4453536b762c9fd4958260b302815a55cd263a2eac7c94c30b09260c451549bc

Contents?: true

Size: 843 Bytes

Versions: 78

Compression:

Stored size: 843 Bytes

Contents

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

if ARGV.include?('-h') || ARGV.include?('--help')
  puts 'Usage: same as main `cookstyle` command but gathers profiling info'
  puts 'Additional option: `--memory` to print memory usage'
  exit(0)
end
with_mem = ARGV.delete('--memory')

require 'stackprof'
if with_mem
  require 'memory_profiler'
  MemoryProfiler.start
end
StackProf.start
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
begin
  load "#{__dir__}/cookstyle"
ensure
  delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
  puts "Finished in #{delta.round(1)} seconds"
  StackProf.stop
  if with_mem
    puts 'Building memory report...'
    report = MemoryProfiler.stop
  end
  Dir.mkdir('tmp') unless File.exist?('tmp')
  StackProf.results('tmp/stackprof.dump')
  report&.pretty_print(scale_bytes: true)
end

Version data entries

78 entries across 78 versions & 2 rubygems

Version Path
cookstyle-7.32.8 bin/cookstyle-profile
cookstyle-7.32.7 bin/cookstyle-profile
cookstyle-ng-8.0.0 bin/cookstyle-profile
cookstyle-7.32.2 bin/cookstyle-profile
cookstyle-7.32.1 bin/cookstyle-profile
cookstyle-7.32.0 bin/cookstyle-profile
cookstyle-7.31.9 bin/cookstyle-profile
cookstyle-7.31.7 bin/cookstyle-profile
cookstyle-7.31.3 bin/cookstyle-profile
cookstyle-7.31.1 bin/cookstyle-profile
cookstyle-7.31.0 bin/cookstyle-profile
cookstyle-7.30.4 bin/cookstyle-profile
cookstyle-7.30.3 bin/cookstyle-profile
cookstyle-7.30.1 bin/cookstyle-profile
cookstyle-7.28.2 bin/cookstyle-profile
cookstyle-7.27.0 bin/cookstyle-profile
cookstyle-7.26.1 bin/cookstyle-profile
cookstyle-7.25.10 bin/cookstyle-profile
cookstyle-7.25.9 bin/cookstyle-profile
cookstyle-7.25.8 bin/cookstyle-profile