Sha256: 48b5e778648bec1fffeaa220fbc53eaffbe270f1d2f344fd6bf70872751fa5c0

Contents?: true

Size: 909 Bytes

Versions: 30

Compression:

Stored size: 909 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 PerfToolsProfile < Instrumentor
      platforms :mri_19, :mri_20, :mri_21

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

      def before(test, test_name)
        @profile_dir = Dir.mktmpdir('profile')
        @profile_path = File.join(@profile_dir, "profile")
        PerfTools::CpuProfiler.start(@profile_path)
      end

      def after(test, test_name)
        PerfTools::CpuProfiler.stop
        output_profile_path = artifact_path(test, test_name, "dot")
        system("pprof.rb --dot #{@profile_path} >#{output_profile_path}")
        @artifacts << output_profile_path
        FileUtils.remove_entry_secure(@profile_dir)
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
newrelic_rpm-3.18.1.330 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.18.0.329 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.17.2.327 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.17.1.326 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.17.0.325 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.16.3.323 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.16.2.321 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.16.1.320 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.16.0.318 test/performance/lib/performance/instrumentation/perf_tools.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.15.2.317 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.15.1.316 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.15.0.314 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.14.3.313 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.14.2.312 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.14.1.311 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.14.0.305 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.13.2.302 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.13.1.300 test/performance/lib/performance/instrumentation/perf_tools.rb
newrelic_rpm-3.13.0.299 test/performance/lib/performance/instrumentation/perf_tools.rb