Skip Navigation

developer benchmarks in default template

May 5, 2010 at 3:10 pm
By nwhite

Developers now have the option of seeing live benchmarks for the init and run phase of any module. This can be very useful for optimizing pages and for debugging purposes.

As long as you have your IP address listed in error_handler_settings.php, you should see a link "enable benchmarks" at the bottom of any page. Any template that extends the default template should inherit this functionality.

To make these changes, these files have minor tweaks:

  • /reason_package/reason_4.0/lib/core/minisite/generate_page.php
  • /reason_package/reason_4.0/lib/core/minisite_templates/default.php

If you have overloaded either run_section or load_modules (neither should be overloaded in most cases) in a custom template, you may not get benchmarks, but it should be easy to add the necessary code ... just use the template methods:

  • should_benchmark()
  • benchmark_start($name_of_timer)
  • benchmark_stop($name_of_timer)

We might consider making a reference to the benchmark timer available to modules as well so they can also add benchmarks, but that is beyond the scope of this tweak, which aims simply to give developers a new useful tool for identifiying and optimizing slow modules.

Add a comment

Name:*
Comment:*
The following fields are not to be filled out. Skip to Submit Button.
Not Comment:
(This is here to trap robots. Don't put any text here.)
Not URL:
(This is here to trap robots. Don't put any text here.)
Avoid:
(This is here to trap robots. Don't put any text here.)
    

Posted In