← 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 17:10:45 2013
Reported on Tue Oct 15 17:12:28 2013

Filename/usr/share/perl5/LWP/Simple.pm
StatementsExecuted 33 statements in 1.55ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1118.55ms29.3msLWP::Simple::::BEGIN@26LWP::Simple::BEGIN@26
1113.14ms3.73msLWP::Simple::::BEGIN@14LWP::Simple::BEGIN@14
22256µs1.73msLWP::Simple::::importLWP::Simple::import
11121µs28µsLWP::Simple::::BEGIN@3LWP::Simple::BEGIN@3
11112µs12µsLWP::Simple::::BEGIN@27LWP::Simple::BEGIN@27
11111µs113µsLWP::Simple::::BEGIN@4LWP::Simple::BEGIN@4
1118µs8µsLWP::Simple::::BEGIN@28LWP::Simple::BEGIN@28
0000s0sLWP::Simple::::__ANON__[:66]LWP::Simple::__ANON__[:66]
0000s0sLWP::Simple::::__ANON__[:68]LWP::Simple::__ANON__[:68]
0000s0sLWP::Simple::::getLWP::Simple::get
0000s0sLWP::Simple::::getprintLWP::Simple::getprint
0000s0sLWP::Simple::::getstoreLWP::Simple::getstore
0000s0sLWP::Simple::::headLWP::Simple::head
0000s0sLWP::Simple::::mirrorLWP::Simple::mirror
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package LWP::Simple;
2
3336µs235µs
# spent 28µs (21+7) within LWP::Simple::BEGIN@3 which was called: # once (21µs+7µs) by C4::Auth::BEGIN@34 at line 3
use strict;
# spent 28µs making 1 call to LWP::Simple::BEGIN@3 # spent 6µs making 1 call to strict::import
4365µs2214µs
# spent 113µs (11+102) within LWP::Simple::BEGIN@4 which was called: # once (11µs+102µs) by C4::Auth::BEGIN@34 at line 4
use vars qw($ua %loop_check $FULL_LWP @EXPORT @EXPORT_OK $VERSION);
# spent 113µs making 1 call to LWP::Simple::BEGIN@4 # spent 102µs making 1 call to vars::import
5
612µsrequire Exporter;
7
814µs@EXPORT = qw(get head getprint getstore mirror);
911µs@EXPORT_OK = qw($ua);
10
11# I really hate this. I was a bad idea to do it in the first place.
12# Wonder how to get rid of it??? (It even makes LWP::Simple 7% slower
13# for trivial tests)
143188µs24.12ms
# spent 3.73ms (3.14+594µs) within LWP::Simple::BEGIN@14 which was called: # once (3.14ms+594µs) by C4::Auth::BEGIN@34 at line 14
use HTTP::Status;
# spent 3.73ms making 1 call to LWP::Simple::BEGIN@14 # spent 386µs making 1 call to Exporter::import
15124µspush(@EXPORT, @HTTP::Status::EXPORT);
16
1711µs$VERSION = "5.835";
18
19sub import
20
# spent 1.73ms (56µs+1.67) within LWP::Simple::import which was called 2 times, avg 864µs/call: # once (24µs+1.11ms) by C4::XSLT::BEGIN@36 at line 36 of /usr/share/koha/lib/C4/XSLT.pm # once (31µs+563µs) by C4::Auth::BEGIN@34 at line 34 of /usr/share/koha/lib/C4/Auth.pm
{
2126µs my $pkg = shift;
2224µs my $callpkg = caller;
23226µs291µs Exporter::export($pkg, $callpkg, @_);
# spent 91µs making 2 calls to Exporter::export, avg 45µs/call
24}
25
263235µs129.3ms
# spent 29.3ms (8.55+20.7) within LWP::Simple::BEGIN@26 which was called: # once (8.55ms+20.7ms) by C4::Auth::BEGIN@34 at line 26
use LWP::UserAgent ();
# spent 29.3ms making 1 call to LWP::Simple::BEGIN@26
27347µs112µs
# spent 12µs within LWP::Simple::BEGIN@27 which was called: # once (12µs+0s) by C4::Auth::BEGIN@34 at line 27
use HTTP::Status ();
# spent 12µs making 1 call to LWP::Simple::BEGIN@27
283857µs18µs
# spent 8µs within LWP::Simple::BEGIN@28 which was called: # once (8µs+0s) by C4::Auth::BEGIN@34 at line 28
use HTTP::Date ();
# spent 8µs making 1 call to LWP::Simple::BEGIN@28
29112µs14.05ms$ua = LWP::UserAgent->new; # we create a global UserAgent object
# spent 4.05ms making 1 call to LWP::UserAgent::new
30111µs1134µs$ua->agent("LWP::Simple/$VERSION ");
# spent 134µs making 1 call to LWP::UserAgent::agent
3116µs1264µs$ua->env_proxy;
# spent 264µs making 1 call to LWP::UserAgent::env_proxy
32
33
34sub get ($)
35{
36 my $response = $ua->get(shift);
37 return $response->decoded_content if $response->is_success;
38 return undef;
39}
40
41
42sub head ($)
43{
44 my($url) = @_;
45 my $request = HTTP::Request->new(HEAD => $url);
46 my $response = $ua->request($request);
47
48 if ($response->is_success) {
49 return $response unless wantarray;
50 return (scalar $response->header('Content-Type'),
51 scalar $response->header('Content-Length'),
52 HTTP::Date::str2time($response->header('Last-Modified')),
53 HTTP::Date::str2time($response->header('Expires')),
54 scalar $response->header('Server'),
55 );
56 }
57 return;
58}
59
60
61sub getprint ($)
62{
63 my($url) = @_;
64 my $request = HTTP::Request->new(GET => $url);
65 local($\) = ""; # ensure standard $OUTPUT_RECORD_SEPARATOR
66 my $callback = sub { print $_[0] };
67 if ($^O eq "MacOS") {
68 $callback = sub { $_[0] =~ s/\015?\012/\n/g; print $_[0] }
69 }
70 my $response = $ua->request($request, $callback);
71 unless ($response->is_success) {
72 print STDERR $response->status_line, " <URL:$url>\n";
73 }
74 $response->code;
75}
76
77
78sub getstore ($$)
79{
80 my($url, $file) = @_;
81 my $request = HTTP::Request->new(GET => $url);
82 my $response = $ua->request($request, $file);
83
84 $response->code;
85}
86
87
88sub mirror ($$)
89{
90 my($url, $file) = @_;
91 my $response = $ua->mirror($url, $file);
92 $response->code;
93}
94
95
96126µs1;
97
98__END__