← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 19:05:14 2015
Reported on Fri Jul 31 19:08:09 2015

Filename/var/www/foswiki11/lib/Foswiki/UI/View.pm
StatementsExecuted 154 statements in 4.09ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3311.28ms59.2sFoswiki::UI::View::::_prepareFoswiki::UI::View::_prepare
111660µs59.6sFoswiki::UI::View::::viewFoswiki::UI::View::view
111204µs177msFoswiki::UI::View::::revisionsAroundFoswiki::UI::View::revisionsAround
111172µs175µsFoswiki::UI::View::::BEGIN@15Foswiki::UI::View::BEGIN@15
11113µs26µsFoswiki::UI::View::::BEGIN@13Foswiki::UI::View::BEGIN@13
1119µs14µsFoswiki::UI::View::::BEGIN@14Foswiki::UI::View::BEGIN@14
1118µs21µsFoswiki::UI::View::::BEGIN@17Foswiki::UI::View::BEGIN@17
1114µs4µsFoswiki::UI::View::::BEGIN@16Foswiki::UI::View::BEGIN@16
1113µs3µsFoswiki::UI::View::::BEGIN@19Foswiki::UI::View::BEGIN@19
1113µs3µsFoswiki::UI::View::::BEGIN@21Foswiki::UI::View::BEGIN@21
1113µs3µsFoswiki::UI::View::::BEGIN@20Foswiki::UI::View::BEGIN@20
1113µs3µsFoswiki::UI::View::::BEGIN@22Foswiki::UI::View::BEGIN@22
1113µs3µsFoswiki::UI::View::::BEGIN@23Foswiki::UI::View::BEGIN@23
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::UI::View
6
7UI delegate for view function
8
9=cut
10
11package Foswiki::UI::View;
12
13229µs240µs
# spent 26µs (13+14) within Foswiki::UI::View::BEGIN@13 which was called: # once (13µs+14µs) by Foswiki::UI::BEGIN@2 at line 13
use strict;
# spent 26µs making 1 call to Foswiki::UI::View::BEGIN@13 # spent 14µs making 1 call to strict::import
14224µs220µs
# spent 14µs (9+5) within Foswiki::UI::View::BEGIN@14 which was called: # once (9µs+5µs) by Foswiki::UI::BEGIN@2 at line 14
use warnings;
# spent 14µs making 1 call to Foswiki::UI::View::BEGIN@14 # spent 5µs making 1 call to warnings::import
152186µs2177µs
# spent 175µs (172+2) within Foswiki::UI::View::BEGIN@15 which was called: # once (172µs+2µs) by Foswiki::UI::BEGIN@2 at line 15
use integer;
# spent 175µs making 1 call to Foswiki::UI::View::BEGIN@15 # spent 2µs making 1 call to integer::import
16221µs14µs
# spent 4µs within Foswiki::UI::View::BEGIN@16 which was called: # once (4µs+0s) by Foswiki::UI::BEGIN@2 at line 16
use Monitor ();
# spent 4µs making 1 call to Foswiki::UI::View::BEGIN@16
17223µs234µs
# spent 21µs (8+13) within Foswiki::UI::View::BEGIN@17 which was called: # once (8µs+13µs) by Foswiki::UI::BEGIN@2 at line 17
use Assert;
# spent 21µs making 1 call to Foswiki::UI::View::BEGIN@17 # spent 13µs making 1 call to Assert::import
18
19218µs13µs
# spent 3µs within Foswiki::UI::View::BEGIN@19 which was called: # once (3µs+0s) by Foswiki::UI::BEGIN@2 at line 19
use Foswiki ();
# spent 3µs making 1 call to Foswiki::UI::View::BEGIN@19
20219µs13µs
# spent 3µs within Foswiki::UI::View::BEGIN@20 which was called: # once (3µs+0s) by Foswiki::UI::BEGIN@2 at line 20
use Foswiki::UI ();
# spent 3µs making 1 call to Foswiki::UI::View::BEGIN@20
21217µs13µs
# spent 3µs within Foswiki::UI::View::BEGIN@21 which was called: # once (3µs+0s) by Foswiki::UI::BEGIN@2 at line 21
use Foswiki::Sandbox ();
# spent 3µs making 1 call to Foswiki::UI::View::BEGIN@21
22216µs13µs
# spent 3µs within Foswiki::UI::View::BEGIN@22 which was called: # once (3µs+0s) by Foswiki::UI::BEGIN@2 at line 22
use Foswiki::OopsException ();
# spent 3µs making 1 call to Foswiki::UI::View::BEGIN@22
2321.72ms13µs
# spent 3µs within Foswiki::UI::View::BEGIN@23 which was called: # once (3µs+0s) by Foswiki::UI::BEGIN@2 at line 23
use Foswiki::Store ();
# spent 3µs making 1 call to Foswiki::UI::View::BEGIN@23
24
25=begin TML
26
27---++ StaticMethod view( $session )
28
29=view= command handler.
30This method is designed to be
31invoked via the =UI::run= method.
32
33Generate a complete HTML page that represents the viewed topics.
34The view is controlled by CGI parameters as follows:
35
36| =rev= | topic revision to view |
37| =section= | restrict view to a named section |
38| =raw= | no format body text if set |
39| =skin= | comma-separated list of skin(s) to use |
40| =contenttype= | Allows you to specify an alternate content type |
41
42=cut
43
44
# spent 59.6s (660µs+59.6) within Foswiki::UI::View::view which was called: # once (660µs+59.6s) by Foswiki::UI::__ANON__[/var/www/foswiki11/lib/Foswiki/UI.pm:318] at line 316 of /var/www/foswiki11/lib/Foswiki/UI.pm
sub view {
451600ns my $session = shift;
46
471900ns my $query = $session->{request};
481900ns my $web = $session->{webName};
491700ns my $topic = $session->{topicName};
50
511700ns my $cache = $session->{cache};
521200ns my $cachedPage;
531300ns $cachedPage = $cache->getPage( $web, $topic ) if $cache;
541500ns if ($cachedPage) {
55 print STDERR "found $web.$topic in cache\n"
56 if $Foswiki::cfg{Cache}{Debug};
57 Monitor::MARK("found page in cache");
58
59 # render uncacheable areas
60 my $text = $cachedPage->{text};
61 $cache->renderDirtyAreas( \$text ) if $cachedPage->{isDirty};
62
63 # set status
64 my $status = $cachedPage->{status};
65 if ( $status == 302 ) {
66 $session->{response}->redirect( $cachedPage->{location} );
67 }
68 else {
69
70 # See Item9941 to understand why do not set status when 200
71 $session->{response}->status($status) unless $status eq 200;
72 }
73
74 # set headers
75 $session->generateHTTPHeaders( 'view', $cachedPage->{contentType},
76 $text, $cachedPage );
77
78 # send it out
79 $session->{response}->print($text);
80
81 Monitor::MARK('Wrote HTML');
82 $session->logEvent( 'view', $web . '.' . $topic, '(cached)' );
83
84 return;
85 }
86
8711µs print STDERR "computing page for $web.$topic\n"
88 if $Foswiki::cfg{Cache}{Debug};
89
9014µs123µs my $raw = $query->param('raw') || '';
# spent 23µs making 1 call to Foswiki::Request::param
9113µs116µs my $contentType = $query->param('contenttype');
# spent 16µs making 1 call to Foswiki::Request::param
92
931800ns my $logEntry = '';
94
95 # is this view indexable by search engines? Default yes.
961400ns my $indexableView = 1;
971400ns my $viewTemplate;
98
9915µs190µs Foswiki::UI::checkWebExists( $session, $web, 'view' );
# spent 90µs making 1 call to Foswiki::UI::checkWebExists
100
1011200ns my $requestedRev;
10212µs118µs if ( defined $query->param('rev') ) {
# spent 18µs making 1 call to Foswiki::Request::param
103 $requestedRev = Foswiki::Store::cleanUpRevID( $query->param('rev') );
104 unless ($requestedRev) {
105
106 # Invalid request, remove it from the query.
107 $requestedRev = undef;
108 $query->delete('rev');
109 }
110 }
111
11211µs my $showLatest = !$requestedRev;
1131200ns my $showRev;
114
1151100ns my $topicObject; # the stub of the topic we are to display
1161200ns my $text; # the text to display, *not* necessarily
117 # the same as $topicObject->text
1181200ns my $revIt; # Iterator over the range of available revs
1191300ns my $maxRev;
120
12113µs151µs if ( $session->topicExists( $web, $topic ) ) {
# spent 51µs making 1 call to Foswiki::topicExists
122
123 # Load the most recent rev. This *should* be maxRev, but may
124 # not say it is because the TOPICINFO could be up the spout
12514µs1411µs $topicObject = Foswiki::Meta->load( $session, $web, $topic );
# spent 411µs making 1 call to Foswiki::Meta::load
12615µs1946µs Foswiki::UI::checkAccess( $session, 'VIEW', $topicObject );
# spent 946µs making 1 call to Foswiki::UI::checkAccess
127
12817µs1220ms $revIt = $topicObject->getRevisionHistory();
# spent 220ms making 1 call to Foswiki::Meta::getRevisionHistory
129
130 # The topic exists; it must have at least one rev
13116µs16µs ASSERT( $revIt->hasNext() ) if DEBUG;
# spent 6µs making 1 call to Assert::ASSERTS_OFF
13213µs14µs $maxRev = $revIt->next();
# spent 4µs making 1 call to Foswiki::Iterator::NumberRangeIterator::next
133
13411µs if ( defined $requestedRev ) {
135
136 # Is the requested rev id known?
137 $revIt->reset();
138 while ( $revIt->hasNext() ) {
139 if ( $requestedRev eq $revIt->next() ) {
140 $showRev = $requestedRev;
141 last;
142 }
143 }
144
145 # if rev was not found; show max rev
146 $showRev = $maxRev unless ( defined $showRev );
147
148 if ( $showRev ne $maxRev ) {
149
150 # Load the old revision instead
151 $topicObject =
152 Foswiki::Meta->load( $session, $web, $topic, $showRev );
153 if ( !$topicObject->haveAccess('VIEW') ) {
154 throw Foswiki::AccessControlException( 'VIEW',
155 $session->{user}, $web, $topic,
156 $Foswiki::Meta::reason );
157 }
158 $logEntry .= 'r' . $requestedRev;
159 }
160 }
161 else {
1621500ns $showRev = $maxRev;
163 }
164
16519µs149µs if ( my $section = $query->param('section') ) {
# spent 49µs making 1 call to Foswiki::Request::param
166
167 # Apply the 'section' selection (and maybe others in the
168 # future as well). $text is cleared unless a named section
169 # matching the 'section' URL parameter is found.
170 my ( $ntext, $sections ) =
171 Foswiki::parseSections( $topicObject->text() );
172 $text = ''; # in the beginning, there was ... NO section
173 FINDSECTION:
174 for my $s (@$sections) {
175 if ( $s->{type} eq 'section' && $s->{name} eq $section ) {
176 $text =
177 substr( $ntext, $s->{start}, $s->{end} - $s->{start} );
178 last FINDSECTION;
179 }
180 }
181 }
182 else {
183
184 # Otherwise take the full topic text
18516µs114µs $text = $topicObject->text();
# spent 14µs making 1 call to Foswiki::Meta::text
186 }
187 }
188 else { # Topic does not exist yet
189 $topicObject = Foswiki::Meta->new( $session, $web, $topic );
190 $indexableView = 0;
191 $session->enterContext('new_topic');
192 $session->{response}->status(404);
193 $showRev = 1;
194 $maxRev = 0;
195 $viewTemplate = 'TopicDoesNotExistView';
196 $logEntry .= ' (not exist)';
197 $raw = ''; # There is no raw view of a topic that doesn't exist
198 $revIt = new Foswiki::ListIterator( [1] );
199 }
200
2011400ns if ($raw) {
202 $indexableView = 0;
203 $logEntry .= ' raw=' . $raw;
204 if ( $raw eq 'debug' || $raw eq 'all' ) {
205
206 # We want to see the embedded store form
207 $text = $topicObject->getEmbeddedStoreForm();
208 }
209 }
210
2111400ns $text = '' unless defined $text;
212
213116µs3460µs $session->logEvent( 'view', $topicObject->web . '.' . $topicObject->topic,
# spent 450µs making 1 call to Foswiki::logEvent # spent 7µs making 1 call to Foswiki::Meta::web # spent 4µs making 1 call to Foswiki::Meta::topic
214 $logEntry );
215
216 # Note; must enter all contexts before the template is read, as
217 # TMPL:P is expanded on the fly in the template reader. :-(
21812µs my ( $revTitle, $revArg ) = ( '', '' );
21913µs13µs $revIt->reset();
# spent 3µs making 1 call to Foswiki::Iterator::NumberRangeIterator::reset
22013µs13µs if ( $showRev && $showRev != $revIt->next() ) {
# spent 3µs making 1 call to Foswiki::Iterator::NumberRangeIterator::next
221 $session->enterContext('inactive');
222
223 # disable edit of previous revisions
224 $revTitle = '(r' . $showRev . ')';
225 $revArg = '&rev=' . $showRev;
226 }
227
228111µs268µs my $template =
# spent 49µs making 1 call to Foswiki::Prefs::getPreference # spent 19µs making 1 call to Foswiki::Request::param
229 $viewTemplate
230 || $query->param('template')
231 || $session->{prefs}->getPreference('VIEW_TEMPLATE')
232 || 'view';
233
234 # Always use default view template for raw=debug, raw=all and raw=on
23511µs if ( $raw =~ /^(debug|all|on)$/ ) {
236 $template = 'view';
237 }
238
23915µs221.2ms my $tmpl = $session->templates->readTemplate( $template, no_oops => 1 );
# spent 18.6ms making 1 call to Foswiki::Templates::readTemplate # spent 2.66ms making 1 call to Foswiki::templates
240
241 # If the VIEW_TEMPLATE (or other) doesn't exist, default to view.
2421200ns $tmpl = $session->templates->readTemplate('view') unless defined($tmpl);
243
244110µs $tmpl =~ s/%REVTITLE%/$revTitle/g;
24518µs $tmpl =~ s/%REVARG%/$revArg/g;
246
24714µs116µs if ( $indexableView
# spent 16µs making 1 call to Foswiki::Request::param
248 && $Foswiki::cfg{AntiSpam}{RobotsAreWelcome}
249 && !$query->param() )
250 {
251
252 # it's an indexable view type, there are no parameters
253 # on the url, and robots are welcome. Remove the NOINDEX meta tag
254 $tmpl =~ s/<meta name="robots"[^>]*>//goi;
255 }
256
257 # Show revisions around the one being displayed.
258139µs1177ms $tmpl =~ s/%REVISIONS%/
# spent 177ms making 1 call to Foswiki::UI::View::revisionsAround
259 revisionsAround(
260 $session, $topicObject, $requestedRev, $showRev, $maxRev)/e;
261
262 ## SMELL: This is also used in Foswiki::_TOC. Could insert a tag in
263 ## TOC and remove all those here, finding the parameters only once
26412µs my @qparams = ();
265128µs174µs foreach my $name ( $query->param ) {
# spent 74µs making 1 call to Foswiki::Request::param
2662900ns next if ( $name eq 'keywords' );
26722µs next if ( $name eq 'topic' );
26817µs149µs push @qparams, $name => $query->param($name);
# spent 49µs making 1 call to Foswiki::Request::param
269 }
270112µs $tmpl =~ s/%QUERYPARAMSTRING%/Foswiki::_make_params(1,@qparams)/geo;
271
272 # extract header and footer from the template, if there is a
273 # %TEXT% tag marking the split point. The topic text is inserted
274 # in place of the %TEXT% tag. The text before this tag is inserted
275 # as header, the text after is inserted as footer. If there is a
276 # %STARTTEXT% tag present, the header text between %STARTTEXT% and
277 # %TEXT is rendered together, as is the footer text between %TEXT%
278 # and %ENDTEXT%, if present. This allows correct handling of Foswiki
279 # markup in header or footer if those do require examination of the
280 # topic text to work correctly (e.g., %TOC%).
281 # Note: This feature is experimental and may be replaced by an
282 # alternative solution not requiring additional tags.
28313µs my ( $start, $end );
284
285 # SMELL: unchecked implicit untaint of data that *may* be coming from
286 # a topic (topics can be templates)
287183µs if ( $tmpl =~ m/^(.*)%TEXT%(.*)$/s ) {
288128µs my @starts = split( /%STARTTEXT%/, $1 );
28912µs if ( $#starts > 0 ) {
290
291 # we know that there is something before %STARTTEXT%
292 $start = $starts[0];
293 $text = $starts[1] . $text;
294 }
295 else {
29618µs $start = $1;
297 }
298129µs my @ends = split( /%ENDTEXT%/, $2 );
29913µs if ( $#ends > 0 ) {
300
301 # we know that there is something after %ENDTEXT%
302 $text .= $ends[0];
303 $end = $ends[1];
304 }
305 else {
30617µs $end = $2;
307 }
308 }
309 else {
310 my @starts = split( /%STARTTEXT%/, $tmpl );
311 if ( $#starts > 0 ) {
312
313 # we know that there is something before %STARTTEXT%
314 $start = $starts[0];
315 $text = $starts[1];
316 }
317 else {
318 $start = $tmpl;
319 $text = '';
320 }
321 $end = '';
322 }
323
324 # If minimalist is set, images and anchors will be stripped from text
32512µs my $minimalist = 0;
326118µs2352µs if ($contentType) {
# spent 352µs making 2 calls to Foswiki::getSkin, avg 176µs/call
327 $minimalist = ( $session->getSkin() =~ /\brss/ );
328 }
329 elsif ( $session->getSkin() =~ /\brss/ ) {
330 $contentType = 'text/xml';
331 $minimalist = 1;
332 }
333 elsif ( $session->getSkin() =~ /\bxml/ ) {
334 $contentType = 'text/xml';
335 $minimalist = 1;
336 }
337 elsif ( $raw eq 'text' || $raw eq 'all' ) {
338 $contentType = 'text/plain';
339 }
340 else {
34114µs $contentType = 'text/html';
342 }
34317µs1176µs $session->{prefs}->setSessionPreferences(
# spent 176µs making 1 call to Foswiki::Prefs::setSessionPreferences
344 MAXREV => $maxRev,
345 CURRREV => $showRev
346 );
347
348 # Set page generation mode to RSS if using an RSS skin
34915µs1139µs $session->enterContext('rss') if $session->getSkin() =~ /\brss/;
# spent 139µs making 1 call to Foswiki::getSkin
350
3511500ns my $page;
352
353 # Legacy: If the _only_ skin is 'text' it is used like this:
354 # http://.../view/Codev/MyTopic?skin=text&contenttype=text/plain&raw=on
355 # which shows the topic as plain text; useful for those who want
356 # to download plain text for the topic. So when the skin is 'text'
357 # we do _not_ want to create a textarea.
358 # raw=on&skin=text is deprecated; use raw=text instead.
35919µs18µs Monitor::MARK('Ready to render');
36012µs if ( $raw eq 'text'
361 || $raw eq 'all'
362 || ( $raw && $session->getSkin() eq 'text' ) )
363 {
364
365 # use raw text
366 $page = $text;
367 }
368 else {
36912µs my @args = ( $topicObject, $minimalist );
370
37116µs112µs $session->enterContext('header_text');
# spent 12µs making 1 call to Foswiki::enterContext
37214µs1148ms $page = _prepare( $start, @args );
# spent 148ms making 1 call to Foswiki::UI::View::_prepare
37313µs16µs $session->leaveContext('header_text');
# spent 6µs making 1 call to Foswiki::leaveContext
37413µs12µs Monitor::MARK('Rendered header');
375
3761800ns if ($raw) {
377 if ($text) {
378 my $p = $session->{prefs};
379 $page .= CGI::textarea(
380 -readonly => 'readonly',
381 -rows => $p->getPreference('EDITBOXHEIGHT'),
382 -cols => $p->getPreference('EDITBOXWIDTH'),
383 -style => $p->getPreference('EDITBOXSTYLE'),
384 -class => 'foswikiTextarea foswikiTextareaRawView',
385 -id => 'topic',
386 -default => $text
387 );
388 }
389 }
390 else {
39112µs14µs $session->enterContext('body_text');
# spent 4µs making 1 call to Foswiki::enterContext
392115µs149.7s $page .= _prepare( $text, @args );
# spent 49.7s making 1 call to Foswiki::UI::View::_prepare
39315µs19µs $session->leaveContext('body_text');
# spent 9µs making 1 call to Foswiki::leaveContext
394 }
395
39615µs14µs Monitor::MARK('Rendered body');
39713µs14µs $session->enterContext('footer_text');
# spent 4µs making 1 call to Foswiki::enterContext
398124µs19.36s $page .= _prepare( $end, @args );
# spent 9.36s making 1 call to Foswiki::UI::View::_prepare
39916µs112µs $session->leaveContext('footer_text');
# spent 12µs making 1 call to Foswiki::leaveContext
40019µs16µs Monitor::MARK('Rendered footer');
401 }
402
403 # Output has to be done in one go, because if we generate the header and
404 # then redirect because of some later constraint, some browsers fall over
40518µs127.8ms $session->writeCompletePage( $page, 'view', $contentType );
# spent 27.8ms making 1 call to Foswiki::writeCompletePage
406128µs12µs Monitor::MARK('Wrote HTML');
407}
408
409
# spent 59.2s (1.28ms+59.2) within Foswiki::UI::View::_prepare which was called 3 times, avg 19.7s/call: # once (56µs+49.7s) by Foswiki::UI::View::view at line 392 # once (1.05ms+9.36s) by Foswiki::UI::View::view at line 398 # once (177µs+148ms) by Foswiki::UI::View::view at line 372
sub _prepare {
410312µs my ( $text, $topicObject, $minimalist ) = @_;
411
412317µs359.1s $text = $topicObject->expandMacros($text);
# spent 59.1s making 3 calls to Foswiki::Meta::expandMacros, avg 19.7s/call
413315µs358.1ms $text = $topicObject->renderTML($text);
# spent 58.1ms making 3 calls to Foswiki::Meta::renderTML, avg 19.4ms/call
41431.22ms $text =~ s/( ?) *<\/?(nop|noautolink)\/?>\n?/$1/gois;
415
41631µs if ($minimalist) {
417 $text =~ s/<img [^>]*>//gi; # remove image tags
418 $text =~ s/<a [^>]*>//gi; # remove anchor tags
419 $text =~ s/<\/a>//gi; # remove anchor tags
420 }
421
422332µs return $text;
423}
424
425=begin TML
426
427---++ StaticMethod revisionsAround($session, $topicObject, $requestedRev, $showRev, $maxRev) -> $output
428
429Calculate the revisions spanning the current one for display in the bottom
430bar.
431
432=cut
433
434
# spent 177ms (204µs+176) within Foswiki::UI::View::revisionsAround which was called: # once (204µs+176ms) by Foswiki::UI::View::view at line 258
sub revisionsAround {
43512µs my ( $session, $topicObject, $requestedRev, $showRev, $maxRev ) = @_;
436
43713µs my $revsToShow = $Foswiki::cfg{NumberOfRevisions} + 1;
438
439 # Soak up the revision iterator
44013µs1175ms my $revIt = $topicObject->getRevisionHistory();
# spent 175ms making 1 call to Foswiki::Meta::getRevisionHistory
441114µs152µs my @revs = $revIt->all();
# spent 52µs making 1 call to Foswiki::Iterator::all
4421600ns my $maxRevDisjoint = 0;
443
44411µs if ( $Foswiki::cfg{NumberOfRevisions} ) {
445
446 # Locate the preferred rev in the array
4471800ns my $showIndex = $#revs;
4481900ns my $left = 0;
44911µs my $right = $Foswiki::cfg{NumberOfRevisions};
4501500ns if ($requestedRev) {
451 while ( $showIndex && $revs[$showIndex] != $showRev ) {
452 $showIndex--;
453 }
454 $right = $showIndex + $Foswiki::cfg{NumberOfRevisions} - 1;
455 $right = scalar(@revs) if $right > scalar(@revs);
456 $left = $right - $Foswiki::cfg{NumberOfRevisions};
457 if ( $left < 0 ) {
458 $left = 0;
459 $right = $Foswiki::cfg{NumberOfRevisions};
460 }
461 }
4621500ns splice( @revs, $right ) if ( $right < scalar(@revs) );
46311µs splice( @revs, 0, $left );
4641500ns if ( $left > 0 ) {
465
466 # Put the max rev back in at the front, and flag
467 # special treatment
468 $maxRevDisjoint = 1;
469 unshift( @revs, $maxRev );
470 }
471 }
472
4731700ns my $output = '';
4741200ns my $r = 0;
47511µs while ( $r < scalar(@revs) ) {
47639µs if ( $revs[$r] == $showRev ) {
477 $output .= 'r' . $showRev;
478 }
479 else {
480230µs8342µs $output .= CGI::a(
# spent 170µs making 2 calls to CGI::a, avg 85µs/call # spent 159µs making 2 calls to Foswiki::getScriptUrl, avg 80µs/call # spent 7µs making 2 calls to Foswiki::Meta::web, avg 4µs/call # spent 5µs making 2 calls to Foswiki::Meta::topic, avg 3µs/call
481 {
482 href => $session->getScriptUrl(
483 0, 'view',
484 $topicObject->web, $topicObject->topic,
485 rev => $revs[$r]
486 ),
487 rel => 'nofollow'
488 },
489 'r' . $revs[$r]
490 );
491 }
492371µs81.08ms if ( $r == 0 && $maxRevDisjoint ) {
# spent 693µs making 1 call to CGI::AUTOLOAD # spent 280µs making 2 calls to Foswiki::getScriptUrl, avg 140µs/call # spent 86µs making 1 call to CGI::a # spent 12µs making 2 calls to Foswiki::Meta::web, avg 6µs/call # spent 7µs making 2 calls to Foswiki::Meta::topic, avg 4µs/call
493 $output .= ' | ';
494 }
495 elsif ( $r < $#revs ) {
496 $output .= '&nbsp;'
497 . CGI::a(
498 {
499 href => $session->getScriptUrl(
500 0, 'rdiff', $topicObject->web, $topicObject->topic,
501 rev1 => $revs[ $r + 1 ],
502 rev2 => $revs[$r]
503 ),
504 rel => 'nofollow'
505 },
506 '&lt;'
507 ) . '&nbsp;';
508 }
50934µs $r++;
510 }
511124µs return $output;
512}
513
51412µs1;
515__END__