← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:23:40 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Log/Log4perl/Util/TimeTracker.pm
StatementsExecuted 38 statements in 521µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11123µs23µsLog::Log4perl::Util::TimeTracker::::BEGIN@5Log::Log4perl::Util::TimeTracker::BEGIN@5
11122µs59µsLog::Log4perl::Util::TimeTracker::::newLog::Log4perl::Util::TimeTracker::new
1119µs965µsLog::Log4perl::Util::TimeTracker::::BEGIN@13Log::Log4perl::Util::TimeTracker::BEGIN@13
1119µs38µsLog::Log4perl::Util::TimeTracker::::resetLog::Log4perl::Util::TimeTracker::reset
1118µs21µsLog::Log4perl::Util::TimeTracker::::_gettimeofdayLog::Log4perl::Util::TimeTracker::_gettimeofday
1117µs29µsLog::Log4perl::Util::TimeTracker::::gettimeofdayLog::Log4perl::Util::TimeTracker::gettimeofday
1117µs9µsLog::Log4perl::Util::TimeTracker::::BEGIN@6Log::Log4perl::Util::TimeTracker::BEGIN@6
1116µs47µsLog::Log4perl::Util::TimeTracker::::BEGIN@9Log::Log4perl::Util::TimeTracker::BEGIN@9
1116µs14µsLog::Log4perl::Util::TimeTracker::::BEGIN@7Log::Log4perl::Util::TimeTracker::BEGIN@7
1114µs4µsLog::Log4perl::Util::TimeTracker::::BEGIN@8Log::Log4perl::Util::TimeTracker::BEGIN@8
0000s0sLog::Log4perl::Util::TimeTracker::::delta_millisecondsLog::Log4perl::Util::TimeTracker::delta_milliseconds
0000s0sLog::Log4perl::Util::TimeTracker::::hires_availableLog::Log4perl::Util::TimeTracker::hires_available
0000s0sLog::Log4perl::Util::TimeTracker::::millisecondsLog::Log4perl::Util::TimeTracker::milliseconds
0000s0sLog::Log4perl::Util::TimeTracker::::time_diffLog::Log4perl::Util::TimeTracker::time_diff
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1##################################################
2package Log::Log4perl::Util::TimeTracker;
3##################################################
4
5332µs123µs
# spent 23µs within Log::Log4perl::Util::TimeTracker::BEGIN@5 which was called: # once (23µs+0s) by Log::Log4perl::Layout::PatternLayout::BEGIN@18 at line 5
use 5.006;
# spent 23µs making 1 call to Log::Log4perl::Util::TimeTracker::BEGIN@5
6318µs211µs
# spent 9µs (7+2) within Log::Log4perl::Util::TimeTracker::BEGIN@6 which was called: # once (7µs+2µs) by Log::Log4perl::Layout::PatternLayout::BEGIN@18 at line 6
use strict;
# spent 9µs making 1 call to Log::Log4perl::Util::TimeTracker::BEGIN@6 # spent 2µs making 1 call to strict::import
7317µs221µs
# spent 14µs (6+8) within Log::Log4perl::Util::TimeTracker::BEGIN@7 which was called: # once (6µs+8µs) by Log::Log4perl::Layout::PatternLayout::BEGIN@18 at line 7
use warnings;
# spent 14µs making 1 call to Log::Log4perl::Util::TimeTracker::BEGIN@7 # spent 8µs making 1 call to warnings::import
8316µs14µs
# spent 4µs within Log::Log4perl::Util::TimeTracker::BEGIN@8 which was called: # once (4µs+0s) by Log::Log4perl::Layout::PatternLayout::BEGIN@18 at line 8
use Log::Log4perl::Util;
# spent 4µs making 1 call to Log::Log4perl::Util::TimeTracker::BEGIN@8
9353µs287µs
# spent 47µs (6+40) within Log::Log4perl::Util::TimeTracker::BEGIN@9 which was called: # once (6µs+40µs) by Log::Log4perl::Layout::PatternLayout::BEGIN@18 at line 9
use Carp;
# spent 47µs making 1 call to Log::Log4perl::Util::TimeTracker::BEGIN@9 # spent 40µs making 1 call to Exporter::import
10
111200nsour $TIME_HIRES_AVAILABLE;
12
13
# spent 965µs (9+956) within Log::Log4perl::Util::TimeTracker::BEGIN@13 which was called: # once (9µs+956µs) by Log::Log4perl::Layout::PatternLayout::BEGIN@18 at line 22
BEGIN {
14 # Check if we've got Time::HiRes. If not, don't make a big fuss,
15 # just set a flag so we know later on that we can't have fine-grained
16 # time stamps
171300ns $TIME_HIRES_AVAILABLE = 0;
1816µs1956µs if(Log::Log4perl::Util::module_available("Time::HiRes")) {
# spent 956µs making 1 call to Log::Log4perl::Util::module_available
191500ns require Time::HiRes;
201500ns $TIME_HIRES_AVAILABLE = 1;
21 }
221316µs1965µs}
# spent 965µs making 1 call to Log::Log4perl::Util::TimeTracker::BEGIN@13
23
24##################################################
25
# spent 59µs (22+38) within Log::Log4perl::Util::TimeTracker::new which was called: # once (22µs+38µs) by Log::Log4perl::Layout::PatternLayout::new at line 60 of Log/Log4perl/Layout/PatternLayout.pm
sub new {
26##################################################
271900ns my $class = shift;
281500ns $class = ref ($class) || $class;
29
3013µs my $self = {
31 reset_time => undef,
32 @_,
33 };
34
3513µs $self->{time_function} = \&_gettimeofday unless
36 defined $self->{time_function};
37
3818µs bless $self, $class;
39
4013µs138µs $self->reset();
# spent 38µs making 1 call to Log::Log4perl::Util::TimeTracker::reset
41
4213µs return $self;
43}
44
45##################################################
46sub hires_available {
47##################################################
48 return $TIME_HIRES_AVAILABLE;
49}
50
51##################################################
52
# spent 21µs (8+13) within Log::Log4perl::Util::TimeTracker::_gettimeofday which was called: # once (8µs+13µs) by Log::Log4perl::Util::TimeTracker::gettimeofday at line 67
sub _gettimeofday {
53##################################################
54 # Return secs and optionally msecs if we have Time::HiRes
55123µs113µs if($TIME_HIRES_AVAILABLE) {
# spent 13µs making 1 call to Time::HiRes::gettimeofday
56 return (Time::HiRes::gettimeofday());
57 } else {
58 return (time(), 0);
59 }
60}
61
62##################################################
63
# spent 29µs (7+21) within Log::Log4perl::Util::TimeTracker::gettimeofday which was called: # once (7µs+21µs) by Log::Log4perl::Util::TimeTracker::reset at line 78
sub gettimeofday {
64##################################################
651600ns my($self) = @_;
66
6713µs121µs my($seconds, $microseconds) = $self->{time_function}->();
# spent 21µs making 1 call to Log::Log4perl::Util::TimeTracker::_gettimeofday
68
691400ns $microseconds = 0 if ! defined $microseconds;
7013µs return($seconds, $microseconds);
71}
72
73##################################################
74
# spent 38µs (9+29) within Log::Log4perl::Util::TimeTracker::reset which was called: # once (9µs+29µs) by Log::Log4perl::Util::TimeTracker::new at line 40
sub reset {
75##################################################
761700ns my($self) = @_;
77
7813µs129µs my $current_time = [$self->gettimeofday()];
# spent 29µs making 1 call to Log::Log4perl::Util::TimeTracker::gettimeofday
791800ns $self->{reset_time} = $current_time;
801600ns $self->{last_call_time} = $current_time;
81
8213µs return $current_time;
83}
84
85##################################################
86sub time_diff {
87##################################################
88 my($time_from, $time_to) = @_;
89
90 my $seconds = $time_to->[0] -
91 $time_from->[0];
92
93 my $milliseconds = int(( $time_to->[1] -
94 $time_from->[1] ) / 1000);
95
96 if($milliseconds < 0) {
97 $milliseconds = 1000 + $milliseconds;
98 $seconds--;
99 }
100
101 return($seconds, $milliseconds);
102}
103
104##################################################
105sub milliseconds {
106##################################################
107 my($self, $current_time) = @_;
108
109 $current_time = [ $self->gettimeofday() ] unless
110 defined $current_time;
111
112 my($seconds, $milliseconds) = time_diff(
113 $self->{reset_time},
114 $current_time);
115
116 return $seconds*1000 + $milliseconds;
117}
118
119##################################################
120sub delta_milliseconds {
121##################################################
122 my($self, $current_time) = @_;
123
124 $current_time = [ $self->gettimeofday() ] unless
125 defined $current_time;
126
127 my($seconds, $milliseconds) = time_diff(
128 $self->{last_call_time},
129 $current_time);
130
131 $self->{last_call_time} = $current_time;
132
133 return $seconds*1000 + $milliseconds;
134}
135
13613µs1;
137
138__END__