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:
- Nice tabular output
- Displays not just cumulative totals for timers, but counts and averages
- Sorts in descending order of cumulative time, to easily identify bottlenecks
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | drush-timers-3.patch | 3.58 KB | mikeryan |
| #1 | drush-timers-2.patch | 1.59 KB | mikeryan |
| drush-timers.patch | 1.47 KB | mikeryan |
Comments
Comment #1
mikeryanOops, was printing even with no timers present...
Comment #2
moshe weitzman commented#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()
Comment #3
mikeryanNew 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.
Comment #4
moshe weitzman commentedCommitted. Thanks.