Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Search/Elasticsearch/Cxn/HTTPTiny.pm |
Statements | Executed 25033 statements in 63.4ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1001 | 1 | 1 | 17.8ms | 83.6ms | _build_handle | Search::Elasticsearch::Cxn::HTTPTiny::
1 | 1 | 1 | 6.93ms | 25.6ms | BEGIN@6 | Search::Elasticsearch::Cxn::HTTPTiny::
1 | 1 | 1 | 8µs | 466µs | BEGIN@3 | Search::Elasticsearch::Cxn::HTTPTiny::
1 | 1 | 1 | 8µs | 142µs | BEGIN@7 | Search::Elasticsearch::Cxn::HTTPTiny::
0 | 0 | 0 | 0s | 0s | error_from_text | Search::Elasticsearch::Cxn::HTTPTiny::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Search::Elasticsearch::Cxn::HTTPTiny; | ||||
2 | 1 | 300ns | $Search::Elasticsearch::Cxn::HTTPTiny::VERSION = '5.01'; | ||
3 | 2 | 28µs | 2 | 924µs | # spent 466µs (8+458) within Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@3 which was called:
# once (8µs+458µs) by Module::Runtime::require_module at line 3 # spent 466µs making 1 call to Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@3
# spent 458µs making 1 call to Moo::import |
4 | 1 | 2µs | 1 | 32.4ms | with 'Search::Elasticsearch::Role::Cxn', 'Search::Elasticsearch::Role::Is_Sync'; # spent 32.4ms making 1 call to Moo::with |
5 | |||||
6 | 3 | 82µs | 2 | 25.6ms | # spent 25.6ms (6.93+18.7) within Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@6 which was called:
# once (6.93ms+18.7ms) by Module::Runtime::require_module at line 6 # spent 25.6ms making 1 call to Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@6
# spent 3µs making 1 call to UNIVERSAL::VERSION |
7 | 2 | 263µs | 2 | 276µs | # spent 142µs (8+134) within Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@7 which was called:
# once (8µs+134µs) by Module::Runtime::require_module at line 7 # spent 142µs making 1 call to Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@7
# spent 134µs making 1 call to namespace::clean::import |
8 | |||||
9 | 1 | 7µs | 1 | 2µs | my $Cxn_Error = qr/ Connection.(?:timed.out|re(?:set|fused)) # spent 2µs making 1 call to Search::Elasticsearch::Cxn::HTTPTiny::CORE:qr |
10 | | connect:.timeout | ||||
11 | | Host.is.down | ||||
12 | | No.route.to.host | ||||
13 | | temporarily.unavailable | ||||
14 | /x; | ||||
15 | |||||
16 | #=================================== | ||||
17 | sub perform_request { | ||||
18 | #=================================== | ||||
19 | 2002 | 583µs | my ( $self, $params ) = @_; | ||
20 | 2002 | 3.30ms | 2002 | 198ms | my $uri = $self->build_uri($params); # spent 198ms making 2002 calls to Search::Elasticsearch::Role::Cxn::build_uri, avg 99µs/call |
21 | 2002 | 1.27ms | my $method = $params->{method}; | ||
22 | |||||
23 | 2002 | 505µs | my %args; | ||
24 | 2002 | 1.39ms | if ( defined $params->{data} ) { | ||
25 | 1000 | 1.01ms | $args{content} = $params->{data}; | ||
26 | 1000 | 1.33ms | $args{headers}{'Content-Type'} = $params->{mime_type}; | ||
27 | $args{headers}{'Content-Encoding'} = $params->{encoding} | ||||
28 | 1000 | 564µs | if $params->{encoding}; | ||
29 | } | ||||
30 | |||||
31 | 2002 | 3.59ms | 2002 | 137ms | my $handle = $self->handle; # spent 137ms making 2002 calls to Search::Elasticsearch::Cxn::HTTPTiny::handle, avg 69µs/call |
32 | 2002 | 5.89ms | 2003 | 38.6ms | $handle->timeout( $params->{timeout} || $self->request_timeout ); # spent 38.6ms making 2002 calls to HTTP::Tiny::__ANON__[HTTP/Tiny.pm:85], avg 19µs/call
# spent 800ns making 1 call to Search::Elasticsearch::Role::Cxn::request_timeout |
33 | |||||
34 | 2002 | 9.74ms | 4004 | 19.3s | my $response = $handle->request( $method, "$uri", \%args ); # spent 19.3s making 2002 calls to HTTP::Tiny::request, avg 9.63ms/call
# spent 2.42ms making 2002 calls to URI::__ANON__[URI.pm:24], avg 1µs/call |
35 | |||||
36 | return $self->process_response( | ||||
37 | $params, # request | ||||
38 | $response->{status}, # code | ||||
39 | $response->{reason}, # msg | ||||
40 | $response->{content}, # body | ||||
41 | $response->{headers} # headers | ||||
42 | 2002 | 21.7ms | 2002 | 142ms | ); # spent 142ms making 2002 calls to Search::Elasticsearch::Role::Cxn::process_response, avg 71µs/call |
43 | } | ||||
44 | |||||
45 | #=================================== | ||||
46 | sub error_from_text { | ||||
47 | #=================================== | ||||
48 | local $_ = $_[2]; | ||||
49 | return | ||||
50 | /[Tt]imed out/ ? 'Timeout' | ||||
51 | : /Unexpected end of stream/ ? 'ContentLength' | ||||
52 | : /SSL connection failed/ ? 'SSL' | ||||
53 | : /$Cxn_Error/ ? 'Cxn' | ||||
54 | : 'Request'; | ||||
55 | } | ||||
56 | |||||
57 | #=================================== | ||||
58 | # spent 83.6ms (17.8+65.8) within Search::Elasticsearch::Cxn::HTTPTiny::_build_handle which was called 1001 times, avg 84µs/call:
# 1001 times (17.8ms+65.8ms) by Search::Elasticsearch::Role::Cxn::handle at line 20 of (eval 266)[Sub/Quote.pm:3], avg 84µs/call | ||||
59 | #=================================== | ||||
60 | 1001 | 380µs | my $self = shift; | ||
61 | 1001 | 2.51ms | 1 | 800ns | my %args = ( default_headers => $self->default_headers ); # spent 800ns making 1 call to Search::Elasticsearch::Role::Cxn::default_headers |
62 | 1001 | 955µs | 1 | 800ns | if ( $self->is_https && $self->has_ssl_options ) { # spent 800ns making 1 call to Search::Elasticsearch::Role::Cxn::is_https |
63 | $args{SSL_options} = $self->ssl_options; | ||||
64 | if ( $args{SSL_options}{SSL_verify_mode} ) { | ||||
65 | $args{verify_ssl} = 1; | ||||
66 | } | ||||
67 | } | ||||
68 | |||||
69 | 1001 | 8.22ms | 1002 | 65.8ms | return HTTP::Tiny->new( %args, %{ $self->handle_args } ); # spent 65.8ms making 1001 calls to HTTP::Tiny::new, avg 66µs/call
# spent 600ns making 1 call to Search::Elasticsearch::Role::Cxn::handle_args |
70 | } | ||||
71 | |||||
72 | 1 | 4µs | 1; | ||
73 | |||||
74 | # ABSTRACT: A Cxn implementation which uses HTTP::Tiny | ||||
75 | |||||
76 | 1 | 9µs | 1 | 165µs | __END__ # spent 165µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:17] |