← 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:11:46 2013

Filename/usr/share/koha/lib/C4/Utils.pm
StatementsExecuted 16 statements in 606µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11131µs31µsC4::Utils::::BEGIN@28C4::Utils::BEGIN@28
11129µs36µsC4::Utils::::BEGIN@24C4::Utils::BEGIN@24
11112µs26µsC4::Utils::::BEGIN@25C4::Utils::BEGIN@25
11111µs110µsC4::Utils::::BEGIN@26C4::Utils::BEGIN@26
0000s0sC4::Utils::::hashdumpC4::Utils::hashdump
0000s0sC4::Utils::::maxwidthC4::Utils::maxwidth
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package C4::Utils;
2
3# Copyright 2007 Liblime
4#
5# This file is part of Koha.
6#
7# Koha is free software; you can redistribute it and/or modify it under the
8# terms of the GNU General Public License as published by the Free Software
9# Foundation; either version 2 of the License, or (at your option) any later
10# version.
11#
12# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with Koha; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
21# Useful code I didn't feel like duplicating all over the place.
22#
23
24349µs243µs
# spent 36µs (29+7) within C4::Utils::BEGIN@24 which was called: # once (29µs+7µs) by C4::Auth_with_cas::BEGIN@25 at line 24
use strict;
# spent 36µs making 1 call to C4::Utils::BEGIN@24 # spent 7µs making 1 call to strict::import
25341µs240µs
# spent 26µs (12+14) within C4::Utils::BEGIN@25 which was called: # once (12µs+14µs) by C4::Auth_with_cas::BEGIN@25 at line 25
use warnings;
# spent 26µs making 1 call to C4::Utils::BEGIN@25 # spent 14µs making 1 call to warnings::import
26397µs2210µs
# spent 110µs (11+99) within C4::Utils::BEGIN@26 which was called: # once (11µs+99µs) by C4::Auth_with_cas::BEGIN@25 at line 26
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug);
# spent 110µs making 1 call to C4::Utils::BEGIN@26 # spent 99µs making 1 call to vars::import
27
28
# spent 31µs within C4::Utils::BEGIN@28 which was called: # once (31µs+0s) by C4::Auth_with_cas::BEGIN@25 at line 35
BEGIN {
29636µs require Exporter;
30 $VERSION = 3.07.00.049; # set the version for version checking
31 $debug = $ENV{DEBUG} || 0;
32 @ISA = qw(Exporter);
33 @EXPORT_OK = qw(&maxwidth &hashdump);
34 %EXPORT_TAGS = ( all => [qw(&maxwidth &hashdump)], );
351380µs131µs}
# spent 31µs making 1 call to C4::Utils::BEGIN@28
36
37
38sub maxwidth {
39 (@_) or return 0;
40 return (sort {$a <=> $b} map {length} @_)[-1];
41}
42
43sub hashdump {
44 my $pre = shift;
45 my $val = shift;
46 if (ref($val) =~ /HASH/) {
47 print "$pre = HASH w/ " . scalar(keys %$val) . " keys.\n";
48 my $w2 = maxwidth(keys %$val);
49 foreach (sort keys %$val) {
50 &hashdump($pre . '->{' . sprintf('%' . $w2 .'s', $_) . '}', $val->{$_});
51 }
52 print "\n";
53 } elsif (ref($val) =~ /ARRAY/) {
54 print "$pre = ARRAY w/ " . scalar(@$val) . " members.\n";
55 my $w2 = maxwidth(@$val);
56 foreach (@$val) {
57 &hashdump($pre . '->{' . sprintf('%' . $w2 .'s', $_) . '}', $_);
58 }
59 print "\n";
60 } else {
61 print "$pre = $val\n";
62 }
63}
64
6514µs1;
66__END__