← Index
NYTProf Performance Profile   « line view »
For starman worker -M FindBin --max-requests 50 --workers 2 --user=kohadev-koha --group kohadev-koha --pid /var/run/koha/kohadev/plack.pid --daemonize --access-log /var/log/koha/kohadev/plack.log --error-log /var/log/koha/kohadev/plack-error.log -E deployment --socket /var/run/koha/kohadev/plack.sock /etc/koha/sites/kohadev/plack.psgi
  Run on Fri Jan 8 14:31:06 2016
Reported on Fri Jan 8 14:33:30 2016

Filename/home/vagrant/kohaclone/circ/ysearch.pl
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11196µs1.62msCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::CORE:binmodeCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:binmode (opcode)
11173µs413µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::BEGIN@27CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@27
11161µs193µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::BEGIN@28CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@28
11161µs146µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::BEGIN@32CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@32
11147µs405µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::BEGIN@34CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@34
11128µs115µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::BEGIN@30CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@30
11125µs25µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::CORE:openCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:open (opcode)
11120µs20µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::BEGIN@31CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@31
11120µs28µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::BEGIN@29CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@29
22114µs14µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::CORE:printCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:print (opcode)
1115µs5µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::CORE:packCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:pack (opcode)
1112µs2µsCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::CORE:unpackCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:unpack (opcode)
0000s0sCGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::::__ANON__[:115]CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::__ANON__[:115]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1#!/usr/bin/perl
2159µs
# spent 59µs making 1 call to DBIx::Class::Storage::DBI::Cursor::DESTROY
3# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
4
5# Copyright 2007 Tamil s.a.r.l.
6# Parts copyright 2010-2012 Athens County Public Libraries
7#
8# This file is part of Koha.
9#
10# Koha is free software; you can redistribute it and/or modify it
11# under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 3 of the License, or
13# (at your option) any later version.
14#
15# Koha is distributed in the hope that it will be useful, but
16# WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with Koha; if not, see <http://www.gnu.org/licenses>.
22
23=head1 ysearch.pl
24
25=cut
26
272753µs
# spent 413µs (73+340) within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@27 which was called: # once (73µs+340µs) by CGI::Compile::_eval at line 27
use Modern::Perl;
# spent 413µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@27 # spent 340µs making 1 call to Modern::Perl::import
282326µs
# spent 193µs (61+132) within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@28 which was called: # once (61µs+132µs) by CGI::Compile::_eval at line 28
use CGI qw ( -utf8 );
# spent 193µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@28 # spent 132µs making 1 call to CGI::import
29235µs
# spent 28µs (20+8) within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@29 which was called: # once (20µs+8µs) by CGI::Compile::_eval at line 29
use C4::Context;
# spent 28µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@29 # spent 8µs making 1 call to C4::Context::import
302202µs
# spent 115µs (28+87) within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@30 which was called: # once (28µs+87µs) by CGI::Compile::_eval at line 30
use C4::Auth qw/check_cookie_auth/;
# spent 115µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@30 # spent 87µs making 1 call to Exporter::import
31120µs
# spent 20µs within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@31 which was called: # once (20µs+0s) by CGI::Compile::_eval at line 31
use Koha::Borrowers;
322232µs
# spent 146µs (61+86) within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@32 which was called: # once (61µs+86µs) by CGI::Compile::_eval at line 32
use Koha::DateUtils qw/format_sqldatetime/;
# spent 146µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@32 # spent 86µs making 1 call to Exporter::import
33
342764µs
# spent 405µs (47+358) within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@34 which was called: # once (47µs+358µs) by CGI::Compile::_eval at line 34
use JSON qw( to_json );
# spent 405µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::BEGIN@34 # spent 358µs making 1 call to JSON::import
35
361238µsmy $input = new CGI;
37175µsmy $query = $input->param('term');
# spent 75µs making 1 call to CGI::param
38
3953.13msbinmode STDOUT, ":encoding(UTF-8)";
# spent 1.62ms making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:binmode # spent 1.47ms making 1 call to PerlIO::import # spent 20µs making 1 call to Encode::find_encoding # spent 15µs making 1 call to Encode::Encoding::renew # spent 1µs making 1 call to Encode::Encoding::needs_lines
402190µsprint $input->header( -type => 'text/plain', -charset => 'UTF-8' );
# spent 181µs making 1 call to CGI::header # spent 8µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:print
41
42421.0msmy ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { circulate => '*' } );
# spent 18.8ms making 1 call to C4::Auth::check_cookie_auth # spent 1.68ms making 1 call to CGI::Session::DESTROY # spent 458µs making 1 call to CGI::cookie # spent 56µs making 1 call to CGI::Session::Driver::DBI::DESTROY
43if ( $auth_status ne "ok" ) {
44 exit 0;
45}
46
47my $limit_on_branch;
4812.89msif ( C4::Context->preference("IndependentBranches")
# spent 2.89ms making 1 call to C4::Context::preference
49 && C4::Context->userenv
50 && !C4::Context->IsSuperLibrarian()
51 && C4::Context->userenv->{'branch'} ) {
52 $limit_on_branch = 1;
53}
54
55my @parts = split( / /, $query );
56my @params;
57foreach my $p (@parts) {
58 push(
59 @params,
60 -or => [
61 surname => { -like => "%$p%" },
62 firstname => { -like => "%$p%" },
63 cardnumber => { -like => "$p%" },
64 ]
65 );
66}
67
68push( @params, { branchcode => C4::Context->userenv->{branch} } ) if $limit_on_branch;
69
701462µsmy $borrowers_rs = Koha::Borrowers->search(
# spent 462µs making 1 call to Koha::Objects::search
71 { -and => \@params },
72 {
73 # Get the first 10 results
74 page => 1,
75 rows => 10,
76 order_by => [ 'surname', 'firstname' ],
77 },
78);
79
80my @borrowers;
81137.6mswhile ( my $b = $borrowers_rs->next ) {
# spent 37.6ms making 1 call to Koha::Objects::next
82 push @borrowers,
83 { borrowernumber => $b->borrowernumber,
84 surname => $b->surname // '',
85 firstname => $b->firstname // '',
86 cardnumber => $b->cardnumber // '',
87 dateofbirth => format_sqldatetime($b->dateofbirth, undef, undef, 1) // '',
88 address => $b->address // '',
89 city => $b->city // '',
90 zipcode => $b->zipcode // '',
91 country => $b->country // '',
92 };
93}
94
95386µsprint to_json( \@borrowers );
# spent 79µs making 1 call to JSON::to_json # spent 6µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:print # spent 1µs making 1 call to JSON::XS::DESTROY
96
97};
98 my $self = shift;
9927µs my $exit_val = unpack('C', pack('C', sprintf('%.0f', $rv)));
100 if ($@) {
101 die $@ unless (
102 ref($@) eq 'ARRAY' and
103 $@->[0] eq "EXIT\n"
104 );
105 my $exit_param = unpack('C', pack('C', sprintf('%.0f', $@->[1])));
106
107 if ($exit_param != 0 && !$CGI::Compile::RETURN_EXIT_VAL && !$self->{return_exit_val}) {
108 die "exited nonzero: $exit_param";
109 }
110
111 $exit_val = $exit_param;
112 }
113
114 return $exit_val;
115 };
 
# spent 1.62ms (96µs+1.53) within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:binmode which was called: # once (96µs+1.53ms) by CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::__ANON__[/home/vagrant/kohaclone/circ/ysearch.pl:115] at line 39
sub CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:binmode; # opcode
# spent 25µs within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:open which was called: # once (25µs+0s) by CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::__ANON__[/home/vagrant/kohaclone/circ/ysearch.pl:115] at line 2 of (eval 1176)[CGI/Compile.pm:12]
sub CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:open; # opcode
# spent 5µs within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:pack which was called: # once (5µs+0s) by CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::__ANON__[/home/vagrant/kohaclone/circ/ysearch.pl:115] at line 99
sub CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:pack; # opcode
# spent 14µs within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:print which was called 2 times, avg 7µs/call: # once (8µs+0s) by CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::__ANON__[/home/vagrant/kohaclone/circ/ysearch.pl:115] at line 40 # once (6µs+0s) by CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::__ANON__[/home/vagrant/kohaclone/circ/ysearch.pl:115] at line 95
sub CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:print; # opcode
# spent 2µs within CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:unpack which was called: # once (2µs+0s) by CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::__ANON__[/home/vagrant/kohaclone/circ/ysearch.pl:115] at line 99
sub CGI::Compile::ROOT::home_vagrant_kohaclone_circ_ysearch_2epl::CORE:unpack; # opcode