← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 11:58:52 2013
Reported on Tue Oct 15 12:02:24 2013

Filename/usr/share/koha/lib/C4/XSLT.pm
StatementsExecuted 5870 statements in 37.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
251111.5ms1.40sC4::XSLT::::transformMARCXML4XSLTC4::XSLT::transformMARCXML4XSLT
25117.70ms3.36sC4::XSLT::::XSLTParse4DisplayC4::XSLT::XSLTParse4Display
25117.68ms1.72sC4::XSLT::::buildKohaItemsNamespaceC4::XSLT::buildKohaItemsNamespace
1113.35ms5.32msC4::XSLT::::BEGIN@35C4::XSLT::BEGIN@35
100411.60ms1.60msC4::XSLT::::CORE:substC4::XSLT::CORE:subst (opcode)
2511888µs888µsC4::XSLT::::CORE:ftfileC4::XSLT::CORE:ftfile (opcode)
2511843µs7.98msC4::XSLT::::getAuthorisedValues4MARCSubfieldsC4::XSLT::getAuthorisedValues4MARCSubfields
2511724µs1.61msC4::XSLT::::_get_best_default_xslt_filenameC4::XSLT::_get_best_default_xslt_filename
5131229µs229µsC4::XSLT::::CORE:matchC4::XSLT::CORE:match (opcode)
11149µs201µsC4::XSLT::::BEGIN@27C4::XSLT::BEGIN@27
11123µs96µsC4::XSLT::::BEGIN@235C4::XSLT::BEGIN@235
11123µs385µsC4::XSLT::::BEGIN@32C4::XSLT::BEGIN@32
11123µs298µsC4::XSLT::::BEGIN@34C4::XSLT::BEGIN@34
11122µs422µsC4::XSLT::::BEGIN@31C4::XSLT::BEGIN@31
11120µs300µsC4::XSLT::::BEGIN@28C4::XSLT::BEGIN@28
11119µs582µsC4::XSLT::::BEGIN@36C4::XSLT::BEGIN@36
11119µs19µsC4::XSLT::::BEGIN@40C4::XSLT::BEGIN@40
11118µs103µsC4::XSLT::::BEGIN@33C4::XSLT::BEGIN@33
11118µs598µsC4::XSLT::::BEGIN@30C4::XSLT::BEGIN@30
11118µs22µsC4::XSLT::::BEGIN@23C4::XSLT::BEGIN@23
11115µs498µsC4::XSLT::::BEGIN@29C4::XSLT::BEGIN@29
11114µs38µsC4::XSLT::::BEGIN@24C4::XSLT::BEGIN@24
11113µs18µsC4::XSLT::::BEGIN@26C4::XSLT::BEGIN@26
11111µs64µsC4::XSLT::::BEGIN@38C4::XSLT::BEGIN@38
0000s0sC4::XSLT::::GetURIC4::XSLT::GetURI
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package C4::XSLT;
2# Copyright (C) 2006 LibLime
3# <jmf at liblime dot com>
4# Parts Copyright Katrin Fischer 2011
5# Parts Copyright ByWater Solutions 2011
6# Parts Copyright Biblibre 2012
7#
8# This file is part of Koha.
9#
10# Koha is free software; you can redistribute it and/or modify it under the
11# terms of the GNU General Public License as published by the Free Software
12# Foundation; either version 2 of the License, or (at your option) any later
13# version.
14#
15# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License along
20# with Koha; if not, write to the Free Software Foundation, Inc.,
21# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
23328µs226µs
# spent 22µs (18+4) within C4::XSLT::BEGIN@23 which was called: # once (18µs+4µs) by C4::Search::BEGIN@29 at line 23
use strict;
# spent 22µs making 1 call to C4::XSLT::BEGIN@23 # spent 4µs making 1 call to strict::import
24330µs262µs
# spent 38µs (14+24) within C4::XSLT::BEGIN@24 which was called: # once (14µs+24µs) by C4::Search::BEGIN@29 at line 24
use warnings;
# spent 38µs making 1 call to C4::XSLT::BEGIN@24 # spent 24µs making 1 call to warnings::import
25
26328µs224µs
# spent 18µs (13+5) within C4::XSLT::BEGIN@26 which was called: # once (13µs+5µs) by C4::Search::BEGIN@29 at line 26
use C4::Context;
# spent 18µs making 1 call to C4::XSLT::BEGIN@26 # spent 5µs making 1 call to C4::Context::import
27340µs2353µs
# spent 201µs (49+152) within C4::XSLT::BEGIN@27 which was called: # once (49µs+152µs) by C4::Search::BEGIN@29 at line 27
use C4::Branch;
# spent 201µs making 1 call to C4::XSLT::BEGIN@27 # spent 152µs making 1 call to Exporter::import
28340µs2581µs
# spent 300µs (20+281) within C4::XSLT::BEGIN@28 which was called: # once (20µs+281µs) by C4::Search::BEGIN@29 at line 28
use C4::Items;
# spent 300µs making 1 call to C4::XSLT::BEGIN@28 # spent 281µs making 1 call to Exporter::import
29337µs2981µs
# spent 498µs (15+483) within C4::XSLT::BEGIN@29 which was called: # once (15µs+483µs) by C4::Search::BEGIN@29 at line 29
use C4::Koha;
# spent 498µs making 1 call to C4::XSLT::BEGIN@29 # spent 483µs making 1 call to Exporter::import
30340µs21.18ms
# spent 598µs (18+580) within C4::XSLT::BEGIN@30 which was called: # once (18µs+580µs) by C4::Search::BEGIN@29 at line 30
use C4::Biblio;
# spent 598µs making 1 call to C4::XSLT::BEGIN@30 # spent 580µs making 1 call to Exporter::import
31359µs2822µs
# spent 422µs (22+400) within C4::XSLT::BEGIN@31 which was called: # once (22µs+400µs) by C4::Search::BEGIN@29 at line 31
use C4::Circulation;
# spent 422µs making 1 call to C4::XSLT::BEGIN@31 # spent 400µs making 1 call to Exporter::import
32343µs2747µs
# spent 385µs (23+362) within C4::XSLT::BEGIN@32 which was called: # once (23µs+362µs) by C4::Search::BEGIN@29 at line 32
use C4::Reserves;
# spent 385µs making 1 call to C4::XSLT::BEGIN@32 # spent 362µs making 1 call to Exporter::import
33351µs2188µs
# spent 103µs (18+85) within C4::XSLT::BEGIN@33 which was called: # once (18µs+85µs) by C4::Search::BEGIN@29 at line 33
use Encode;
# spent 103µs making 1 call to C4::XSLT::BEGIN@33 # spent 85µs making 1 call to Exporter::import
34348µs2572µs
# spent 298µs (23+275) within C4::XSLT::BEGIN@34 which was called: # once (23µs+275µs) by C4::Search::BEGIN@29 at line 34
use XML::LibXML;
# spent 298µs making 1 call to C4::XSLT::BEGIN@34 # spent 275µs making 1 call to XML::LibXML::import
353182µs15.32ms
# spent 5.32ms (3.35+1.96) within C4::XSLT::BEGIN@35 which was called: # once (3.35ms+1.96ms) by C4::Search::BEGIN@29 at line 35
use XML::LibXSLT;
# spent 5.32ms making 1 call to C4::XSLT::BEGIN@35
36349µs21.15ms
# spent 582µs (19+563) within C4::XSLT::BEGIN@36 which was called: # once (19µs+563µs) by C4::Search::BEGIN@29 at line 36
use LWP::Simple;
# spent 582µs making 1 call to C4::XSLT::BEGIN@36 # spent 563µs making 1 call to LWP::Simple::import
37
38361µs2118µs
# spent 64µs (11+53) within C4::XSLT::BEGIN@38 which was called: # once (11µs+53µs) by C4::Search::BEGIN@29 at line 38
use vars qw($VERSION @ISA @EXPORT);
# spent 64µs making 1 call to C4::XSLT::BEGIN@38 # spent 53µs making 1 call to vars::import
39
40
# spent 19µs within C4::XSLT::BEGIN@40 which was called: # once (19µs+0s) by C4::Search::BEGIN@29 at line 48
BEGIN {
411800ns require Exporter;
4211µs $VERSION = 3.07.00.049;
43110µs @ISA = qw(Exporter);
4416µs @EXPORT = qw(
45 &XSLTParse4Display
46 &GetURI
47 );
4811.02ms119µs}
# spent 19µs making 1 call to C4::XSLT::BEGIN@40
49
50=head1 NAME
51
- -
62sub GetURI {
63 my ($uri) = @_;
64 my $string;
65 $string = get $uri ;
66 return $string;
67}
68
69=head2 transformMARCXML4XSLT
70
- -
75
# spent 1.40s (11.5ms+1.39) within C4::XSLT::transformMARCXML4XSLT which was called 25 times, avg 55.9ms/call: # 25 times (11.5ms+1.39s) by C4::XSLT::XSLTParse4Display at line 197, avg 55.9ms/call
sub transformMARCXML4XSLT {
762556µs my ($biblionumber, $record) = @_;
7725230µs10058.4ms my $frameworkcode = GetFrameworkCode($biblionumber) || '';
# spent 57.9ms making 25 calls to C4::Biblio::GetFrameworkCode, avg 2.31ms/call # spent 407µs making 50 calls to DBI::common::DESTROY, avg 8µs/call # spent 94µs making 25 calls to DBD::_mem::common::DESTROY, avg 4µs/call
7825183µs34501ms my $tagslib = &GetMarcStructure(1,$frameworkcode);
# spent 501ms making 25 calls to C4::Biblio::GetMarcStructure, avg 20.0ms/call # spent 99µs making 6 calls to DBI::common::DESTROY, avg 16µs/call # spent 18µs making 3 calls to DBD::_mem::common::DESTROY, avg 6µs/call
792519µs my @fields;
80 # FIXME: wish there was a better way to handle exceptions
8125142µs eval {
8225421µs25509µs @fields = $record->fields();
# spent 509µs making 25 calls to MARC::Record::fields, avg 20µs/call
83 };
842517µs if ($@) { warn "PROBLEM WITH RECORD"; next; }
8525195µs257.98ms my $av = getAuthorisedValues4MARCSubfields($frameworkcode);
# spent 7.98ms making 25 calls to C4::XSLT::getAuthorisedValues4MARCSubfields, avg 319µs/call
8625177µs foreach my $tag ( keys %$av ) {
8750527µs5017.3ms foreach my $field ( $record->field( $tag ) ) {
# spent 17.3ms making 50 calls to MARC::Record::field, avg 346µs/call
8857435µs if ( $av->{ $tag } ) {
895764µs my @new_subfields = ();
90571.11ms573.50ms for my $subfield ( $field->subfields() ) {
# spent 3.50ms making 57 calls to MARC::Field::subfields, avg 61µs/call
916361.05ms my ( $letter, $value ) = @$subfield;
926363.03ms817792ms $value = GetAuthorisedValueDesc( $tag, $letter, $value, '', $tagslib )
# spent 790ms making 295 calls to C4::Biblio::GetAuthorisedValueDesc, avg 2.68ms/call # spent 1.87ms making 348 calls to DBI::common::DESTROY, avg 5µs/call # spent 485µs making 174 calls to DBD::_mem::common::DESTROY, avg 3µs/call
93 if $av->{ $tag }->{ $letter };
946361.82ms push( @new_subfields, $letter, $value );
95 }
96571.33ms2288.78ms $field ->replace_with( MARC::Field->new(
# spent 5.00ms making 57 calls to MARC::Field::new, avg 88µs/call # spent 1.99ms making 114 calls to MARC::Field::indicator, avg 17µs/call # spent 1.79ms making 57 calls to MARC::Field::replace_with, avg 31µs/call
97 $tag,
98 $field->indicator(1),
99 $field->indicator(2),
100 @new_subfields
101 ) );
102 }
103 }
104 }
10525251µs return $record;
106}
107
108=head2 getAuthorisedValues4MARCSubfields
109
- -
114# Cache for tagfield-tagsubfield to decode per framework.
115# Should be preferably be placed in Koha-core...
1161300nsmy %authval_per_framework;
117
118
# spent 7.98ms (843µs+7.14) within C4::XSLT::getAuthorisedValues4MARCSubfields which was called 25 times, avg 319µs/call: # 25 times (843µs+7.14ms) by C4::XSLT::transformMARCXML4XSLT at line 85, avg 319µs/call
sub getAuthorisedValues4MARCSubfields {
1192545µs my ($frameworkcode) = @_;
1202552µs977µs unless ( $authval_per_framework{ $frameworkcode } ) {
# spent 65µs making 6 calls to DBI::common::DESTROY, avg 11µs/call # spent 12µs making 3 calls to DBD::_mem::common::DESTROY, avg 4µs/call
121329µs33.36ms my $dbh = C4::Context->dbh;
# spent 3.36ms making 3 calls to C4::Context::dbh, avg 1.12ms/call
122375µs6658µs my $sth = $dbh->prepare("SELECT DISTINCT tagfield, tagsubfield
# spent 356µs making 3 calls to DBI::db::prepare, avg 119µs/call # spent 302µs making 3 calls to DBD::mysql::db::prepare, avg 101µs/call
123 FROM marc_subfield_structure
124 WHERE authorised_value IS NOT NULL
125 AND authorised_value!=''
126 AND frameworkcode=?");
12733.01ms32.95ms $sth->execute( $frameworkcode );
# spent 2.95ms making 3 calls to DBI::st::execute, avg 985µs/call
12838µs my $av = { };
1293721µs44393µs while ( my ( $tag, $letter ) = $sth->fetchrow() ) {
# spent 393µs making 44 calls to DBI::st::fetchrow, avg 9µs/call
130 $av->{ $tag }->{ $letter } = 1;
131 }
1323182µs $authval_per_framework{ $frameworkcode } = $av;
133 }
13425152µs return $authval_per_framework{ $frameworkcode };
135}
136
1371200nsmy $stylesheet;
138
139
# spent 1.61ms (724µs+888µs) within C4::XSLT::_get_best_default_xslt_filename which was called 25 times, avg 64µs/call: # 25 times (724µs+888µs) by C4::XSLT::XSLTParse4Display at line 188, avg 64µs/call
sub _get_best_default_xslt_filename {
1402550µs my ($htdocs, $theme, $lang, $base_xslfile) = @_;
141
14225285µs my @candidates = (
143 "$htdocs/$theme/$lang/xslt/${base_xslfile}", # exact match
144 "$htdocs/$theme/en/xslt/${base_xslfile}", # if not, preferred theme in English
145 "$htdocs/prog/$lang/xslt/${base_xslfile}", # if not, 'prog' theme in preferred language
146 "$htdocs/prog/en/xslt/${base_xslfile}", # otherwise, prog theme in English; should always
147 # exist
148 );
1492510µs my $xslfilename;
1502535µs foreach my $filename (@candidates) {
1512514µs $xslfilename = $filename;
152251.03ms25888µs if (-f $filename) {
# spent 888µs making 25 calls to C4::XSLT::CORE:ftfile, avg 36µs/call
1532559µs last; # we have a winner!
154 }
155 }
15625149µs return $xslfilename;
157}
158
159
# spent 3.36s (7.70ms+3.35) within C4::XSLT::XSLTParse4Display which was called 25 times, avg 134ms/call: # 25 times (7.70ms+3.35s) by C4::Search::searchResults at line 2014 of /usr/share/koha/lib/C4/Search.pm, avg 134ms/call
sub XSLTParse4Display {
1602556µs my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_;
1612585µs2576µs my $xslfilename = C4::Context->preference($xslsyspref);
# spent 76µs making 25 calls to C4::Context::preference, avg 3µs/call
16225291µs25153µs if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
# spent 153µs making 25 calls to C4::XSLT::CORE:match, avg 6µs/call
1632512µs my $htdocs;
164259µs my $theme;
16525160µs25162µs my $lang = C4::Templates::_current_language();
# spent 162µs making 25 calls to C4::Templates::_current_language, avg 6µs/call
166259µs my $xslfile;
1672596µs if ($xslsyspref eq "XSLTDetailsDisplay") {
168 $htdocs = C4::Context->config('intrahtdocs');
169 $theme = C4::Context->preference("template");
170 $xslfile = C4::Context->preference('marcflavour') .
171 "slim2intranetDetail.xsl";
172 } elsif ($xslsyspref eq "XSLTResultsDisplay") {
173 $htdocs = C4::Context->config('intrahtdocs');
174 $theme = C4::Context->preference("template");
175 $xslfile = C4::Context->preference('marcflavour') .
176 "slim2intranetResults.xsl";
177 } elsif ($xslsyspref eq "OPACXSLTDetailsDisplay") {
178 $htdocs = C4::Context->config('opachtdocs');
179 $theme = C4::Context->preference("opacthemes");
180 $xslfile = C4::Context->preference('marcflavour') .
181 "slim2OPACDetail.xsl";
182 } elsif ($xslsyspref eq "OPACXSLTResultsDisplay") {
18325155µs25705µs $htdocs = C4::Context->config('opachtdocs');
# spent 705µs making 25 calls to C4::Context::config, avg 28µs/call
18425131µs25135µs $theme = C4::Context->preference("opacthemes");
# spent 135µs making 25 calls to C4::Context::preference, avg 5µs/call
1852578µs25128µs $xslfile = C4::Context->preference('marcflavour') .
# spent 128µs making 25 calls to C4::Context::preference, avg 5µs/call
186 "slim2OPACResults.xsl";
187 }
18825101µs251.61ms $xslfilename = _get_best_default_xslt_filename($htdocs, $theme, $lang, $xslfile);
# spent 1.61ms making 25 calls to C4::XSLT::_get_best_default_xslt_filename, avg 64µs/call
189 }
190
19125141µs2573µs if ( $xslfilename =~ m/\{langcode\}/ ) {
# spent 73µs making 25 calls to C4::XSLT::CORE:match, avg 3µs/call
192 my $lang = C4::Templates::_current_language();
193 $xslfilename =~ s/\{langcode\}/$lang/;
194 }
195
196 # grab the XML, run it through our stylesheet, push it out to the browser
19725164µs251.40s my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
# spent 1.40s making 25 calls to C4::XSLT::transformMARCXML4XSLT, avg 55.9ms/call
198 #return $record->as_formatted();
19925194µs251.72s my $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items);
# spent 1.72s making 25 calls to C4::XSLT::buildKohaItemsNamespace, avg 68.8ms/call
20025458µs50105ms my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
# spent 104ms making 25 calls to MARC::Record::as_xml, avg 4.17ms/call # spent 343µs making 25 calls to C4::Context::preference, avg 14µs/call
2012529µs my $sysxml = "<sysprefs>\n";
20225113µs foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
203 DisplayOPACiconsXSLT URLLinkText viewISBD
204 OPACBaseURL TraceCompleteSubfields UseICU
205 UseAuthoritiesForTracings TraceSubjectSubdivisions
206 Display856uAsImage OPACDisplay856uAsImage
207 UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
208 singleBranchMode OPACItemLocation DisplayIconsXSLT
209 AlternateHoldingsField AlternateHoldingsSeparator
210 TrackClicks OpacResultsItemtypeImage/ )
211 {
2125501.50ms55041.9ms my $sp = C4::Context->preference( $syspref );
# spent 41.9ms making 550 calls to C4::Context::preference, avg 76µs/call
213550186µs next unless defined($sp);
214525829µs $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
215 }
2162522µs $sysxml .= "</sysprefs>\n";
21725789µs25634µs $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
# spent 634µs making 25 calls to C4::XSLT::CORE:subst, avg 25µs/call
2182532µs if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
21925345µs25257µs $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
# spent 257µs making 25 calls to C4::XSLT::CORE:subst, avg 10µs/call
220 }
22125463µs25398µs $xmlrecord =~ s/\& /\&amp\; /;
# spent 398µs making 25 calls to C4::XSLT::CORE:subst, avg 16µs/call
22225383µs25313µs $xmlrecord =~ s/\&amp\;amp\; /\&amp\; /;
# spent 313µs making 25 calls to C4::XSLT::CORE:subst, avg 13µs/call
223
22425216µs25687µs my $parser = XML::LibXML->new();
# spent 687µs making 25 calls to XML::LibXML::new, avg 27µs/call
225 # don't die when you find &, >, etc
22625153µs251.05ms $parser->recover_silently(0);
# spent 1.05ms making 25 calls to XML::LibXML::recover_silently, avg 42µs/call
22725162µs2513.7ms my $source = $parser->parse_string($xmlrecord);
# spent 13.7ms making 25 calls to XML::LibXML::parse_string, avg 547µs/call
2282590µs2555µs unless ( $stylesheet->{$xslfilename} ) {
# spent 290µs making 1 call to XML::LibXML::Node::DESTROY # spent 265µs making 1 call to AutoLoader::AUTOLOAD
22919µs120µs my $xslt = XML::LibXSLT->new();
# spent 20µs making 1 call to XML::LibXSLT::new
2301400ns my $style_doc;
23119µs13µs if ( $xslfilename =~ /^https?:\/\// ) {
# spent 3µs making 1 call to C4::XSLT::CORE:match
232 my $xsltstring = GetURI($xslfilename);
233 $style_doc = $parser->parse_string($xsltstring);
234 } else {
2353542µs2168µs
# spent 96µs (23+73) within C4::XSLT::BEGIN@235 which was called: # once (23µs+73µs) by C4::Search::BEGIN@29 at line 235
use Cwd;
# spent 96µs making 1 call to C4::XSLT::BEGIN@235 # spent 73µs making 1 call to Exporter::import
23614µs11.53ms $style_doc = $parser->parse_file($xslfilename);
# spent 1.53ms making 1 call to XML::LibXML::parse_file
237 }
2381334µs115.0ms $stylesheet->{$xslfilename} = $xslt->parse_stylesheet($style_doc);
# spent 15.0ms making 1 call to XML::LibXSLT::parse_stylesheet
239 }
24025195µs2550.4ms my $results = $stylesheet->{$xslfilename}->transform($source);
# spent 50.4ms making 25 calls to XML::LibXSLT::StylesheetWrapper::transform, avg 2.02ms/call
24125180µs251.72ms my $newxmlrecord = $stylesheet->{$xslfilename}->output_string($results);
# spent 1.72ms making 25 calls to XML::LibXSLT::StylesheetWrapper::output_string, avg 69µs/call
242252.17ms return $newxmlrecord;
243}
244
245
# spent 1.72s (7.68ms+1.71) within C4::XSLT::buildKohaItemsNamespace which was called 25 times, avg 68.8ms/call: # 25 times (7.68ms+1.71s) by C4::XSLT::XSLTParse4Display at line 199, avg 68.8ms/call
sub buildKohaItemsNamespace {
2462548µs my ($biblionumber, $hidden_items) = @_;
247
24825335µs250833ms my @items = C4::Items::GetItemsInfo($biblionumber);
# spent 832ms making 25 calls to C4::Items::GetItemsInfo, avg 33.3ms/call # spent 1.19ms making 150 calls to DBI::common::DESTROY, avg 8µs/call # spent 358µs making 75 calls to DBD::_mem::common::DESTROY, avg 5µs/call
2492561µs if ($hidden_items && @$hidden_items) {
250 my %hi = map {$_ => 1} @$hidden_items;
251 @items = grep { !$hi{$_->{itemnumber}} } @items;
252 }
253
25425430µs200171ms my $shelflocations = GetKohaAuthorisedValues('items.location',GetFrameworkCode($biblionumber), 'opac');
# spent 115ms making 25 calls to C4::Koha::GetKohaAuthorisedValues, avg 4.60ms/call # spent 55.7ms making 25 calls to C4::Biblio::GetFrameworkCode, avg 2.23ms/call # spent 638µs making 100 calls to DBI::common::DESTROY, avg 6µs/call # spent 173µs making 50 calls to DBD::_mem::common::DESTROY, avg 3µs/call
25525351µs200158ms my $ccodes = GetKohaAuthorisedValues('items.ccode',GetFrameworkCode($biblionumber), 'opac');
# spent 107ms making 25 calls to C4::Koha::GetKohaAuthorisedValues, avg 4.27ms/call # spent 50.6ms making 25 calls to C4::Biblio::GetFrameworkCode, avg 2.03ms/call # spent 625µs making 100 calls to DBI::common::DESTROY, avg 6µs/call # spent 149µs making 50 calls to DBD::_mem::common::DESTROY, avg 3µs/call
256
25725268µs175336ms my $branches = GetBranches();
# spent 335ms making 25 calls to C4::Branch::GetBranches, avg 13.4ms/call # spent 668µs making 100 calls to DBI::common::DESTROY, avg 7µs/call # spent 246µs making 50 calls to DBD::_mem::common::DESTROY, avg 5µs/call
25825213µs10078.1ms my $itemtypes = GetItemTypes();
# spent 77.7ms making 25 calls to C4::Koha::GetItemTypes, avg 3.11ms/call # spent 257µs making 50 calls to DBI::common::DESTROY, avg 5µs/call # spent 88µs making 25 calls to DBD::_mem::common::DESTROY, avg 4µs/call
2592536µs my $location = "";
2602528µs my $ccode = "";
2612520µs my $xml = '';
2622596µs for my $item (@items) {
2633213µs my $status;
264
26532348µs12869.8ms my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber});
# spent 69.5ms making 32 calls to C4::Circulation::GetTransfers, avg 2.17ms/call # spent 276µs making 64 calls to DBI::common::DESTROY, avg 4µs/call # spent 84µs making 32 calls to DBD::_mem::common::DESTROY, avg 3µs/call
266
26732475µs12868.5ms my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
# spent 68.1ms making 32 calls to C4::Reserves::GetReserveStatus, avg 2.13ms/call # spent 329µs making 64 calls to DBI::common::DESTROY, avg 5µs/call # spent 97µs making 32 calls to DBD::_mem::common::DESTROY, avg 3µs/call
268
26932444µs if ( $itemtypes->{ $item->{itype} }->{notforloan} || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} ||
270 (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){
27117µs if ( $item->{notforloan} < 0) {
272 $status = "On order";
273 }
274111µs if ( $item->{itemnotforloan} > 0 || $item->{notforloan} > 0 || $itemtypes->{ $item->{itype} }->{notforloan} == 1 ) {
275 $status = "reference";
276 }
27712µs if ($item->{onloan}) {
278 $status = "Checked out";
279 }
28012µs if ( $item->{wthdrawn}) {
281 $status = "Withdrawn";
282 }
28312µs if ($item->{itemlost}) {
284 $status = "Lost";
285 }
28612µs if ($item->{damaged}) {
287 $status = "Damaged";
288 }
28911µs if (defined $transfertwhen && $transfertwhen ne '') {
290 $status = 'In transit';
291 }
29213µs if (defined $reservestatus && $reservestatus eq "Waiting") {
293 $status = 'Waiting';
294 }
295 } else {
2963149µs $status = "available";
297 }
29832370µs321.08ms my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):'';
# spent 1.08ms making 32 calls to C4::Koha::xml_escape, avg 34µs/call
29932187µs32526µs my $holdingbranch = $item->{holdingbranch}? xml_escape($branches->{$item->{holdingbranch}}->{'branchname'}):'';
# spent 526µs making 32 calls to C4::Koha::xml_escape, avg 16µs/call
30032144µs17266µs $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):'';
# spent 266µs making 17 calls to C4::Koha::xml_escape, avg 16µs/call
3013269µs110µs $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):'';
# spent 10µs making 1 call to C4::Koha::xml_escape
30232159µs32376µs my $itemcallnumber = xml_escape($item->{itemcallnumber});
# spent 376µs making 32 calls to C4::Koha::xml_escape, avg 12µs/call
30332323µs $xml.= "<item><homebranch>$homebranch</homebranch>".
304 "<holdingbranch>$holdingbranch</holdingbranch>".
305 "<location>$location</location>".
306 "<ccode>$ccode</ccode>".
307 "<status>$status</status>".
308 "<itemcallnumber>".$itemcallnumber."</itemcallnumber>"
309 . "</item>";
310
311 }
3122545µs $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>";
313253.41ms return $xml;
314}
315
- -
31815µs1;
319__END__
 
# spent 888µs within C4::XSLT::CORE:ftfile which was called 25 times, avg 36µs/call: # 25 times (888µs+0s) by C4::XSLT::_get_best_default_xslt_filename at line 152, avg 36µs/call
sub C4::XSLT::CORE:ftfile; # opcode
# spent 229µs within C4::XSLT::CORE:match which was called 51 times, avg 4µs/call: # 25 times (153µs+0s) by C4::XSLT::XSLTParse4Display at line 162, avg 6µs/call # 25 times (73µs+0s) by C4::XSLT::XSLTParse4Display at line 191, avg 3µs/call # once (3µs+0s) by C4::XSLT::XSLTParse4Display at line 231
sub C4::XSLT::CORE:match; # opcode
# spent 1.60ms within C4::XSLT::CORE:subst which was called 100 times, avg 16µs/call: # 25 times (634µs+0s) by C4::XSLT::XSLTParse4Display at line 217, avg 25µs/call # 25 times (398µs+0s) by C4::XSLT::XSLTParse4Display at line 221, avg 16µs/call # 25 times (313µs+0s) by C4::XSLT::XSLTParse4Display at line 222, avg 13µs/call # 25 times (257µs+0s) by C4::XSLT::XSLTParse4Display at line 219, avg 10µs/call
sub C4::XSLT::CORE:subst; # opcode