Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/FORMAT.pm |
Statements | Executed 25 statements in 867µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 119µs | 825µs | FORMAT | Foswiki::
1 | 1 | 1 | 77µs | 554µs | __ANON__[:65] | Foswiki::
1 | 1 | 1 | 27µs | 34µs | BEGIN@4.50 | Foswiki::
1 | 1 | 1 | 20µs | 39µs | BEGIN@5.51 | Foswiki::
0 | 0 | 0 | 0s | 0s | __ANON__[:73] | Foswiki::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Foswiki; | ||||
3 | |||||
4 | 2 | 51µs | 2 | 42µ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 # spent 34µs making 1 call to Foswiki::BEGIN@4.50
# spent 8µs making 1 call to strict::import |
5 | 2 | 662µs | 2 | 59µ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 # 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 | ||||
10 | 14 | 84µ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} ) ); | ||||
21 | 1 | 63µ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; | ||||
30 | 1 | 8µs | $params->{baseweb} = $topicObject->web; # spent 8µs making 1 call to Foswiki::Meta::web | ||
31 | 1 | 8µ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 | ||||
41 | 6 | 66µs | my $listIterator; | ||
42 | |||||
43 | if ( $type eq 'string' ) { | ||||
44 | require Foswiki::ListIterator; | ||||
45 | 1 | 30µ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 | } | ||||
62 | 2 | 386µ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 ); | ||||
64 | 1 | 61µ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 ); | ||||
73 | 3 | 21µ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 | |||||
78 | 1 | 5µs | 1; | ||
79 | __END__ |