← 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:26:58 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/Iterator/ProcessIterator.pm
StatementsExecuted 31 statements in 748µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111686µs1.65sFoswiki::Iterator::ProcessIterator::::nextFoswiki::Iterator::ProcessIterator::next
11144µs51µsFoswiki::Iterator::ProcessIterator::::newFoswiki::Iterator::ProcessIterator::new
11142µs1.65sFoswiki::Iterator::ProcessIterator::::allFoswiki::Iterator::ProcessIterator::all
22129µs736µsFoswiki::Iterator::ProcessIterator::::hasNextFoswiki::Iterator::ProcessIterator::hasNext
11125µs32µsFoswiki::Iterator::ProcessIterator::::BEGIN@14Foswiki::Iterator::ProcessIterator::BEGIN@14
11118µs56µsFoswiki::Iterator::ProcessIterator::::BEGIN@16Foswiki::Iterator::ProcessIterator::BEGIN@16
11117µs36µsFoswiki::Iterator::ProcessIterator::::BEGIN@15Foswiki::Iterator::ProcessIterator::BEGIN@15
11110µs10µsFoswiki::Iterator::ProcessIterator::::BEGIN@18Foswiki::Iterator::ProcessIterator::BEGIN@18
0000s0sFoswiki::Iterator::ProcessIterator::::resetFoswiki::Iterator::ProcessIterator::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
4
5---+ package Foswiki::Iterator::ProcessIterator
6
7Iterator that filters another iterator by calling an external process on each
8element in the iteration.
9
10=cut
11
12package Foswiki::Iterator::ProcessIterator;
13
14253µs240µs
# spent 32µs (25+8) within Foswiki::Iterator::ProcessIterator::BEGIN@14 which was called: # once (25µs+8µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 14
use strict;
# spent 32µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@14 # spent 8µs making 1 call to strict::import
15245µs255µs
# spent 36µs (17+19) within Foswiki::Iterator::ProcessIterator::BEGIN@15 which was called: # once (17µs+19µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 15
use warnings;
# spent 36µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@15 # spent 19µs making 1 call to warnings::import
16246µs295µs
# spent 56µs (18+39) within Foswiki::Iterator::ProcessIterator::BEGIN@16 which was called: # once (18µs+39µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 16
use Assert;
# spent 56µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@16 # spent 39µs making 1 call to Assert::import
17
182450µs110µs
# spent 10µs within Foswiki::Iterator::ProcessIterator::BEGIN@18 which was called: # once (10µs+0s) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 18
use Foswiki::Iterator ();
# spent 10µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@18
19115µsour @ISA = ('Foswiki::Iterator');
20
21=begin TML
22
23---++ ClassMethod new( $iter, $sub )
24Construct a new iterator that will filter $iter by calling
25$sub. on each element. $sub should return the filtered value
26for the element.
27
28=cut
29
30
# spent 51µs (44+7) within Foswiki::Iterator::ProcessIterator::new which was called: # once (44µs+7µs) by Foswiki::Store::Interfaces::QueryAlgorithm::query at line 111 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Store/Interfaces/QueryAlgorithm.pm
sub new {
31937µs my ( $class, $iter, $sub, $data ) = @_;
3213µs ASSERT( UNIVERSAL::isa( $iter, 'Foswiki::Iterator' ) ) if DEBUG;
# spent 3µs making 1 call to Assert::ASSERTS_OFF
3313µs ASSERT( ref($sub) eq 'CODE' ) if DEBUG;
# spent 3µs making 1 call to Assert::ASSERTS_OFF
34 my $this = bless( {}, $class );
35 $this->{iterator} = $iter;
36 $this->{process} = $sub;
37 $this->{data} = $data;
38 $this->{next} = undef;
39 return $this;
40}
41
42# See Foswiki::Iterator for a description of the general iterator contract
43
# spent 736µs (29+707) within Foswiki::Iterator::ProcessIterator::hasNext which was called 2 times, avg 368µs/call: # once (16µs+672µs) by Foswiki::Iterator::ProcessIterator::all at line 66 # once (13µs+34µs) by Foswiki::Iterator::ProcessIterator::all at line 67
sub hasNext {
44431µs my $this = shift;
452706µs return $this->{iterator}->hasNext();
# spent 706µs making 2 calls to Foswiki::Iterator::FilterIterator::hasNext, avg 353µs/call
46}
47
48# See Foswiki::Iterator for a description of the general iterator contract
49
# spent 1.65s (686µs+1.65) within Foswiki::Iterator::ProcessIterator::next which was called: # once (686µs+1.65s) by Foswiki::Iterator::ProcessIterator::all at line 67
sub next {
50226µs my $this = shift;
5112µs21.65s return &{ $this->{process} }( $this->{iterator}->next(), $this->{data} );
52}
53
54# See Foswiki::Iterator for a description of the general iterator contract
55sub reset {
56 my ($this) = @_;
57
58 #TODO: need to carefully consider what side effects this has
59
60 return;
61}
62
63
# spent 1.65s (42µs+1.65) within Foswiki::Iterator::ProcessIterator::all which was called: # once (42µs+1.65s) by Foswiki::Store::Interfaces::QueryAlgorithm::query at line 119 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Store/Interfaces/QueryAlgorithm.pm
sub all {
64419µs my $this = shift;
65 my @results;
661688µs while ( $this->hasNext() ) {
# spent 688µs making 1 call to Foswiki::Iterator::ProcessIterator::hasNext
67118µs21.65s push( @results, $this->next() );
# spent 1.65s making 1 call to Foswiki::Iterator::ProcessIterator::next # spent 47µs making 1 call to Foswiki::Iterator::ProcessIterator::hasNext
68 }
69 return @results;
70}
71
7216µs1;
73__END__