Created
September 13, 2012 06:21
-
-
Save hvolkmer/3712301 to your computer and use it in GitHub Desktop.
A small script to find slow chef recipes
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
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