Sha256: 8e25c3d49d65453f8d25094ac7fe6e22446ddbdb9d8d27169fb0534e7970091e

Contents?: true

Size: 665 Bytes

Versions: 22

Compression:

Stored size: 665 Bytes

Contents

require 'time'

module Minitest
  def self.plugin_performancereporter_init(options)
    self.reporter << PerformanceReporter.new(options[:io], options)
  end

  class PerformanceReporter < StatisticsReporter
    @@timings = []

    def self.start_timing(name)
      @@timings << [name,false,Time.now.to_f]
    end

    def self.end_timing
      @@timings.last[1] = true
      @@timings.last[2] = Time.now.to_f - @@timings.last[2]
    end

    def report
      super
      if @@timings.length > 0
        puts "\nPERFORMANCE:"
        @@timings.each do |tim|
          puts "  * #{tim[0]}: #{'%f' % tim[2]} seconds" if tim[1]
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
xml-smart-0.5.3 minitest/performancereporter_plugin.rb
xml-smart-0.5.2 minitest/performancereporter_plugin.rb
xml-smart-0.5.1 minitest/performancereporter_plugin.rb
xml-smart-0.5.0 minitest/performancereporter_plugin.rb
xml-smart-0.4.4 minitest/performancereporter_plugin.rb
xml-smart-0.4.3 minitest/performancereporter_plugin.rb
xml-smart-0.4.2 minitest/performancereporter_plugin.rb
xml-smart-0.4.1 minitest/performancereporter_plugin.rb
xml-smart-0.4.0 minitest/performancereporter_plugin.rb
xml-smart-0.3.22 minitest/performancereporter_plugin.rb
xml-smart-0.3.21 minitest/performancereporter_plugin.rb
xml-smart-0.3.20 minitest/performancereporter_plugin.rb
xml-smart-0.3.19 minitest/performancereporter_plugin.rb
xml-smart-0.3.18 minitest/performancereporter_plugin.rb
xml-smart-0.3.17 minitest/performancereporter_plugin.rb
xml-smart-0.3.16 minitest/performancereporter_plugin.rb
xml-smart-0.3.15 minitest/performancereporter_plugin.rb
xml-smart-0.3.14 minitest/performancereporter_plugin.rb
xml-smart-0.3.12 minitest/performancereporter_plugin.rb
xml-smart-0.3.11 minitest/performancereporter_plugin.rb