MTTimer 1.0
April 14, 2003
- updated February 8, 2006
(Download)
The MTTimer tags allow you to display the time it took for MovableType to build your page, or portions of your page. If your page builds take a long time, the MTTimer tags may help you detect which parts of your page take the longest time to build. They are also useful to fine tune performance when developing plugins.
Modules Used:
Time::HiRes
- MTTimerStart
Starts a new timer or restarts and existing timer. The default timer is automatically started when the CGI that is building the page begins executing.
- name=”timer1”
Specifies the name of the timer. The default value is “”, meaning the default timer.
- MTTimerValue
Displays the time elapsed since the specified timer was started.
Example:
Place the following tag at the bottom of your search template (MovableType/search_templates/default.tmpl) to show how long it took to perform the search:
<MTTimerValue format="Search time: %.2f seconds.">
Example:
The following code uses two timers (“entries” and “entry”) which will display individual and cumulative times for building a list of entries followed by status information about how much time was spent building the page inside the MTEntries tags:
<MTTimerStart name="entries">
<MTEntries>
<MTTimerStart name="entry">
...
<MTTimerValue name="entry">, <MTTimerValue name="entries">
</MTEntries>
<pre><MTTimerValue name="entries" clock="stats"></pre>