← 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:01:50 2013

Filename/usr/lib/perl5/Net/Z3950/ZOOM.pm
StatementsExecuted 1427 statements in 14.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
121157.9ms57.9msNet::Z3950::ZOOM::::eventNet::Z3950::ZOOM::event (xsub)
2001113.6ms13.6msNet::Z3950::ZOOM::::resultset_recordNet::Z3950::ZOOM::resultset_record (xsub)
200116.77ms6.77msNet::Z3950::ZOOM::::record_get_binaryNet::Z3950::ZOOM::record_get_binary (xsub)
200112.47ms9.49msNet::Z3950::ZOOM::::record_getNet::Z3950::ZOOM::record_get
1111.89ms1.89msNet::Z3950::ZOOM::::query_ccl2rpnNet::Z3950::ZOOM::query_ccl2rpn (xsub)
20211644µs644µsNet::Z3950::ZOOM::::connection_error_xNet::Z3950::ZOOM::connection_error_x (xsub)
20011243µs243µsNet::Z3950::ZOOM::::CORE:substNet::Z3950::ZOOM::CORE:subst (opcode)
11194µs94µsNet::Z3950::ZOOM::::connection_createNet::Z3950::ZOOM::connection_create (xsub)
11170µs70µsNet::Z3950::ZOOM::::yaz_log_mask_strNet::Z3950::ZOOM::yaz_log_mask_str (xsub)
11170µs70µsNet::Z3950::ZOOM::::resultset_destroyNet::Z3950::ZOOM::resultset_destroy (xsub)
11163µs63µsNet::Z3950::ZOOM::::BEGIN@3Net::Z3950::ZOOM::BEGIN@3
11162µs62µsNet::Z3950::ZOOM::::options_createNet::Z3950::ZOOM::options_create (xsub)
11158µs58µsNet::Z3950::ZOOM::::connection_searchNet::Z3950::ZOOM::connection_search (xsub)
111136µs36µsNet::Z3950::ZOOM::::connection_last_eventNet::Z3950::ZOOM::connection_last_event (xsub)
81132µs32µsNet::Z3950::ZOOM::::options_setNet::Z3950::ZOOM::options_set (xsub)
81126µs26µsNet::Z3950::ZOOM::::options_getNet::Z3950::ZOOM::options_get (xsub)
11125µs25µsNet::Z3950::ZOOM::::connection_connectNet::Z3950::ZOOM::connection_connect (xsub)
111120µs20µsNet::Z3950::ZOOM::::EVENT_ENDNet::Z3950::ZOOM::EVENT_END
11118µs18µsNet::Z3950::ZOOM::::query_createNet::Z3950::ZOOM::query_create (xsub)
11114µs14µsNet::Z3950::ZOOM::::resultset_sizeNet::Z3950::ZOOM::resultset_size (xsub)
31114µs14µsNet::Z3950::ZOOM::::connection_option_getNet::Z3950::ZOOM::connection_option_get (xsub)
11114µs19µsNet::Z3950::ZOOM::::BEGIN@4Net::Z3950::ZOOM::BEGIN@4
11113µs13µsNet::Z3950::ZOOM::::yaz_versionNet::Z3950::ZOOM::yaz_version (xsub)
11113µs36µsNet::Z3950::ZOOM::::BEGIN@5Net::Z3950::ZOOM::BEGIN@5
1116µs6µsNet::Z3950::ZOOM::::connection_errcodeNet::Z3950::ZOOM::connection_errcode (xsub)
1115µs5µsNet::Z3950::ZOOM::::connection_option_setNet::Z3950::ZOOM::connection_option_set (xsub)
0000s0sNet::Z3950::ZOOM::::CCL_ERR_BAD_RELATIONNet::Z3950::ZOOM::CCL_ERR_BAD_RELATION
0000s0sNet::Z3950::ZOOM::::CCL_ERR_BAD_RPNet::Z3950::ZOOM::CCL_ERR_BAD_RP
0000s0sNet::Z3950::ZOOM::::CCL_ERR_DOUBLE_QUALNet::Z3950::ZOOM::CCL_ERR_DOUBLE_QUAL
0000s0sNet::Z3950::ZOOM::::CCL_ERR_EQ_EXPECTEDNet::Z3950::ZOOM::CCL_ERR_EQ_EXPECTED
0000s0sNet::Z3950::ZOOM::::CCL_ERR_OKNet::Z3950::ZOOM::CCL_ERR_OK
0000s0sNet::Z3950::ZOOM::::CCL_ERR_OP_EXPECTEDNet::Z3950::ZOOM::CCL_ERR_OP_EXPECTED
0000s0sNet::Z3950::ZOOM::::CCL_ERR_RP_EXPECTEDNet::Z3950::ZOOM::CCL_ERR_RP_EXPECTED
0000s0sNet::Z3950::ZOOM::::CCL_ERR_SETNAME_EXPECTEDNet::Z3950::ZOOM::CCL_ERR_SETNAME_EXPECTED
0000s0sNet::Z3950::ZOOM::::CCL_ERR_TERM_EXPECTEDNet::Z3950::ZOOM::CCL_ERR_TERM_EXPECTED
0000s0sNet::Z3950::ZOOM::::CCL_ERR_TRUNC_NOT_BOTHNet::Z3950::ZOOM::CCL_ERR_TRUNC_NOT_BOTH
0000s0sNet::Z3950::ZOOM::::CCL_ERR_TRUNC_NOT_LEFTNet::Z3950::ZOOM::CCL_ERR_TRUNC_NOT_LEFT
0000s0sNet::Z3950::ZOOM::::CCL_ERR_TRUNC_NOT_RIGHTNet::Z3950::ZOOM::CCL_ERR_TRUNC_NOT_RIGHT
0000s0sNet::Z3950::ZOOM::::CCL_ERR_UNKNOWN_QUALNet::Z3950::ZOOM::CCL_ERR_UNKNOWN_QUAL
0000s0sNet::Z3950::ZOOM::::ERROR_CCL_CONFIGNet::Z3950::ZOOM::ERROR_CCL_CONFIG
0000s0sNet::Z3950::ZOOM::::ERROR_CCL_PARSENet::Z3950::ZOOM::ERROR_CCL_PARSE
0000s0sNet::Z3950::ZOOM::::ERROR_CONNECTNet::Z3950::ZOOM::ERROR_CONNECT
0000s0sNet::Z3950::ZOOM::::ERROR_CONNECTION_LOSTNet::Z3950::ZOOM::ERROR_CONNECTION_LOST
0000s0sNet::Z3950::ZOOM::::ERROR_CQL_PARSENet::Z3950::ZOOM::ERROR_CQL_PARSE
0000s0sNet::Z3950::ZOOM::::ERROR_CQL_TRANSFORMNet::Z3950::ZOOM::ERROR_CQL_TRANSFORM
0000s0sNet::Z3950::ZOOM::::ERROR_DECODENet::Z3950::ZOOM::ERROR_DECODE
0000s0sNet::Z3950::ZOOM::::ERROR_ENCODENet::Z3950::ZOOM::ERROR_ENCODE
0000s0sNet::Z3950::ZOOM::::ERROR_INITNet::Z3950::ZOOM::ERROR_INIT
0000s0sNet::Z3950::ZOOM::::ERROR_INTERNALNet::Z3950::ZOOM::ERROR_INTERNAL
0000s0sNet::Z3950::ZOOM::::ERROR_INVALID_QUERYNet::Z3950::ZOOM::ERROR_INVALID_QUERY
0000s0sNet::Z3950::ZOOM::::ERROR_MEMORYNet::Z3950::ZOOM::ERROR_MEMORY
0000s0sNet::Z3950::ZOOM::::ERROR_NONENet::Z3950::ZOOM::ERROR_NONE
0000s0sNet::Z3950::ZOOM::::ERROR_TIMEOUTNet::Z3950::ZOOM::ERROR_TIMEOUT
0000s0sNet::Z3950::ZOOM::::ERROR_UNSUPPORTED_PROTOCOLNet::Z3950::ZOOM::ERROR_UNSUPPORTED_PROTOCOL
0000s0sNet::Z3950::ZOOM::::ERROR_UNSUPPORTED_QUERYNet::Z3950::ZOOM::ERROR_UNSUPPORTED_QUERY
0000s0sNet::Z3950::ZOOM::::EVENT_CONNECTNet::Z3950::ZOOM::EVENT_CONNECT
0000s0sNet::Z3950::ZOOM::::EVENT_NONENet::Z3950::ZOOM::EVENT_NONE
0000s0sNet::Z3950::ZOOM::::EVENT_RECV_APDUNet::Z3950::ZOOM::EVENT_RECV_APDU
0000s0sNet::Z3950::ZOOM::::EVENT_RECV_DATANet::Z3950::ZOOM::EVENT_RECV_DATA
0000s0sNet::Z3950::ZOOM::::EVENT_RECV_RECORDNet::Z3950::ZOOM::EVENT_RECV_RECORD
0000s0sNet::Z3950::ZOOM::::EVENT_RECV_SEARCHNet::Z3950::ZOOM::EVENT_RECV_SEARCH
0000s0sNet::Z3950::ZOOM::::EVENT_SEND_APDUNet::Z3950::ZOOM::EVENT_SEND_APDU
0000s0sNet::Z3950::ZOOM::::EVENT_SEND_DATANet::Z3950::ZOOM::EVENT_SEND_DATA
0000s0sNet::Z3950::ZOOM::::EVENT_TIMEOUTNet::Z3950::ZOOM::EVENT_TIMEOUT
0000s0sNet::Z3950::ZOOM::::EVENT_UNKNOWNNet::Z3950::ZOOM::EVENT_UNKNOWN
0000s0sNet::Z3950::ZOOM::::event_strNet::Z3950::ZOOM::event_str
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Net::Z3950::ZOOM;
2
3380µs163µs
# spent 63µs within Net::Z3950::ZOOM::BEGIN@3 which was called: # once (63µs+0s) by C4::Context::BEGIN@4 at line 3
use 5.008;
# spent 63µs making 1 call to Net::Z3950::ZOOM::BEGIN@3
4329µs225µs
# spent 19µs (14+6) within Net::Z3950::ZOOM::BEGIN@4 which was called: # once (14µs+6µs) by C4::Context::BEGIN@4 at line 4
use strict;
# spent 19µs making 1 call to Net::Z3950::ZOOM::BEGIN@4 # spent 6µs making 1 call to strict::import
531.50ms259µs
# spent 36µs (13+23) within Net::Z3950::ZOOM::BEGIN@5 which was called: # once (13µs+23µs) by C4::Context::BEGIN@4 at line 5
use warnings;
# spent 36µs making 1 call to Net::Z3950::ZOOM::BEGIN@5 # spent 23µs making 1 call to warnings::import
6
712µsour $VERSION = '1.26';
8
912µsrequire XSLoader;
1013.45ms13.43msXSLoader::load('Net::Z3950::ZOOM', $VERSION);
# spent 3.43ms making 1 call to XSLoader::load
11
1218µsmy($vs, $ss) = ("x" x 100, "x" x 100); # allocate space for these strings
13126µs113µsmy $version = Net::Z3950::ZOOM::yaz_version($vs, $ss);
# spent 13µs making 1 call to Net::Z3950::ZOOM::yaz_version
1412µsif ($version < 0x020132 && ! -f "/tmp/ignore-ZOOM-YAZ-version-mismatch") {
15 warn <<__EOT__;
16*** WARNING!
17ZOOM-Perl requires at least version 2.1.50 of YAZ, but is currently
18running against only version $vs (sys-string '$ss').
19Some things may not work.
20__EOT__
21}
22
23# The only thing this module does is define the following constants,
24# which MUST BE KEPT SYNCHRONISED with the definitions in <yaz/zoom.h>
25
26# Error codes, as returned from connection_error()
27sub ERROR_NONE { 0 }
28sub ERROR_CONNECT { 10000 }
29sub ERROR_MEMORY { 10001 }
30sub ERROR_ENCODE { 10002 }
31sub ERROR_DECODE { 10003 }
32sub ERROR_CONNECTION_LOST { 10004 }
33sub ERROR_INIT { 10005 }
34sub ERROR_INTERNAL { 10006 }
35sub ERROR_TIMEOUT { 10007 }
36sub ERROR_UNSUPPORTED_PROTOCOL { 10008 }
37sub ERROR_UNSUPPORTED_QUERY { 10009 }
38sub ERROR_INVALID_QUERY { 10010 }
39sub ERROR_CQL_PARSE { 10011 }
40sub ERROR_CQL_TRANSFORM { 10012 }
41sub ERROR_CCL_CONFIG { 10013 }
42sub ERROR_CCL_PARSE { 10014 }
43
44# Event types, as returned from connection_last_event()
45sub EVENT_NONE { 0 }
46sub EVENT_CONNECT { 1 }
47sub EVENT_SEND_DATA { 2 }
48sub EVENT_RECV_DATA { 3 }
49sub EVENT_TIMEOUT { 4 }
50sub EVENT_UNKNOWN { 5 }
51sub EVENT_SEND_APDU { 6 }
52sub EVENT_RECV_APDU { 7 }
53sub EVENT_RECV_RECORD { 8 }
54sub EVENT_RECV_SEARCH { 9 }
551132µs
# spent 20µs within Net::Z3950::ZOOM::EVENT_END which was called 11 times, avg 2µs/call: # 11 times (20µs+0s) by ZOOM::Event::ZEND at line 83 of ZOOM.pm, avg 2µs/call
sub EVENT_END { 10 } # In YAZ 2.1.17 and later
56
57# CCL error-codes, which are in a different space from the ZOOM errors
58sub CCL_ERR_OK { 0 }
59sub CCL_ERR_TERM_EXPECTED { 1 }
60sub CCL_ERR_RP_EXPECTED { 2 }
61sub CCL_ERR_SETNAME_EXPECTED { 3 }
62sub CCL_ERR_OP_EXPECTED { 4 }
63sub CCL_ERR_BAD_RP { 5 }
64sub CCL_ERR_UNKNOWN_QUAL { 6 }
65sub CCL_ERR_DOUBLE_QUAL { 7 }
66sub CCL_ERR_EQ_EXPECTED { 8 }
67sub CCL_ERR_BAD_RELATION { 9 }
68sub CCL_ERR_TRUNC_NOT_LEFT { 10 }
69sub CCL_ERR_TRUNC_NOT_BOTH { 11 }
70sub CCL_ERR_TRUNC_NOT_RIGHT { 12 }
71
72
73=head1 NAME
74
- -
106sub event_str {
107 my($code) = @_;
108
109 if ($code == EVENT_NONE) {
110 return "none";
111 } elsif ($code == EVENT_CONNECT) {
112 return "connect";
113 } elsif ($code == EVENT_SEND_DATA) {
114 return "send data";
115 } elsif ($code == EVENT_RECV_DATA) {
116 return "receive data";
117 } elsif ($code == EVENT_TIMEOUT) {
118 return "timeout";
119 } elsif ($code == EVENT_UNKNOWN) {
120 return "unknown";
121 } elsif ($code == EVENT_SEND_APDU) {
122 return "send apdu";
123 } elsif ($code == EVENT_RECV_APDU) {
124 return "receive apdu";
125 } elsif ($code == EVENT_RECV_RECORD) {
126 return "receive record";
127 } elsif ($code == EVENT_RECV_SEARCH) {
128 return "receive search";
129 } elsif ($code == EVENT_END) {
130 return "end";
131 }
132 return "impossible event " . $code;
133}
134
135
136# Switch API variant depending on $type. This works because the
137# get_string() and get_binary() functions have different returns
138# types, one of which is implemented as a NUL-terminated string and
139# the other as a pointer-and-length structure.
140#
141# Some Z39.50 servers, when asked for an OPAC-format record in the
142# case where no circulation information is available, will return a
143# USMARC record rather than an OPAC record containing only a
144# bibliographic part. This non-OPAC records is not recognised by the
145# underlying record_get() code in ZOOM-C, which ends up returning a
146# null pointer. To make life a little less painful when dealing with
147# such servers until ZOOM-C is fixed, this code recognises the
148# wrong-record-syntax case and returns the XML for the bibliographic
149# part anyway.
150#
151
# spent 9.49ms (2.47+7.01) within Net::Z3950::ZOOM::record_get which was called 200 times, avg 47µs/call: # 200 times (2.47ms+7.01ms) by ZOOM::Record::get at line 899 of ZOOM.pm, avg 47µs/call
sub record_get {
152200147µs my($rec, $type) = @_;
153
15420078µs my $simpletype = $type;
155200712µs200243µs $simpletype =~ s/;.*//;
# spent 243µs making 200 calls to Net::Z3950::ZOOM::CORE:subst, avg 1µs/call
156200334µs if (grep { $type eq $_ } qw(database syntax schema)) {
157 return record_get_string($rec, $type);
158 } else {
1592007.47ms2006.77ms my $val = record_get_binary($rec, $type);
# spent 6.77ms making 200 calls to Net::Z3950::ZOOM::record_get_binary, avg 34µs/call
160200111µs if ($simpletype eq "opac" && !defined $val) {
161 my $newtype = $type;
162 if ($newtype !~ s/.*?;/xml;/) {
163 $newtype = "xml";
164 }
165 $val = record_get_binary($rec, $newtype);
166 $val = ("<opacRecord>\n <bibliographicRecord>\n" . $val .
167 " </bibliographicRecord>\n</opacRecord>");
168
169 }
170200761µs return $val;
171 }
172}
173
174
175=head1 SEE ALSO
176
- -
193125µs1;
 
# spent 243µs within Net::Z3950::ZOOM::CORE:subst which was called 200 times, avg 1µs/call: # 200 times (243µs+0s) by Net::Z3950::ZOOM::record_get at line 155, avg 1µs/call
sub Net::Z3950::ZOOM::CORE:subst; # opcode
# spent 25µs within Net::Z3950::ZOOM::connection_connect which was called: # once (25µs+0s) by ZOOM::Connection::connect at line 447 of ZOOM.pm
sub Net::Z3950::ZOOM::connection_connect; # xsub
# spent 94µs within Net::Z3950::ZOOM::connection_create which was called: # once (94µs+0s) by ZOOM::Connection::create at line 396 of ZOOM.pm
sub Net::Z3950::ZOOM::connection_create; # xsub
# spent 6µs within Net::Z3950::ZOOM::connection_errcode which was called: # once (6µs+0s) by ZOOM::Connection::errcode at line 424 of ZOOM.pm
sub Net::Z3950::ZOOM::connection_errcode; # xsub
# spent 644µs within Net::Z3950::ZOOM::connection_error_x which was called 202 times, avg 3µs/call: # 202 times (644µs+0s) by ZOOM::Connection::_check at line 352 of ZOOM.pm, avg 3µs/call
sub Net::Z3950::ZOOM::connection_error_x; # xsub
# spent 36µs within Net::Z3950::ZOOM::connection_last_event which was called 11 times, avg 3µs/call: # 11 times (36µs+0s) by ZOOM::Connection::last_event at line 530 of ZOOM.pm, avg 3µs/call
sub Net::Z3950::ZOOM::connection_last_event; # xsub
# spent 14µs within Net::Z3950::ZOOM::connection_option_get which was called 3 times, avg 5µs/call: # 3 times (14µs+0s) by ZOOM::Connection::option at line 456 of ZOOM.pm, avg 5µs/call
sub Net::Z3950::ZOOM::connection_option_get; # xsub
# spent 5µs within Net::Z3950::ZOOM::connection_option_set which was called: # once (5µs+0s) by ZOOM::Connection::option at line 457 of ZOOM.pm
sub Net::Z3950::ZOOM::connection_option_set; # xsub
# spent 58µs within Net::Z3950::ZOOM::connection_search which was called: # once (58µs+0s) by ZOOM::Connection::search at line 481 of ZOOM.pm
sub Net::Z3950::ZOOM::connection_search; # xsub
# spent 57.9ms within Net::Z3950::ZOOM::event which was called 12 times, avg 4.83ms/call: # 12 times (57.9ms+0s) by ZOOM::event at line 128 of ZOOM.pm, avg 4.83ms/call
sub Net::Z3950::ZOOM::event; # xsub
# spent 62µs within Net::Z3950::ZOOM::options_create which was called: # once (62µs+0s) by ZOOM::Options::new at line 205 of ZOOM.pm
sub Net::Z3950::ZOOM::options_create; # xsub
# spent 26µs within Net::Z3950::ZOOM::options_get which was called 8 times, avg 3µs/call: # 8 times (26µs+0s) by ZOOM::Options::option at line 238 of ZOOM.pm, avg 3µs/call
sub Net::Z3950::ZOOM::options_get; # xsub
# spent 32µs within Net::Z3950::ZOOM::options_set which was called 8 times, avg 4µs/call: # 8 times (32µs+0s) by ZOOM::Options::option at line 239 of ZOOM.pm, avg 4µs/call
sub Net::Z3950::ZOOM::options_set; # xsub
# spent 1.89ms within Net::Z3950::ZOOM::query_ccl2rpn which was called: # once (1.89ms+0s) by ZOOM::Query::CCL2RPN::new at line 650 of ZOOM.pm
sub Net::Z3950::ZOOM::query_ccl2rpn; # xsub
# spent 18µs within Net::Z3950::ZOOM::query_create which was called: # once (18µs+0s) by ZOOM::Query::CCL2RPN::new at line 634 of ZOOM.pm
sub Net::Z3950::ZOOM::query_create; # xsub
# spent 6.77ms within Net::Z3950::ZOOM::record_get_binary which was called 200 times, avg 34µs/call: # 200 times (6.77ms+0s) by Net::Z3950::ZOOM::record_get at line 159, avg 34µs/call
sub Net::Z3950::ZOOM::record_get_binary; # xsub
# spent 70µs within Net::Z3950::ZOOM::resultset_destroy which was called: # once (70µs+0s) by ZOOM::ResultSet::destroy at line 823 of ZOOM.pm
sub Net::Z3950::ZOOM::resultset_destroy; # xsub
# spent 13.6ms within Net::Z3950::ZOOM::resultset_record which was called 200 times, avg 68µs/call: # 200 times (13.6ms+0s) by ZOOM::ResultSet::record at line 739 of ZOOM.pm, avg 68µs/call
sub Net::Z3950::ZOOM::resultset_record; # xsub
# spent 14µs within Net::Z3950::ZOOM::resultset_size which was called: # once (14µs+0s) by ZOOM::ResultSet::size at line 732 of ZOOM.pm
sub Net::Z3950::ZOOM::resultset_size; # xsub
# spent 70µs within Net::Z3950::ZOOM::yaz_log_mask_str which was called: # once (70µs+0s) by ZOOM::Log::mask_str at line 1083 of ZOOM.pm
sub Net::Z3950::ZOOM::yaz_log_mask_str; # xsub
# spent 13µs within Net::Z3950::ZOOM::yaz_version which was called: # once (13µs+0s) by C4::Context::BEGIN@4 at line 13
sub Net::Z3950::ZOOM::yaz_version; # xsub