File Coverage

blib/lib/Timer/Runtime.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Timer::Runtime;
2 1     1   193949 use strict;
  1         3  
  1         54  
3              
4              
5 1     1   1097 use Time::Elapse;
  1         21278  
  1         57  
6              
7             Time::Elapse->lapse( my $now );
8              
9             BEGIN {
10 1     1   519 print "$0 Started: " . ( scalar localtime ) . "\n";
11             }
12              
13             END {
14 1     1   1072734 print "$0 Finished: " . ( scalar localtime ) . ", elapsed time = $now\n";
15             }
16              
17              
18              
19             =head1 NAME
20              
21             Timer::Runtime - time a programs runtime
22              
23             =head1 VERSION
24              
25             Version 0.03
26              
27             =cut
28              
29             our $VERSION = '0.03';
30              
31              
32             =head1 SYNOPSIS
33              
34             Timer::Runtime wraps a program with START and END blocks used to get the
35             start/stop times and caculate the runtime duration. This information is printed
36             to STDOUT. Note that if the program exists using 'exec', then the stop time
37             won't be seen due to the END block in Timer::Runtime not being called.
38              
39             use Timer::Runtime;
40              
41             # output
42             > Started: Thu Aug 12 20:34:49 2010
43             > Finished: Thu Aug 12 20:34:49 2010, elapsed time = 00:00:00.000114
44              
45             =head1 AUTHOR
46              
47             Adam H Wohld, C<< >>
48              
49             =head1 BUGS
50              
51             Please report any bugs or feature requests to C, or through
52             the web interface at L. I will be notified, and then you'll
53             automatically be notified of progress on your bug as I make changes.
54              
55             =head1 SUPPORT
56              
57             You can find documentation for this module with the perldoc command.
58              
59             perldoc Timer::Runtime
60              
61              
62             You can also look for information at:
63              
64             =over 4
65              
66             =item * RT: CPAN's request tracker
67              
68             L
69              
70             =item * AnnoCPAN: Annotated CPAN documentation
71              
72             L
73              
74             =item * CPAN Ratings
75              
76             L
77              
78             =item * Search CPAN
79              
80             L
81              
82             =back
83              
84              
85             =head1 ACKNOWLEDGEMENTS
86              
87             =head1 LICENSE AND COPYRIGHT
88              
89             Copyright 2011 Adam Wohld.
90              
91             This program is free software; you can redistribute it and/or modify it
92             under the terms of either: the GNU General Public License as published
93             by the Free Software Foundation; or the Artistic License.
94              
95             See http://dev.perl.org/licenses/ for more information.
96              
97             =cut
98              
99             1; # End of Timer::Runtime