← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:16 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Iterator/ProcessIterator.pm
StatementsExecuted 1531 statements in 3.98ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
80111.51ms108sFoswiki::Iterator::ProcessIterator::::allFoswiki::Iterator::ProcessIterator::all (recurses: max depth 1, inclusive time 49.1s)
80111.04ms108sFoswiki::Iterator::ProcessIterator::::nextFoswiki::Iterator::ProcessIterator::next (recurses: max depth 1, inclusive time 49.1s)
16021972µs18.5msFoswiki::Iterator::ProcessIterator::::hasNextFoswiki::Iterator::ProcessIterator::hasNext
8011465µs465µsFoswiki::Iterator::ProcessIterator::::newFoswiki::Iterator::ProcessIterator::new
11113µs27µsFoswiki::Iterator::ProcessIterator::::BEGIN@14Foswiki::Iterator::ProcessIterator::BEGIN@14
11110µs14µsFoswiki::Iterator::ProcessIterator::::BEGIN@15Foswiki::Iterator::ProcessIterator::BEGIN@15
1119µs35µsFoswiki::Iterator::ProcessIterator::::BEGIN@16Foswiki::Iterator::ProcessIterator::BEGIN@16
1115µs5µsFoswiki::Iterator::ProcessIterator::::BEGIN@21Foswiki::Iterator::ProcessIterator::BEGIN@21
1114µs4µ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
14228µs241µs
# spent 27µs (13+14) within Foswiki::Iterator::ProcessIterator::BEGIN@14 which was called: # once (13µs+14µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 14
use strict;
# spent 27µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@14 # spent 14µs making 1 call to strict::import
15223µs218µs
# spent 14µs (10+4) within Foswiki::Iterator::ProcessIterator::BEGIN@15 which was called: # once (10µs+4µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 15
use warnings;
# spent 14µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@15 # spent 4µs making 1 call to warnings::import
16225µs261µs
# spent 35µs (9+26) within Foswiki::Iterator::ProcessIterator::BEGIN@16 which was called: # once (9µs+26µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 16
use Assert;
# spent 35µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@16 # spent 26µs making 1 call to Exporter::import
17
18272µs14µs
# spent 4µs within Foswiki::Iterator::ProcessIterator::BEGIN@18 which was called: # once (4µs+0s) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 18
use Foswiki::Iterator ();
# spent 4µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@18
19110µsour @ISA = ('Foswiki::Iterator');
20
21
# spent 5µs within Foswiki::Iterator::ProcessIterator::BEGIN@21 which was called: # once (5µs+0s) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@20 at line 26
BEGIN {
2216µs if ( $Foswiki::cfg{UseLocale} ) {
23 require locale;
24 import locale();
25 }
261232µs15µs}
# spent 5µs making 1 call to Foswiki::Iterator::ProcessIterator::BEGIN@21
27
28=begin TML
29
30---++ ClassMethod new( $iter, $sub )
31Construct a new iterator that will filter $iter by calling
32$sub. on each element. $sub should return the filtered value
33for the element.
34
35=cut
36
37
# spent 465µs within Foswiki::Iterator::ProcessIterator::new which was called 80 times, avg 6µs/call: # 80 times (465µs+0s) by Foswiki::Store::Interfaces::QueryAlgorithm::query at line 121 of /var/www/foswikidev/core/lib/Foswiki/Store/Interfaces/QueryAlgorithm.pm, avg 6µs/call
sub new {
388080µs my ( $class, $iter, $sub, $data ) = @_;
39 ASSERT( UNIVERSAL::isa( $iter, 'Foswiki::Iterator' ) ) if DEBUG;
40808µs ASSERT( ref($sub) eq 'CODE' ) if DEBUG;
4180107µs my $this = bless( {}, $class );
428054µs $this->{iterator} = $iter;
438038µs $this->{process} = $sub;
448025µs $this->{data} = $data;
458031µs $this->{next} = undef;
4680215µs return $this;
47}
48
49# See Foswiki::Iterator for a description of the general iterator contract
50
# spent 18.5ms (972µs+17.6) within Foswiki::Iterator::ProcessIterator::hasNext which was called 160 times, avg 116µs/call: # 80 times (282µs+16.6ms) by Foswiki::Iterator::ProcessIterator::all at line 73, avg 211µs/call # 80 times (690µs+967µs) by Foswiki::Iterator::ProcessIterator::all at line 74, avg 21µs/call
sub hasNext {
5116080µs my $this = shift;
52160674µs16017.6ms return $this->{iterator}->hasNext();
# spent 17.6ms making 160 calls to Foswiki::Iterator::FilterIterator::hasNext, avg 110µs/call
53}
54
55# See Foswiki::Iterator for a description of the general iterator contract
56
# spent 108s (1.04ms+108) within Foswiki::Iterator::ProcessIterator::next which was called 80 times, avg 1.35s/call: # 80 times (1.04ms+108s) by Foswiki::Iterator::ProcessIterator::all at line 74, avg 1.35s/call
sub next {
578026µs my $this = shift;
5880731µs160157s return &{ $this->{process} }( $this->{iterator}->next(), $this->{data} );
59}
60
61# See Foswiki::Iterator for a description of the general iterator contract
62sub reset {
63 my ($this) = @_;
64
65 #TODO: need to carefully consider what side effects this has
66
67 return;
68}
69
70
# spent 108s (1.51ms+108) within Foswiki::Iterator::ProcessIterator::all which was called 80 times, avg 1.35s/call: # 80 times (1.51ms+108s) by Foswiki::Store::Interfaces::QueryAlgorithm::query at line 129 of /var/www/foswikidev/core/lib/Foswiki/Store/Interfaces/QueryAlgorithm.pm, avg 1.35s/call
sub all {
718030µs my $this = shift;
728021µs my @results;
7380140µs8016.9ms while ( $this->hasNext() ) {
# spent 16.9ms making 80 calls to Foswiki::Iterator::ProcessIterator::hasNext, avg 211µs/call
7480886µs160108s push( @results, $this->next() );
# spent 157s making 80 calls to Foswiki::Iterator::ProcessIterator::next, avg 1.97s/call, recursion: max depth 1, sum of overlapping time 49.1s # spent 1.66ms making 80 calls to Foswiki::Iterator::ProcessIterator::hasNext, avg 21µs/call
75 }
7680440µs return @results;
77}
78
7913µs1;
80__END__