← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/local/src/github.com/foswiki/core/bin/view
  Run on Sun Dec 4 17:17:59 2011
Reported on Sun Dec 4 17:27:09 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/Iterator/NumberRangeIterator.pm
StatementsExecuted 48 statements in 712µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
21182µs82µsFoswiki::Iterator::NumberRangeIterator::::newFoswiki::Iterator::NumberRangeIterator::new
44240µs40µsFoswiki::Iterator::NumberRangeIterator::::nextFoswiki::Iterator::NumberRangeIterator::next
44238µs38µsFoswiki::Iterator::NumberRangeIterator::::hasNextFoswiki::Iterator::NumberRangeIterator::hasNext
11125µs25µsFoswiki::Iterator::NumberRangeIterator::::BEGIN@12Foswiki::Iterator::NumberRangeIterator::BEGIN@12
11118µs26µsFoswiki::Iterator::NumberRangeIterator::::BEGIN@15Foswiki::Iterator::NumberRangeIterator::BEGIN@15
11117µs36µsFoswiki::Iterator::NumberRangeIterator::::BEGIN@16Foswiki::Iterator::NumberRangeIterator::BEGIN@16
11117µs57µsFoswiki::Iterator::NumberRangeIterator::::BEGIN@17Foswiki::Iterator::NumberRangeIterator::BEGIN@17
22114µs14µsFoswiki::Iterator::NumberRangeIterator::::resetFoswiki::Iterator::NumberRangeIterator::reset
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2
3=begin TML
4
5---+ package Foswiki::Iterator::NumberRangeIterator
6
7Iterator over a range of integer values, with programmable increment.
8
9=cut
10
11package Foswiki::Iterator::NumberRangeIterator;
12272µs125µs
# spent 25µs within Foswiki::Iterator::NumberRangeIterator::BEGIN@12 which was called: # once (25µs+0s) by Foswiki::Store::VC::Handler::BEGIN@38 at line 12
use Foswiki::Iterator;
13110µsour @ISA = ('Foswiki::Iterator');
14
15245µs234µs
# spent 26µs (18+8) within Foswiki::Iterator::NumberRangeIterator::BEGIN@15 which was called: # once (18µs+8µs) by Foswiki::Store::VC::Handler::BEGIN@38 at line 15
use strict;
# spent 26µs making 1 call to Foswiki::Iterator::NumberRangeIterator::BEGIN@15 # spent 8µs making 1 call to strict::import
16245µs254µs
# spent 36µs (17+18) within Foswiki::Iterator::NumberRangeIterator::BEGIN@16 which was called: # once (17µs+18µs) by Foswiki::Store::VC::Handler::BEGIN@38 at line 16
use warnings;
# spent 36µs making 1 call to Foswiki::Iterator::NumberRangeIterator::BEGIN@16 # spent 19µs making 1 call to warnings::import
172309µs297µs
# spent 57µs (17+40) within Foswiki::Iterator::NumberRangeIterator::BEGIN@17 which was called: # once (17µs+40µs) by Foswiki::Store::VC::Handler::BEGIN@38 at line 17
use Assert;
# spent 57µs making 1 call to Foswiki::Iterator::NumberRangeIterator::BEGIN@17 # spent 40µs making 1 call to Assert::import
18
19=begin TML
20
21---++ ClassMethod new($start, $end, $inc)
22Construct a new iterator from start to end step inc.
23The range is inclusive i.e. if $end == $start, you will get an iterator
24that returns a single value.
25
26The iteration step is the absolute value of $inc, and defaults to 1.
27
28=cut
29
30
# spent 82µs within Foswiki::Iterator::NumberRangeIterator::new which was called 2 times, avg 41µs/call: # 2 times (82µs+0s) by Foswiki::Store::VC::Handler::getRevisionHistory at line 434 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Store/VC/Handler.pm, avg 41µs/call
sub new {
31213µs my ( $class, $start, $end, $inc ) = @_;
3224µs $inc ||= 1;
33262µs return bless(
34 {
35 start => $start,
36 end => $end,
37 inc => ( $end > $start ) ? abs($inc) : -abs($inc),
38 cur => $start,
39 },
40 $class
41 );
42}
43
44
# spent 38µs within Foswiki::Iterator::NumberRangeIterator::hasNext which was called 4 times, avg 9µs/call: # once (12µs+0s) by Foswiki::Iterator::all at line 85 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Iterator.pm # once (10µs+0s) by Foswiki::UI::View::view at line 128 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/View.pm # once (8µs+0s) by Foswiki::UI::View::view at line 129 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/View.pm # once (8µs+0s) by Foswiki::Iterator::all at line 86 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Iterator.pm
sub hasNext {
4546µs my $this = shift;
4648µs if ( $this->{inc} > 0 ) {
47 return $this->{cur} <= $this->{end};
48 }
49 else {
50445µs return $this->{cur} >= $this->{end};
51 }
52}
53
54
# spent 40µs within Foswiki::Iterator::NumberRangeIterator::next which was called 4 times, avg 10µs/call: # once (11µs+0s) by Foswiki::UI::View::view at line 122 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/View.pm # once (10µs+0s) by Foswiki::Iterator::all at line 86 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Iterator.pm # once (10µs+0s) by Foswiki::UI::View::view at line 210 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/View.pm # once (9µs+0s) by Foswiki::UI::View::view at line 129 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/View.pm
sub next {
5546µs my $this = shift;
5647µs my $res = $this->{cur};
5748µs $this->{cur} += $this->{inc};
58437µs return $res;
59}
60
61
# spent 14µs within Foswiki::Iterator::NumberRangeIterator::reset which was called 2 times, avg 7µs/call: # once (8µs+0s) by Foswiki::UI::View::view at line 209 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/View.pm # once (7µs+0s) by Foswiki::UI::View::view at line 127 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/UI/View.pm
sub reset {
6224µs my $this = shift;
63226µs $this->{cur} = $this->{start};
64}
65
6616µs1;
67
68__END__