Sha256: df36a4dffe910ab1cc9ddf304c55aa0ec1d992cede87521df92d07dbea668d94
Contents?: true
Size: 900 Bytes
Versions: 2
Compression:
Stored size: 900 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_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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
newrelic_rpm-4.1.0.333 | test/performance/lib/performance/instrumentation/perf_tools.rb |
newrelic_rpm-4.0.0.332 | test/performance/lib/performance/instrumentation/perf_tools.rb |