Filename | /usr/lib/perl5/Net/Z3950/ZOOM.pm |
Statements | Executed 1427 statements in 19.5ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
12 | 1 | 1 | 67.5ms | 67.5ms | event (xsub) | Net::Z3950::ZOOM::
200 | 1 | 1 | 31.8ms | 31.8ms | resultset_record (xsub) | Net::Z3950::ZOOM::
200 | 1 | 1 | 9.54ms | 9.54ms | record_get_binary (xsub) | Net::Z3950::ZOOM::
200 | 1 | 1 | 4.20ms | 14.0ms | record_get | Net::Z3950::ZOOM::
1 | 1 | 1 | 1.42ms | 1.42ms | query_ccl2rpn (xsub) | Net::Z3950::ZOOM::
202 | 1 | 1 | 1.15ms | 1.15ms | connection_error_x (xsub) | Net::Z3950::ZOOM::
200 | 1 | 1 | 280µs | 280µs | CORE:subst (opcode) | Net::Z3950::ZOOM::
1 | 1 | 1 | 68µs | 68µs | options_create (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 64µs | 64µs | connection_search (xsub) | Net::Z3950::ZOOM::
8 | 1 | 1 | 53µs | 53µs | options_get (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 52µs | 52µs | connection_create (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 51µs | 51µs | resultset_destroy (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 50µs | 50µs | BEGIN@3 | Net::Z3950::ZOOM::
1 | 1 | 1 | 50µs | 50µs | yaz_log_mask_str (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 34µs | 34µs | query_create (xsub) | Net::Z3950::ZOOM::
8 | 1 | 1 | 34µs | 34µs | options_set (xsub) | Net::Z3950::ZOOM::
11 | 1 | 1 | 31µs | 31µs | connection_last_event (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 23µs | 23µs | resultset_size (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 22µs | 22µs | connection_connect (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 19µs | 26µs | BEGIN@4 | Net::Z3950::ZOOM::
1 | 1 | 1 | 18µs | 43µs | BEGIN@5 | Net::Z3950::ZOOM::
11 | 1 | 1 | 16µs | 16µs | EVENT_END | Net::Z3950::ZOOM::
1 | 1 | 1 | 12µs | 12µs | connection_option_set (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 11µs | 11µs | yaz_version (xsub) | Net::Z3950::ZOOM::
3 | 1 | 1 | 11µs | 11µs | connection_option_get (xsub) | Net::Z3950::ZOOM::
1 | 1 | 1 | 6µs | 6µs | connection_errcode (xsub) | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_BAD_RELATION | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_BAD_RP | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_DOUBLE_QUAL | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_EQ_EXPECTED | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_OK | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_OP_EXPECTED | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_RP_EXPECTED | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_SETNAME_EXPECTED | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_TERM_EXPECTED | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_TRUNC_NOT_BOTH | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_TRUNC_NOT_LEFT | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_TRUNC_NOT_RIGHT | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | CCL_ERR_UNKNOWN_QUAL | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_CCL_CONFIG | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_CCL_PARSE | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_CONNECT | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_CONNECTION_LOST | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_CQL_PARSE | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_CQL_TRANSFORM | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_DECODE | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_ENCODE | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_INIT | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_INTERNAL | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_INVALID_QUERY | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_MEMORY | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_NONE | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_TIMEOUT | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_UNSUPPORTED_PROTOCOL | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | ERROR_UNSUPPORTED_QUERY | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_CONNECT | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_NONE | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_RECV_APDU | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_RECV_DATA | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_RECV_RECORD | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_RECV_SEARCH | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_SEND_APDU | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_SEND_DATA | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_TIMEOUT | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | EVENT_UNKNOWN | Net::Z3950::ZOOM::
0 | 0 | 0 | 0s | 0s | event_str | Net::Z3950::ZOOM::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Net::Z3950::ZOOM; | ||||
2 | |||||
3 | 3 | 82µs | 1 | 50µs | # spent 50µs within Net::Z3950::ZOOM::BEGIN@3 which was called:
# once (50µs+0s) by C4::Context::BEGIN@4 at line 3 # spent 50µs making 1 call to Net::Z3950::ZOOM::BEGIN@3 |
4 | 3 | 52µs | 2 | 33µs | # spent 26µs (19+7) within Net::Z3950::ZOOM::BEGIN@4 which was called:
# once (19µs+7µs) by C4::Context::BEGIN@4 at line 4 # spent 26µs making 1 call to Net::Z3950::ZOOM::BEGIN@4
# spent 7µs making 1 call to strict::import |
5 | 3 | 1.57ms | 2 | 67µs | # spent 43µs (18+25) within Net::Z3950::ZOOM::BEGIN@5 which was called:
# once (18µs+25µs) by C4::Context::BEGIN@4 at line 5 # spent 43µs making 1 call to Net::Z3950::ZOOM::BEGIN@5
# spent 25µs making 1 call to warnings::import |
6 | |||||
7 | 1 | 2µs | our $VERSION = '1.26'; | ||
8 | |||||
9 | 1 | 2µs | require XSLoader; | ||
10 | 1 | 3.49ms | 1 | 3.47ms | XSLoader::load('Net::Z3950::ZOOM', $VERSION); # spent 3.47ms making 1 call to XSLoader::load |
11 | |||||
12 | 1 | 7µs | my($vs, $ss) = ("x" x 100, "x" x 100); # allocate space for these strings | ||
13 | 1 | 23µs | 1 | 11µs | my $version = Net::Z3950::ZOOM::yaz_version($vs, $ss); # spent 11µs making 1 call to Net::Z3950::ZOOM::yaz_version |
14 | 1 | 1µs | if ($version < 0x020132 && ! -f "/tmp/ignore-ZOOM-YAZ-version-mismatch") { | ||
15 | warn <<__EOT__; | ||||
16 | *** WARNING! | ||||
17 | ZOOM-Perl requires at least version 2.1.50 of YAZ, but is currently | ||||
18 | running against only version $vs (sys-string '$ss'). | ||||
19 | Some 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() | ||||
27 | sub ERROR_NONE { 0 } | ||||
28 | sub ERROR_CONNECT { 10000 } | ||||
29 | sub ERROR_MEMORY { 10001 } | ||||
30 | sub ERROR_ENCODE { 10002 } | ||||
31 | sub ERROR_DECODE { 10003 } | ||||
32 | sub ERROR_CONNECTION_LOST { 10004 } | ||||
33 | sub ERROR_INIT { 10005 } | ||||
34 | sub ERROR_INTERNAL { 10006 } | ||||
35 | sub ERROR_TIMEOUT { 10007 } | ||||
36 | sub ERROR_UNSUPPORTED_PROTOCOL { 10008 } | ||||
37 | sub ERROR_UNSUPPORTED_QUERY { 10009 } | ||||
38 | sub ERROR_INVALID_QUERY { 10010 } | ||||
39 | sub ERROR_CQL_PARSE { 10011 } | ||||
40 | sub ERROR_CQL_TRANSFORM { 10012 } | ||||
41 | sub ERROR_CCL_CONFIG { 10013 } | ||||
42 | sub ERROR_CCL_PARSE { 10014 } | ||||
43 | |||||
44 | # Event types, as returned from connection_last_event() | ||||
45 | sub EVENT_NONE { 0 } | ||||
46 | sub EVENT_CONNECT { 1 } | ||||
47 | sub EVENT_SEND_DATA { 2 } | ||||
48 | sub EVENT_RECV_DATA { 3 } | ||||
49 | sub EVENT_TIMEOUT { 4 } | ||||
50 | sub EVENT_UNKNOWN { 5 } | ||||
51 | sub EVENT_SEND_APDU { 6 } | ||||
52 | sub EVENT_RECV_APDU { 7 } | ||||
53 | sub EVENT_RECV_RECORD { 8 } | ||||
54 | sub EVENT_RECV_SEARCH { 9 } | ||||
55 | 11 | 28µs | # spent 16µs within Net::Z3950::ZOOM::EVENT_END which was called 11 times, avg 1µs/call:
# 11 times (16µs+0s) by ZOOM::Event::ZEND at line 83 of ZOOM.pm, avg 1µs/call | ||
56 | |||||
57 | # CCL error-codes, which are in a different space from the ZOOM errors | ||||
58 | sub CCL_ERR_OK { 0 } | ||||
59 | sub CCL_ERR_TERM_EXPECTED { 1 } | ||||
60 | sub CCL_ERR_RP_EXPECTED { 2 } | ||||
61 | sub CCL_ERR_SETNAME_EXPECTED { 3 } | ||||
62 | sub CCL_ERR_OP_EXPECTED { 4 } | ||||
63 | sub CCL_ERR_BAD_RP { 5 } | ||||
64 | sub CCL_ERR_UNKNOWN_QUAL { 6 } | ||||
65 | sub CCL_ERR_DOUBLE_QUAL { 7 } | ||||
66 | sub CCL_ERR_EQ_EXPECTED { 8 } | ||||
67 | sub CCL_ERR_BAD_RELATION { 9 } | ||||
68 | sub CCL_ERR_TRUNC_NOT_LEFT { 10 } | ||||
69 | sub CCL_ERR_TRUNC_NOT_BOTH { 11 } | ||||
70 | sub CCL_ERR_TRUNC_NOT_RIGHT { 12 } | ||||
71 | |||||
72 | |||||
73 | =head1 NAME | ||||
74 | |||||
- - | |||||
106 | sub 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 14.0ms (4.20+9.82) within Net::Z3950::ZOOM::record_get which was called 200 times, avg 70µs/call:
# 200 times (4.20ms+9.82ms) by ZOOM::Record::get at line 899 of ZOOM.pm, avg 70µs/call | ||||
152 | 200 | 168µs | my($rec, $type) = @_; | ||
153 | |||||
154 | 200 | 245µs | my $simpletype = $type; | ||
155 | 200 | 1.05ms | 200 | 280µs | $simpletype =~ s/;.*//; # spent 280µs making 200 calls to Net::Z3950::ZOOM::CORE:subst, avg 1µs/call |
156 | 200 | 419µs | if (grep { $type eq $_ } qw(database syntax schema)) { | ||
157 | return record_get_string($rec, $type); | ||||
158 | } else { | ||||
159 | 200 | 10.9ms | 200 | 9.54ms | my $val = record_get_binary($rec, $type); # spent 9.54ms making 200 calls to Net::Z3950::ZOOM::record_get_binary, avg 48µs/call |
160 | 200 | 207µ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 | } | ||||
170 | 200 | 1.28ms | return $val; | ||
171 | } | ||||
172 | } | ||||
173 | |||||
174 | |||||
175 | =head1 SEE ALSO | ||||
176 | |||||
- - | |||||
193 | 1 | 16µs | 1; | ||
# spent 280µs within Net::Z3950::ZOOM::CORE:subst which was called 200 times, avg 1µs/call:
# 200 times (280µs+0s) by Net::Z3950::ZOOM::record_get at line 155, avg 1µs/call | |||||
# spent 22µs within Net::Z3950::ZOOM::connection_connect which was called:
# once (22µs+0s) by ZOOM::Connection::connect at line 447 of ZOOM.pm | |||||
# spent 52µs within Net::Z3950::ZOOM::connection_create which was called:
# once (52µs+0s) by ZOOM::Connection::create at line 396 of ZOOM.pm | |||||
# 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 | |||||
# spent 1.15ms within Net::Z3950::ZOOM::connection_error_x which was called 202 times, avg 6µs/call:
# 202 times (1.15ms+0s) by ZOOM::Connection::_check at line 352 of ZOOM.pm, avg 6µs/call | |||||
# spent 31µs within Net::Z3950::ZOOM::connection_last_event which was called 11 times, avg 3µs/call:
# 11 times (31µs+0s) by ZOOM::Connection::last_event at line 530 of ZOOM.pm, avg 3µs/call | |||||
# spent 11µs within Net::Z3950::ZOOM::connection_option_get which was called 3 times, avg 4µs/call:
# 3 times (11µs+0s) by ZOOM::Connection::option at line 456 of ZOOM.pm, avg 4µs/call | |||||
# spent 12µs within Net::Z3950::ZOOM::connection_option_set which was called:
# once (12µs+0s) by ZOOM::Connection::option at line 457 of ZOOM.pm | |||||
# spent 64µs within Net::Z3950::ZOOM::connection_search which was called:
# once (64µs+0s) by ZOOM::Connection::search at line 481 of ZOOM.pm | |||||
# spent 67.5ms within Net::Z3950::ZOOM::event which was called 12 times, avg 5.62ms/call:
# 12 times (67.5ms+0s) by ZOOM::event at line 128 of ZOOM.pm, avg 5.62ms/call | |||||
# spent 68µs within Net::Z3950::ZOOM::options_create which was called:
# once (68µs+0s) by ZOOM::Options::new at line 205 of ZOOM.pm | |||||
# spent 53µs within Net::Z3950::ZOOM::options_get which was called 8 times, avg 7µs/call:
# 8 times (53µs+0s) by ZOOM::Options::option at line 238 of ZOOM.pm, avg 7µs/call | |||||
# spent 34µs within Net::Z3950::ZOOM::options_set which was called 8 times, avg 4µs/call:
# 8 times (34µs+0s) by ZOOM::Options::option at line 239 of ZOOM.pm, avg 4µs/call | |||||
# spent 1.42ms within Net::Z3950::ZOOM::query_ccl2rpn which was called:
# once (1.42ms+0s) by ZOOM::Query::CCL2RPN::new at line 650 of ZOOM.pm | |||||
# spent 34µs within Net::Z3950::ZOOM::query_create which was called:
# once (34µs+0s) by ZOOM::Query::CCL2RPN::new at line 634 of ZOOM.pm | |||||
# spent 9.54ms within Net::Z3950::ZOOM::record_get_binary which was called 200 times, avg 48µs/call:
# 200 times (9.54ms+0s) by Net::Z3950::ZOOM::record_get at line 159, avg 48µs/call | |||||
# spent 51µs within Net::Z3950::ZOOM::resultset_destroy which was called:
# once (51µs+0s) by ZOOM::ResultSet::destroy at line 823 of ZOOM.pm | |||||
# spent 31.8ms within Net::Z3950::ZOOM::resultset_record which was called 200 times, avg 159µs/call:
# 200 times (31.8ms+0s) by ZOOM::ResultSet::record at line 739 of ZOOM.pm, avg 159µs/call | |||||
# spent 23µs within Net::Z3950::ZOOM::resultset_size which was called:
# once (23µs+0s) by ZOOM::ResultSet::size at line 732 of ZOOM.pm | |||||
# spent 50µs within Net::Z3950::ZOOM::yaz_log_mask_str which was called:
# once (50µs+0s) by ZOOM::Log::mask_str at line 1083 of ZOOM.pm | |||||
# spent 11µs within Net::Z3950::ZOOM::yaz_version which was called:
# once (11µs+0s) by C4::Context::BEGIN@4 at line 13 |