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.7.1-x64-mingw-ucrt lib/ruby-prof/thread.rb
ruby-prof-1.7.1 lib/ruby-prof/thread.rb
ruby-prof-1.7.0-x64-mingw-ucrt lib/ruby-prof/thread.rb
ruby-prof-1.7.0 lib/ruby-prof/thread.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/ruby-prof-1.6.3/lib/ruby-prof/thread.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/ruby-prof-1.6.3/lib/ruby-prof/thread.rb
ruby-prof-1.6.3-x64-mingw-ucrt lib/ruby-prof/thread.rb
ruby-prof-1.6.3 lib/ruby-prof/thread.rb
ruby-prof-1.6.2-x64-mingw-ucrt lib/ruby-prof/thread.rb
ruby-prof-1.6.2 lib/ruby-prof/thread.rb
ruby-prof-1.6.1 lib/ruby-prof/thread.rb
ruby-prof-1.6.1-x64-mingw-ucrt lib/ruby-prof/thread.rb
ruby-prof-1.5.0-x64-mingw-ucrt lib/ruby-prof/thread.rb
ruby-prof-1.5.0 lib/ruby-prof/thread.rb
ruby-prof-1.4.5-x64-mingw-ucrt lib/ruby-prof/thread.rb
ruby-prof-1.4.5 lib/ruby-prof/thread.rb
ruby-prof-1.4.4-x64-mingw-ucrt lib/ruby-prof/thread.rb
ruby-prof-1.4.4 lib/ruby-prof/thread.rb
ruby-prof-1.4.3-x64-mingw32 lib/ruby-prof/thread.rb
ruby-prof-1.4.3 lib/ruby-prof/thread.rb