Skip to content

Instantly share code, notes, and snippets.

@hvolkmer
Created September 13, 2012 06:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hvolkmer/3712301 to your computer and use it in GitHub Desktop.
Save hvolkmer/3712301 to your computer and use it in GitHub Desktop.
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