Skip to content

Instantly share code, notes, and snippets.

@apeckham
Created July 10, 2010 23:33
Show Gist options
  • Save apeckham/471134 to your computer and use it in GitHub Desktop.
Save apeckham/471134 to your computer and use it in GitHub Desktop.
TIMINGS = Hash.new(0)
module Capistrano::Configuration::Execution
def execute_task_with_timing(task)
start = Time.now
execute_task_without_timing(task)
ensure
TIMINGS[task.fully_qualified_name] += Time.now - start
end
alias execute_task_without_timing execute_task
alias execute_task execute_task_with_timing
end
task :timings do
TIMINGS.sort { |a, b| b.last <=> a.last }.each do |task_name, time|
puts "%8.2f %s" % [time, task_name]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment