Sha256: 6f015ea584d44a5366b8cf906dcc4e8facd23f155ac5d92c9100836d760794c8

Contents?: true

Size: 984 Bytes

Versions: 11

Compression:

Stored size: 984 Bytes

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

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

      def before(test, test_name)
        StackProf.start(:mode => :wall)
      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(nil, f)
        end
        @artifacts << output_dot_path
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
newrelic_rpm-3.10.0.279 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.9.275 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.8.273 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.7.266 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.6.257 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.5.251 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.4.245 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.3.241 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.2.239 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.1.236 test/performance/lib/performance/instrumentation/stackprof.rb
newrelic_rpm-3.9.0.229 test/performance/lib/performance/instrumentation/stackprof.rb