Created
June 29, 2018 21:41
Star
You must be signed in to star a gist
How to use Ruby Prof to profile Sidekiq Worker
This file contains 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