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

Filename/usr/share/perl5/LWP/Simple.pm
StatementsExecuted 33 statements in 982µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1115.62ms27.2msLWP::Simple::::BEGIN@26LWP::Simple::BEGIN@26
1112.96ms3.51msLWP::Simple::::BEGIN@14LWP::Simple::BEGIN@14
22236µs917µsLWP::Simple::::importLWP::Simple::import
11123µs30µsLWP::Simple::::BEGIN@3LWP::Simple::BEGIN@3
11111µs106µsLWP::Simple::::BEGIN@4LWP::Simple::BEGIN@4
1117µs7µsLWP::Simple::::BEGIN@27LWP::Simple::BEGIN@27
1116µs6µ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
3337µs237µs
# spent 30µs (23+7) within LWP::Simple::BEGIN@3 which was called: # once (23µs+7µs) by C4::Auth::BEGIN@34 at line 3
use strict;
# spent 30µs making 1 call to LWP::Simple::BEGIN@3 # spent 7µs making 1 call to strict::import
4363µs2200µs
# spent 106µs (11+95) within LWP::Simple::BEGIN@4 which was called: # once (11µs+95µs) by C4::Auth::BEGIN@34 at line 4
use vars qw($ua %loop_check $FULL_LWP @EXPORT @EXPORT_OK $VERSION);
# spent 106µs making 1 call to LWP::Simple::BEGIN@4 # spent 95µs making 1 call to vars::import
5
611µsrequire Exporter;
7
813µs@EXPORT = qw(get head getprint getstore mirror);
91600ns@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)
143215µs23.87ms
# spent 3.51ms (2.96+547µs) within LWP::Simple::BEGIN@14 which was called: # once (2.96ms+547µs) by C4::Auth::BEGIN@34 at line 14
use HTTP::Status;
# spent 3.51ms making 1 call to LWP::Simple::BEGIN@14 # spent 365µs making 1 call to Exporter::import
15115µspush(@EXPORT, @HTTP::Status::EXPORT);
16
171600ns$VERSION = "5.835";
18
19sub import
20
# spent 917µs (36+880) within LWP::Simple::import which was called 2 times, avg 458µs/call: # once (17µs+546µs) by C4::XSLT::BEGIN@36 at line 36 of /usr/share/koha/lib/C4/XSLT.pm # once (19µs+334µs) by C4::Auth::BEGIN@34 at line 34 of /usr/share/koha/lib/C4/Auth.pm
{
2124µs my $pkg = shift;
2223µs my $callpkg = caller;
23217µs257µs Exporter::export($pkg, $callpkg, @_);
# spent 57µs making 2 calls to Exporter::export, avg 28µs/call
24}
25
263151µs127.2ms
# spent 27.2ms (5.62+21.6) within LWP::Simple::BEGIN@26 which was called: # once (5.62ms+21.6ms) by C4::Auth::BEGIN@34 at line 26
use LWP::UserAgent ();
# spent 27.2ms making 1 call to LWP::Simple::BEGIN@26
27323µs17µs
# spent 7µs within LWP::Simple::BEGIN@27 which was called: # once (7µs+0s) by C4::Auth::BEGIN@34 at line 27
use HTTP::Status ();
# spent 7µs making 1 call to LWP::Simple::BEGIN@27
283421µs16µs
# spent 6µs within LWP::Simple::BEGIN@28 which was called: # once (6µs+0s) by C4::Auth::BEGIN@34 at line 28
use HTTP::Date ();
# spent 6µs making 1 call to LWP::Simple::BEGIN@28
2917µs12.14ms$ua = LWP::UserAgent->new; # we create a global UserAgent object
# spent 2.14ms making 1 call to LWP::UserAgent::new
3015µs162µs$ua->agent("LWP::Simple/$VERSION ");
# spent 62µs making 1 call to LWP::UserAgent::agent
3112µs196µs$ua->env_proxy;
# spent 96µ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
96114µs1;
97
98__END__