Sha256: 6f2bfd21cf560d150d00b79d87884935b560ed5227d843f4b5ba1c8d8502465b

Contents?: true

Size: 571 Bytes

Versions: 32

Compression:

Stored size: 571 Bytes

Contents

module RubyProf
  class Thread
    # Returns the total time this thread was executed.
    def total_time
      self.call_tree.total_time
    end

    # Returns the amount of time this thread waited while other thread executed.
    def wait_time
      # wait_time, like self:time, is always method local
      # thus we need to sum over all methods and call infos
      self.methods.inject(0) do |sum, method_info|
        method_info.callers.each do |call_tree|
          sum += call_tree.wait_time
        end
        sum
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
ruby-prof-1.4.2-x64-mingw32 lib/ruby-prof/thread.rb
ruby-prof-1.4.2 lib/ruby-prof/thread.rb
ruby-prof-1.4.1-x64-mingw32 lib/ruby-prof/thread.rb
ruby-prof-1.4.1 lib/ruby-prof/thread.rb
ruby-prof-1.4.0-x64-mingw32 lib/ruby-prof/thread.rb
ruby-prof-1.4.0 lib/ruby-prof/thread.rb
ruby-prof-1.3.2 lib/ruby-prof/thread.rb
ruby-prof-1.3.1-x64-mingw32 lib/ruby-prof/thread.rb
ruby-prof-1.3.1 lib/ruby-prof/thread.rb
ruby-prof-1.3.0-x64-mingw32 lib/ruby-prof/thread.rb
ruby-prof-1.3.0 lib/ruby-prof/thread.rb
ruby-prof-1.2.0 lib/ruby-prof/thread.rb