class ProfileTools::LogSubscriber
Logs the collector stats
Public Instance Methods
profile(event)
click to toggle source
# File lib/profile_tools/log_subscriber.rb, line 6 def profile(event) event.payload[:collector].called_methods.each do |info| duration = info[:duration].round(5) count_objects = display_count_objects(info[:count_objects]) logger.info "method #{info[:method]} took #{duration}ms, called #{info[:calls]}, objects: #{count_objects}" end end
Private Instance Methods
display_count_objects(count_objects)
click to toggle source
# File lib/profile_tools/log_subscriber.rb, line 16 def display_count_objects(count_objects) count_objects.reject! { |_, cnt| cnt.zero? } count_objects.delete(:FREE) count_objects.to_a.map { |k, v| "#{k}: #{v}" }.join(', ') end