Created
July 10, 2010 23:33
-
-
Save apeckham/471134 to your computer and use it in GitHub Desktop.
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
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