lib/active-profiling/gc_statistics.rb
# Profiles a block, capturing information on the garbage collector. The
# return value is an Array containing the result of the yielded block
# and a String with a report on the profiling results.
#
# Options:
#
# * +:disable_gc+ - disables garbage collection for the duration of the
#   block and then renables it immediately afterwards. This allows you to
#   control when GC is run and see the results.
# * +:title+ - a title to use for logging.
#
# More options for this method can be found in the default settings,
# located in ActiveProfiling::Railtie::DEFAULT_GC_STATISTICS_OPTIONS.
#
# This method only works with versions of Ruby that implement
# GC::Profiler or that have been patched to implement some additional
# garbage collection statistics. In older versions, such as version
# 1.8.7, you can either use Ruby Enterprise Edition or patch your build
# with the GC statistics patch found here:
#
# http://blog.pluron.com/2008/02/memory-profilin.html
Profiles a block, capturing information on the garbage collector. The
return value is an Array containing the result of the yielded block
and a String with a report on the profiling results.



+:disable_gc+ - disables garbage collection for the duration of the
block and then renables it immediately afterwards. This allows you to
control when GC is run and see the results.
+:title+ - a title to use for logging.

More options for this method can be found in the default settings,
located in ActiveProfiling::Railtie::DEFAULT_GC_STATISTICS_OPTIONS.

This method only works with versions of Ruby that implement
GC::Profiler or that have been patched to implement some additional
garbage collection statistics. In older versions, such as version
1.8.7, you can either use Ruby Enterprise Edition or patch your build
with the GC statistics patch found here.


Profiles a block capturing information on the garbage collector . The return value is an Array containing the result of the yielded block and a String with a report on the profiling results . + : disable_gc + - disables garbage collection for the duration of the block and then renables it immediately afterwards . This allows you to control when GC is run and see the results . + : title + - a title to use for logging . More options for this method can be found in the default settings located in ActiveProfiling :: Railtie :: DEFAULT_GC_STATISTICS_OPTIONS . This method only works with versions of Ruby that implement GC :: Profiler or that have been patched to implement some additional garbage collection statistics . In older versions such as version 1 . 8 . 7 you can either use Ruby Enterprise Edition or patch your build with the GC statistics patch found here .
def gc_statistics(*args)
      options = Rails.application.config.active_profiling.gc_statistics.merge(args.extract_options!)
      result, gc_report = gc_statistics_report(options) do
        yield
      end
      ActiveSupport::Notifications.instrument('gc_statistics.active_profiling', {
        :report => gc_report,
        :title => options[:title] || args.first
      })
      result
    end
def gc_statistics ( * args ) options = Rails . application . config . active_profiling . gc_statistics . merge ( args . extract_options! ) result , gc_report = gc_statistics_report ( options ) do yield end ActiveSupport :: Notifications . instrument ( 'gc_statistics.active_profiling' , { :report => gc_report , :title => options [ :title ] || args . first } ) result end
Profiles a block, capturing information on the garbage collector.
Profiles a block capturing information on the garbage collector .
args