1Timer(3) User Contributed Perl Documentation Timer(3)
2
3
4
6 Template::Timer - Rudimentary profiling for Template Toolkit
7
9 Version 1.00
10
12 Template::Timer provides inline timings of the template processing
13 througout your code. It's an overridden version of Template::Context
14 that wraps the "process()" and "include()" methods.
15
16 Using Template::Timer is simple.
17
18 use Template::Timer;
19
20 my %config = ( # Whatever your config is
21 INCLUDE_PATH => '/my/template/path',
22 COMPILE_EXT => '.ttc',
23 COMPILE_DIR => '/tmp/tt',
24 );
25
26 if ( $development_mode ) {
27 $config{ CONTEXT } = Template::Timer->new( %config );
28 }
29
30 my $template = Template->new( \%config );
31
32 Now when you process templates, HTML comments will get embedded in your
33 output, which you can easily grep for. The nesting level is also
34 shown.
35
36 <!-- TIMER START: L1 process mainmenu/mainmenu.ttml -->
37 <!-- TIMER START: L2 include mainmenu/cssindex.tt -->
38 <!-- TIMER START: L3 process mainmenu/cssindex.tt -->
39 <!-- TIMER END: L3 process mainmenu/cssindex.tt (17.279 ms) -->
40 <!-- TIMER END: L2 include mainmenu/cssindex.tt (17.401 ms) -->
41
42 ....
43
44 <!-- TIMER END: L3 process mainmenu/footer.tt (3.016 ms) -->
45 <!-- TIMER END: L2 include mainmenu/footer.tt (3.104 ms) -->
46 <!-- TIMER END: L1 process mainmenu/mainmenu.ttml (400.409 ms) -->
47
48 Note that since INCLUDE is a wrapper around PROCESS, calls to INCLUDEs
49 will be doubled up, and slightly longer than the PROCESS call.
50
52 Andy Lester, "<andy at petdance.com>"
53
55 Please report any bugs or feature requests to "bug-template-timer at
56 rt.cpan.org", or through the web interface at <http://rt.cpan.org>. I
57 will be notified, and then you'll automatically be notified of progress
58 on your bug as I make changes.
59
61 Thanks to Randal Schwartz, Bill Moseley, and to Gavin Estey for the
62 original code.
63
65 This library is free software; you can redistribute it and/or modify it
66 under the terms of either the GNU Public License v3, or the Artistic
67 License 2.0.
68
69 * http://www.gnu.org/copyleft/gpl.html
70
71 * http://www.opensource.org/licenses/artistic-license-2.0.php
72
73
74
75perl v5.36.0 2022-07-22 Timer(3)