Sha256: 501f9570713bccf0f846fd318b1b72130ec81ade709c03f6a2c8faee4c1b0170

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

module Performance
  module Instrumentation
    class StackProfProfile < Instrumentor
      platforms :mri_21, :mri_22, :mri_23

      def self.setup
        require 'tmpdir'
        require 'stackprof'
      end

      def mode
        :wall
      end

      def before(test, test_name)
        StackProf.start(:mode => mode)
      end

      def after(test, test_name)
        StackProf.stop

        output_dump_path = artifact_path(test, test_name, "dump")
        StackProf.results(output_dump_path)
        @artifacts << output_dump_path

        results = Marshal.load(File.read(output_dump_path))
        output_dot_path = artifact_path(test, test_name, "dot")
        report = StackProf::Report.new(results)
        File.open(output_dot_path, "w") do |f|
          report.print_graphviz({}, f)
        end
        @artifacts << output_dot_path
      end
    end

    class StackProfAllocationProfile < StackProfProfile
      def mode
        :object
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
newrelic_rpm-3.18.1.330 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.18.0.329 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.17.2.327 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.17.1.326 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.17.0.325 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.16.3.323 test/performance/lib/performance/instrumentation/stackprof.rb