1Timer(3) User Contributed Perl Documentation Timer(3)
2
3
4
6 Template::Timer - Rudimentary profiling for Template Toolkit
7
9 Version 0.04
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 my %config = ( # Whatever your config is
19 INCLUDE_PATH => "/my/template/path",
20 COMPILE_EXT => ".ttc",
21 COMPILE_DIR => "/tmp/tt",
22 );
23
24 if ( $development_mode ) {
25 $config{ CONTEXT } = Template::Timer->new( %config );
26 }
27
28 my $template = Template->new( \%config );
29
30 Now when you process templates, HTML comments will get embedded in your
31 output, which you can easily grep for.
32
33 <!-- TIMER START: process mainmenu/mainmenu.ttml -->
34 <!-- TIMER START: include mainmenu/cssindex.tt -->
35 <!-- TIMER START: process mainmenu/cssindex.tt -->
36 <!-- TIMER END: process mainmenu/cssindex.tt (0.017279 seconds) -->
37 <!-- TIMER END: include mainmenu/cssindex.tt (0.017401 seconds) -->
38
39 ....
40
41 <!-- TIMER END: process mainmenu/footer.tt (0.003016 seconds) -->
42 <!-- TIMER END: include mainmenu/footer.tt (0.003104 seconds) -->
43 <!-- TIMER END: process mainmenu/mainmenu.ttml (0.400409 seconds) -->
44
45 Note that since INCLUDE is a wrapper around PROCESS, calls to INCLUDEs
46 will be doubled up, and slightly longer than the PROCESS call.
47
49 Andy Lester, "<andy at petdance.com>"
50
52 Please report any bugs or feature requests to "bug-template-timer at
53 rt.cpan.org", or through the web interface at <http://rt.cpan.org>. I
54 will be notified, and then you'll automatically be notified of progress
55 on your bug as I make changes.
56
58 Thanks to Randal Schwartz, Bill Moseley, and to Gavin Estey for the
59 original code.
60
62 Copyright 2005 Andy Lester, All Rights Reserved.
63
64 This program is free software; you can redistribute it and/or modify it
65 under the same terms as Perl itself.
66
67
68
69perl v5.8.8 2005-10-16 Timer(3)