Sha256: 8fe59f025207caaa0bf9cf189b6168f31e0451aaae0084563d9777880e6d77c4

Contents?: true

Size: 722 Bytes

Versions: 6

Compression:

Stored size: 722 Bytes

Contents

if RUBY_VERSION >= "2.1.0"

  require 'stackprof'
  require 'test_helper'
  require 'flamegraph/stackprof_sampler'

  class TestStackprofSampler < Minitest::Test

    def idle(duration)
      r, w = IO.pipe
      IO.select([r], nil, nil, duration)
    ensure
      r.close
      w.close
    end

    def test_sample_collection

      samples = Flamegraph::StackProfSampler.collect do
        idle 0.005
      end

      assert(samples.count > 3, "Should get more than 3 samples in 5 millisecs")
    end

    def test_fidelity
      samples = Flamegraph::StackProfSampler.collect(10) do
        idle 0.005
      end

      assert(samples.count <= 1, "Should get a max of 1 sample got #{samples.count}")
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flamegraph-0.9.5 test/test_stackprof_sampler.rb
flamegraph-0.1.0 test/test_stackprof_sampler.rb
flamegraph-0.0.9 test/test_stackprof_sampler.rb
flamegraph-0.0.8 test/test_stackprof_sampler.rb
flamegraph-0.0.7 test/test_stackprof_sampler.rb
flamegraph-0.0.6 test/test_stackprof_sampler.rb