drush_log_timers() reports 0 seconds for all timers except the page timer, because timer_read() only works for active timers. The attached patch fixes this, with the following enhancements:

  1. Nice tabular output
  2. Displays not just cumulative totals for timers, but counts and averages
  3. Sorts in descending order of cumulative time, to easily identify bottlenecks

Comments

mikeryan’s picture

StatusFileSize
new1.59 KB

Oops, was printing even with no timers present...

moshe weitzman’s picture

Status: Needs review » Needs work

#84008: timer_read() returns NULL (no value) after timer_stop() is rtbc for d6. it was already committed to 7. i think this patch should just assume that this gets fixed in 6. also, lets rename to drush_print_timers()

mikeryan’s picture

StatusFileSize
new3.58 KB

New patch changes name to drush_print_timers, and also hides behind a debug option (previously drush_log took care of that, but now it's using drush_print_table()).

I have to disagree on the D6 timer_read() fix. This patch will work both pre- and post-fix, and it'd be nice to be able to use it under D6 now.

Thanks.

moshe weitzman’s picture

Status: Needs work » Fixed

Committed. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.