Sha256: 07c164c02378402e43224f0d4834efd46f5975af1ad05bf20c97759047d14691

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

require File.expand_path('../test_helper', __FILE__)

class MeasureGCTimeTest < TestCase
  include MemoryTestHelper

  def test_gc_time_mode
    RubyProf::measure_mode = RubyProf::GC_TIME
    assert_equal(RubyProf::GC_TIME, RubyProf::measure_mode)
  end

  def test_gc_time_enabled_defined
    assert(defined?(RubyProf::GC_TIME_ENABLED))
  end

  if RubyProf::GC_TIME_ENABLED
    def test_gc_time
      RubyProf::measure_mode = RubyProf::GC_TIME
      RubyProf.enable_gc_stats_if_needed

      t = RubyProf.measure_gc_time
      assert_kind_of Float, t

      GC.start

      u = RubyProf.measure_gc_time
      assert u > t, [t, u].inspect

      memory_test_helper
    ensure
      RubyProf.disable_gc_stats_if_needed
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/ruby-prof-0.18.0/test/measure_gc_time_test.rb
ruby-prof-0.18.0-x64-mingw32 test/measure_gc_time_test.rb
ruby-prof-0.18.0 test/measure_gc_time_test.rb