test/test_stackprof.rb in stackprof-0.2.5 vs test/test_stackprof.rb in stackprof-0.2.6

- old
+ new

@@ -59,10 +59,20 @@ assert_operator profile[:samples], :>, 1 frame = profile[:frames].values.first assert_equal "block in StackProfTest#math", frame[:name] end + def test_cputime_bmethod + profile = StackProf.run(mode: :cpu, interval: 500) do + bmath + end + + assert_operator profile[:samples], :>, 1 + frame = profile[:frames].values.first + assert_equal "block in StackProfTest#math", frame[:name] + end + def test_walltime profile = StackProf.run(mode: :wall) do idle end @@ -145,7 +155,13 @@ r, w = IO.pipe IO.select([r], nil, nil, 0.2) ensure r.close w.close + end + + define_method(:bmath) do + 250_000.times do + 2 ** 10 + end end end