Sha256: d87489d019242af316d5380a67173b30d3afcaaaf54b2e4c9406d6caffd1a621

Contents?: true

Size: 791 Bytes

Versions: 17

Compression:

Stored size: 791 Bytes

Contents

module PlainApm
  module Extensions
    module ThreadAllocations
      def start!
        super
        @thread_allocation_count_start = now_thread_allocations
      end

      def finish!
        super
        @thread_allocation_count_finish = now_thread_allocations
      end

      def thread_allocations
        @thread_allocation_count_finish - @thread_allocation_count_start
      end

      private

      if defined?(PlainApm::ObjectTracing)
        def now_thread_allocations
          PlainApm::ObjectTracing.total_thread_allocated_objects
        end
      else
        def now_thread_allocations
          0
        end
      end
    end

    if defined?(ActiveSupport)
      ActiveSupport::Notifications::Event.prepend(PlainApm::Extensions::ThreadAllocations)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
plain_apm-0.7.1 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.7.0 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.6.7 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.6.6 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.6.5 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.6.4 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.6.3 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.6.2 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.6.1 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.5.7 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.5.6 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.5.5 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.5.4 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.5.3 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.5.2 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.5.1 lib/plain_apm/extensions/thread_allocations.rb
plain_apm-0.5.0 lib/plain_apm/extensions/thread_allocations.rb