← 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:36 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/FORMAT.pm
StatementsExecuted 25 statements in 867µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111119µs825µsFoswiki::::FORMATFoswiki::FORMAT
11177µs554µsFoswiki::::__ANON__[:65]Foswiki::__ANON__[:65]
11127µs34µsFoswiki::::BEGIN@4.50Foswiki::BEGIN@4.50
11120µs39µsFoswiki::::BEGIN@5.51Foswiki::BEGIN@5.51
0000s0sFoswiki::::__ANON__[:73]Foswiki::__ANON__[:73]
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
2package Foswiki;
3
4251µs242µs
# spent 34µs (27+8) within Foswiki::BEGIN@4.50 which was called: # once (27µs+8µs) by Foswiki::_expandMacroOnTopicRendering at line 4
use strict;
# spent 34µs making 1 call to Foswiki::BEGIN@4.50 # spent 8µs making 1 call to strict::import
52662µs259µs
# spent 39µs (20+19) within Foswiki::BEGIN@5.51 which was called: # once (20µs+19µs) by Foswiki::_expandMacroOnTopicRendering at line 5
use warnings;
# spent 39µs making 1 call to Foswiki::BEGIN@5.51 # spent 19µs making 1 call to warnings::import
6
7#our $SEARCHTERMS = qr/\$(web|topic|parent|text|locked|date|isodate|rev|username|wikiname|wikiusername|createdate|createusername|createwikiname|createwikiusername|summary|changes|formname|formfield|pattern|count|ntopics|nhots|pager)\b/;
8
9
# spent 825µs (119+706) within Foswiki::FORMAT which was called: # once (119µs+706µs) by Foswiki::_expandMacroOnTopicRendering at line 3066 of /usr/local/src/github.com/foswiki/core/lib/Foswiki.pm
sub FORMAT {
101484µs my ( $this, $params, $topicObject ) = @_;
11
12 my @list = split( /,\s*/, $params->{_DEFAULT} || '' );
13 my $s;
14
15 # TODO: this is a common default that should be extracted into a
16 # 'test, default and refine' parameters for all formatResult calls
17 # Note that for FORMAT we do not default adding \n after header when
18 # separator is not defined. FORMAT is a new feature in 1.1 and does
19 # not need the backward compatibility that SEARCH needed.
20 $params->{separator} = '$n' unless ( defined( $params->{separator} ) );
21163µs $params->{separator} =
# spent 63µs making 1 call to Foswiki::expandStandardEscapes
22 Foswiki::expandStandardEscapes( $params->{separator} );
23
24 my $type = $params->{type} || 'topic';
25 $type = 'topic'
26 unless ( $type eq 'string' ); #only support special type 'string'
27
28 # pass on all attrs, and add some more
29 #$params->{_callback} = undef;
3018µs $params->{baseweb} = $topicObject->web;
# spent 8µs making 1 call to Foswiki::Meta::web
3118µs $params->{basetopic} = $topicObject->topic;
# spent 8µs making 1 call to Foswiki::Meta::topic
32 $params->{search} = $params->{_DEFAULT}
33 if defined $params->{_DEFAULT};
34 $params->{type} = $this->{prefs}->getPreference('SEARCHVARDEFAULTTYPE')
35 unless ( $params->{type} );
36
37 undef $params
38 ->{limit}; #do not polute FORMAT with the per web legacy mess (the code would be horrid.)
39
40
# spent 554µs (77+478) within Foswiki::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/FORMAT.pm:65] which was called: # once (77µs+478µs) by Error::subs::try at line 416 of Error.pm
try {
41666µs my $listIterator;
42
43 if ( $type eq 'string' ) {
44 require Foswiki::ListIterator;
45130µs $listIterator = new Foswiki::ListIterator( \@list );
# spent 30µs making 1 call to Foswiki::ListIterator::new
46 }
47 else {
48
49 # from Search::_makeTopicPattern (plus an added . to
50 # allow web.topic)
51 my @topics = map {
52 s/[^\*\_\-\+\.\/$Foswiki::regex{mixedAlphaNum}]//go;
53 s/\*/\.\*/go;
54 $_
55 } @list;
56
57 require Foswiki::Search::InfoCache;
58 $listIterator =
59 new Foswiki::Search::InfoCache( $this, $params->{baseweb},
60 \@topics );
61 }
622386µs my ( $ttopics, $searchResult, $tmplTail ) =
# spent 376µs making 1 call to Foswiki::Search::formatResults # spent 10µs making 1 call to Foswiki::search
63 $this->search->formatResults( undef, $listIterator, $params );
64161µs $s = Foswiki::expandStandardEscapes($searchResult);
# spent 61µs making 1 call to Foswiki::expandStandardEscapes
65 }
66 catch Error::Simple with {
67 my $message = (DEBUG) ? shift->stringify() : shift->{-text};
68
69 # Block recursions kicked off by the text being repeated in the
70 # error message
71 $message =~ s/%([A-Z]*[{%])/%<nop>$1/g;
72 $s = $this->inlineAlert( 'alerts', 'bad_search', $message );
73321µs };
# spent 16µs making 1 call to Error::catch # spent 5µs making 1 call to Error::subs::with # spent 606µs making 1 call to Error::subs::try, recursion: max depth 1, sum of overlapping time 606µs
74
75 return $s;
76}
77
7815µs1;
79__END__