1Dancer::Timer(3)      User Contributed Perl Documentation     Dancer::Timer(3)
2
3
4

NAME

6       Dancer::Timer - a timer for Dancer
7

VERSION

9       version 1.3512
10

SYNOPSIS

12           use Dancer::Timer;
13
14           my $timer = Dancer::Timer->new();
15           my $time  = $timer->tick;
16           print "[$time]: Doing something\n";
17
18           # (time passes)
19           $time = $timer->tick;
20           print "[$time]: Doing something else\n";
21
22           # (time passes)
23           $time = $timer->to_string;
24           print "[$time]: Doing another thing\n";
25

DESCRIPTION

27       Dancer::Timer provides Dancer with a timing object to clock operations.
28       For example, you might want a logging that shows you when each
29       operation happened (at what time) to determine how long each operation
30       was in order to know where to focus on for possible bugs or perhaps
31       unnecessary slowness.
32
33       Dancer uses Dancer::Timer in facilities that want to provide this for
34       you. Any plugin author is more than welcome to use it as well.
35

ATTRIBUTES

37   start_time
38       Retains the starting time of the timer. The default value is when the
39       object is created. It fetches that using "gettimeofday" from
40       Time::HiRes.
41

METHODS

43   init
44       This method is called when "->new()" is called. It initializes the
45       "start_time" attribute.
46
47   tick
48       Creates a tick in the timer and returns the interval between the
49       "start_time" and now.
50
51   to_string
52       Same as "tick", just more expressive.
53

AUTHOR

55       Dancer Core Developers
56
58       This software is copyright (c) 2010 by Alexis Sukrieh.
59
60       This is free software; you can redistribute it and/or modify it under
61       the same terms as the Perl 5 programming language system itself.
62
63
64
65perl v5.28.1                      2019-03-31                  Dancer::Timer(3)
Impressum