File Coverage

blib/lib/WE_Frontend/Plugin/Benchmark.pm
Criterion Covered Total %
statement 12 19 63.1
branch n/a
condition 0 2 0.0
subroutine 4 6 66.6
pod 1 2 50.0
total 17 29 58.6


line stmt bran cond sub pod time code
1             # -*- perl -*-
2              
3             #
4             # $Id: Benchmark.pm,v 1.7 2004/10/27 13:25:30 eserte Exp $
5             # Author: Slaven Rezic
6             #
7             # Copyright (C) 2002 Slaven Rezic. All rights reserved.
8             # This package is free software; you can redistribute it and/or
9             # modify it under the same terms as Perl itself.
10             #
11             # Mail: slaven@rezic.de
12             # WWW: http://www.rezic.de/eserte/
13             #
14              
15             package WE_Frontend::Plugin::Benchmark;
16 1     1   12121 use base qw(Template::Plugin);
  1         5  
  1         135  
17              
18 1     1   7 use strict;
  1         3  
  1         38  
19 1     1   6 use vars qw($VERSION);
  1         2  
  1         142  
20             $VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/);
21              
22 1     1   6 use Time::HiRes qw(gettimeofday tv_interval);
  1         2  
  1         15  
23              
24             sub new {
25 0     0 1   my ($class, $context, @params) = @_;
26 0           bless {
27             _CONTEXT => $context,
28             _START => [gettimeofday],
29             }, $class;
30             }
31              
32             sub stop {
33 0     0 0   my $self = shift;
34 0   0       my $arg = shift || "";
35 0           $arg .= " " . tv_interval($self->{_START}, [gettimeofday]) . "s";
36 0           warn "$arg\n";
37 0           "";
38             }
39              
40             1;
41              
42             __END__