Skip to content

Commit

Permalink
Merge pull request #17312 from bdunne/evm_log_processor
Browse files Browse the repository at this point in the history
Add a tool to process logs looking for frequency of method calls
  • Loading branch information
kbrock authored Apr 24, 2018
2 parents 381abb3 + 3a58f9b commit 4576d3f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tools/log_processing/method_call_processor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env ruby

RAILS_ROOT = File.expand_path(File.join(__dir__, %w(.. ..)))
require 'manageiq-gems-pending'
require 'miq_logger_processor'

logfile = ARGV.shift if ARGV[0] && File.file?(ARGV[0])
logfile ||= File.join(RAILS_ROOT, "log/evm.log")
logfile = File.expand_path(logfile)

puts "Gathering method calls..."

method_call_hash = MiqLoggerProcessor.new(logfile).each_with_object({}) do |line, hash|
next unless line.fq_method
hash[line.fq_method] ||= 0
hash[line.fq_method] += 1
end

require 'pp'

puts method_call_hash.sort_by { |_key, value| value }.reverse.to_h.pretty_inspect

0 comments on commit 4576d3f

Please sign in to comment.