Created
June 29, 2018 21:41
-
-
Save ndemianc/b963f4a095f4bf2aea27eed56cf45842 to your computer and use it in GitHub Desktop.
How to use Ruby Prof to profile Sidekiq Worker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to use Ruby Prof to profile Sidekiq Worker | |
require 'ruby-prof' | |
result = RubyProf.profile do | |
#Code to analyse in a method | |
EsIndexWorker.new.perform | |
end | |
# Print a graph profile to text | |
printer = RubyProf::GraphHtmlPrinter.new(result) | |
File.open(File.join(Rails.root || __dir__, 'profile_output.html'), 'w') do |file| | |
printer.print(file, {:min_percent => 10, :print_file => true}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment