Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A small script to find slow chef recipes
require 'time'
# A small script to find slow chef recipes
#
# Usage: chef-client -l debug | ruby chef-debug-timer.rb
#
#
lines = ARGF.read.split("\n").select {|x| x =~ /DEBUG: Loading Recipe/ }
current = nil
last = nil
lines.each do |x|
line = x.split("]")
date = line.first[1..-1]
msg = line.last
current = Time.parse(date).to_i
last ||= current
puts "#{date} #{current-last.to_i}s #{msg}"
last = current
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.