Module: Trashed

Defined in:
lib/trashed/rack.rb,
lib/trashed/meter.rb,
lib/trashed/railtie.rb,
lib/trashed/reporter.rb,
lib/trashed/resource_usage.rb,
lib/trashed/instruments/ree_gc.rb,
lib/trashed/instruments/ruby_gc.rb,
lib/trashed/instruments/stopwatch.rb,
lib/trashed/instruments/gctools_oobgc.rb,
lib/trashed/instruments/ruby_gc_profiler.rb,
lib/trashed/instruments/object_space_counter.rb

Defined Under Namespace

Modules: Instruments Classes: Meter, Rack, Railtie, Reporter

Constant Summary collapse

ResourceUsage =
Meter.new.tap do |meter|
  # Wall clock time in milliseconds since epoch.
  # Includes CPU and idle time on Ruby 2.1+.
  require 'trashed/instruments/stopwatch'
  meter.instrument Trashed::Instruments::Stopwatch.new

  # RailsBench GC patch / REE 1.8
  if GC.respond_to? :enable_stats
    require 'trashed/instruments/ree_gc'
    meter.instrument Trashed::Instruments::Ruby18GC.new
  end

  # Ruby 1.9+
  if ObjectSpace.respond_to? :count_objects
    require 'trashed/instruments/object_space_counter'
    meter.instrument Trashed::Instruments::ObjectSpaceCounter.new
  end

  # Ruby 1.9+
  if GC.respond_to?(:stat)
    require 'trashed/instruments/ruby_gc'
    meter.instrument Trashed::Instruments::RubyGC.new
  end

  # Ruby 1.9+
  if defined? GC::Profiler
    require 'trashed/instruments/ruby_gc_profiler'
    meter.instrument Trashed::Instruments::RubyGCProfiler.new
  end

  # Ruby 2.1+ with https://github.com/tmm1/gctools
  if defined? GC::OOB
    require 'trashed/instruments/gctools_oobgc'
    meter.instrument Trashed::Instruments::GctoolsOobgc.new
  end
end