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

Filename/usr/share/koha/lib/C4/ClassSortRoutine.pm
StatementsExecuted 36 statements in 944µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11119µs23µsC4::ClassSortRoutine::::BEGIN@20C4::ClassSortRoutine::BEGIN@20
11117µs28µsC4::ClassSortRoutine::::BEGIN@24C4::ClassSortRoutine::BEGIN@24
11113µs142µsC4::ClassSortRoutine::::BEGIN@27C4::ClassSortRoutine::BEGIN@27
11111µs22µsC4::ClassSortRoutine::::BEGIN@21C4::ClassSortRoutine::BEGIN@21
11110µs12µsC4::ClassSortRoutine::::BEGIN@25C4::ClassSortRoutine::BEGIN@25
1118µs275µsC4::ClassSortRoutine::::GetSortRoutineNamesC4::ClassSortRoutine::GetSortRoutineNames
0000s0sC4::ClassSortRoutine::::GetClassSortKeyC4::ClassSortRoutine::GetClassSortKey
0000s0sC4::ClassSortRoutine::::_get_class_sort_keyC4::ClassSortRoutine::_get_class_sort_key
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package C4::ClassSortRoutine;
2
3# Copyright (C) 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
20328µs227µs
# spent 23µs (19+4) within C4::ClassSortRoutine::BEGIN@20 which was called: # once (19µs+4µs) by C4::ClassSource::BEGIN@25 at line 20
use strict;
# spent 23µs making 1 call to C4::ClassSortRoutine::BEGIN@20 # spent 4µs making 1 call to strict::import
21332µs234µs
# spent 22µs (11+12) within C4::ClassSortRoutine::BEGIN@21 which was called: # once (11µs+12µs) by C4::ClassSource::BEGIN@25 at line 21
use warnings;
# spent 22µs making 1 call to C4::ClassSortRoutine::BEGIN@21 # spent 12µs making 1 call to warnings::import
22
2311µsrequire Exporter;
24333µs238µs
# spent 28µs (17+11) within C4::ClassSortRoutine::BEGIN@24 which was called: # once (17µs+11µs) by C4::ClassSource::BEGIN@25 at line 24
use Class::Factory::Util;
# spent 28µs making 1 call to C4::ClassSortRoutine::BEGIN@24 # spent 11µs making 1 call to Class::Factory::Util::import
25334µs214µs
# spent 12µs (10+2) within C4::ClassSortRoutine::BEGIN@25 which was called: # once (10µs+2µs) by C4::ClassSource::BEGIN@25 at line 25
use C4::Context;
# spent 12µs making 1 call to C4::ClassSortRoutine::BEGIN@25 # spent 2µs making 1 call to C4::Context::import
26
273425µs2270µs
# spent 142µs (13+128) within C4::ClassSortRoutine::BEGIN@27 which was called: # once (13µs+128µs) by C4::ClassSource::BEGIN@25 at line 27
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# spent 142µs making 1 call to C4::ClassSortRoutine::BEGIN@27 # spent 128µs making 1 call to vars::import
28
29# set the version for version checking
3011µs$VERSION = 3.07.00.049;
31
32=head1 NAME
33
- -
45111µs@ISA = qw(Exporter);
461900ns@EXPORT = qw(
47 &GetSortRoutineNames
48 &GetClassSortKey
49);
50
51# intialization code
521600nsmy %loaded_routines = ();
5314µs1275µsmy @sort_routines = GetSortRoutineNames();
# spent 275µs making 1 call to C4::ClassSortRoutine::GetSortRoutineNames
5412µsforeach my $sort_routine (@sort_routines) {
553133µs if (eval "require C4::ClassSortRoutine::$sort_routine") {
# spent 132µs executing statements in string eval # spent 110µs executing statements in string eval # spent 85µs executing statements in string eval
5631µs my $ref;
573109µs eval "\$ref = \\\&C4::ClassSortRoutine::${sort_routine}::get_class_sort_key";
# spent 9µs executing statements in string eval # spent 5µs executing statements in string eval # spent 4µs executing statements in string eval
58388µs if (eval "\$ref->(\"a\", \"b\")") {
# spent 35µs executing statements in 3 string evals (merged)
59 $loaded_routines{$sort_routine} = $ref;
60 } else {
61 $loaded_routines{$sort_routine} = \&_get_class_sort_key;
62 }
63 } else {
64 $loaded_routines{$sort_routine} = \&_get_class_sort_key;
65 }
66}
67
68=head2 GetSortRoutineNames
69
- -
79
# spent 275µs (8+267) within C4::ClassSortRoutine::GetSortRoutineNames which was called: # once (8µs+267µs) by C4::ClassSource::BEGIN@25 at line 53
sub GetSortRoutineNames {
8019µs1267µs return C4::ClassSortRoutine->subclasses();
# spent 267µs making 1 call to Class::Factory::Util::_subclasses
81}
82
83=head2 GetClassSortKey
84
- -
93sub GetClassSortKey {
94 my ($sort_routine, $cn_class, $cn_item) = @_;
95 unless (exists $loaded_routines{$sort_routine}) {
96 warn "attempting to use non-existent class sorting routine $sort_routine\n";
97 $loaded_routines{$sort_routine} = \&_get_class_sort_key;
98 }
99 my $key = $loaded_routines{$sort_routine}->($cn_class, $cn_item);
100 # FIXME -- hardcoded length for cn_sort
101 # should replace with some way of getting column widths from
102 # the DB schema -- since doing this should ideally be
103 # independent of the DBMS, deferring for the moment.
104 return substr($key, 0, 30);
105}
106
107=head2 _get_class_sort_key
108
- -
116sub _get_class_sort_key {
117 my ($cn_class, $cn_item) = @_;
118 my $key = uc "$cn_class $cn_item";
119 $key =~ s/\s+/_/;
120 $key =~ s/[^A-Z_0-9]//g;
121 return $key;
122}
123
124129µs1;
125
126=head1 AUTHOR
127
- -