Sha256: 45bf173081959b4b11dfff92fcb2d77a94ed982dc3b3eac7c28249a328a94924

Contents?: true

Size: 717 Bytes

Versions: 6

Compression:

Stored size: 717 Bytes

Contents

require 'rumx'

class MyBean
  include Rumx::Bean

  bean_attr_accessor :sleep1, :float, 'Amount of time sleep1 sleeps'
  bean_attr_accessor :sleep2, :float, 'Amount of time sleep2 sleeps'
  bean_attr_accessor :sleep3, :float, 'Amount of time sleep3 sleeps'

  def initialize
    @sleep1 = 1
    @sleep2 = 2
    @sleep3 = 3
    @timers = Rumx::Beans::TimerHash.new
    bean_add_child(:timers, @timers)
    100.times do
      Thread.new do
        while true
          @timers[:overall].measure do
            @timers[:sleep1].measure { sleep @sleep1 }
            @timers[:sleep2].measure { sleep @sleep2 }
            @timers[:sleep3].measure { sleep @sleep3 }
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rumx-0.1.5 examples/timer_hash/my_bean.rb
rumx-0.1.4 examples/timer_hash/my_bean.rb
rumx-0.1.3 examples/timer_hash/my_bean.rb
rumx-0.1.2 examples/timer_hash/my_bean.rb
rumx-0.1.1 examples/timer_hash/my_bean.rb
rumx-0.1.0 examples/timer_hash/my_bean.rb