Filename | /usr/share/koha/lib/C4/ClassSortRoutine/Dewey.pm |
Statements | Executed 29 statements in 468µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 65µs | 10.9ms | get_class_sort_key | C4::ClassSortRoutine::Dewey::
5 | 5 | 1 | 57µs | 10.9ms | CORE:subst (opcode) | C4::ClassSortRoutine::Dewey::
1 | 1 | 1 | 19µs | 24µs | BEGIN@20 | C4::ClassSortRoutine::Dewey::
1 | 1 | 1 | 10µs | 23µs | BEGIN@21 | C4::ClassSortRoutine::Dewey::
1 | 1 | 1 | 9µs | 34µs | BEGIN@23 | C4::ClassSortRoutine::Dewey::
2 | 1 | 1 | 3µs | 3µs | CORE:match (opcode) | C4::ClassSortRoutine::Dewey::
2 | 1 | 1 | 2µs | 2µs | CORE:substcont (opcode) | C4::ClassSortRoutine::Dewey::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package C4::ClassSortRoutine::Dewey; | ||||
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 | |||||
20 | 3 | 35µs | 2 | 28µs | # spent 24µs (19+4) within C4::ClassSortRoutine::Dewey::BEGIN@20 which was called:
# once (19µs+4µs) by C4::ClassSource::BEGIN@25 at line 20 # spent 24µs making 1 call to C4::ClassSortRoutine::Dewey::BEGIN@20
# spent 4µs making 1 call to strict::import |
21 | 3 | 34µs | 2 | 36µs | # spent 23µs (10+13) within C4::ClassSortRoutine::Dewey::BEGIN@21 which was called:
# once (10µs+13µs) by C4::ClassSource::BEGIN@25 at line 21 # spent 23µs making 1 call to C4::ClassSortRoutine::Dewey::BEGIN@21
# spent 13µs making 1 call to warnings::import |
22 | |||||
23 | 3 | 268µs | 2 | 59µs | # spent 34µs (9+25) within C4::ClassSortRoutine::Dewey::BEGIN@23 which was called:
# once (9µs+25µs) by C4::ClassSource::BEGIN@25 at line 23 # spent 34µs making 1 call to C4::ClassSortRoutine::Dewey::BEGIN@23
# spent 25µs making 1 call to vars::import |
24 | |||||
25 | # set the version for version checking | ||||
26 | 1 | 2µs | $VERSION = 3.07.00.049; | ||
27 | |||||
28 | =head1 NAME | ||||
29 | |||||
- - | |||||
58 | # spent 10.9ms (65µs+10.9) within C4::ClassSortRoutine::Dewey::get_class_sort_key which was called:
# once (65µs+10.9ms) by C4::ClassSource::BEGIN@25 at line 1 of (eval 1001)[/usr/share/koha/lib/C4/ClassSortRoutine.pm:58] | ||||
59 | 16 | 68µs | my ($cn_class, $cn_item) = @_; | ||
60 | |||||
61 | $cn_class = '' unless defined $cn_class; | ||||
62 | $cn_item = '' unless defined $cn_item; | ||||
63 | my $init = uc "$cn_class $cn_item"; | ||||
64 | 1 | 2µs | $init =~ s/^\s+//; # spent 2µs making 1 call to C4::ClassSortRoutine::Dewey::CORE:subst | ||
65 | 1 | 2µs | $init =~ s/\s+$//; # spent 2µs making 1 call to C4::ClassSortRoutine::Dewey::CORE:subst | ||
66 | 1 | 500ns | $init =~ s!/!!g; # spent 500ns making 1 call to C4::ClassSortRoutine::Dewey::CORE:subst | ||
67 | 1 | 26µs | 4 | 10.7ms | $init =~ s/^([\p{IsAlpha}]+)/$1 /; # spent 5.34ms making 1 call to C4::ClassSortRoutine::Dewey::CORE:subst
# spent 5.31ms making 1 call to utf8::SWASHNEW
# spent 2µs making 2 calls to C4::ClassSortRoutine::Dewey::CORE:substcont, avg 1µs/call |
68 | my @tokens = split /\.|\s+/, $init; | ||||
69 | my $digit_group_count = 0; | ||||
70 | 2 | 12µs | for (my $i = 0; $i <= $#tokens; $i++) { | ||
71 | 2 | 3µs | if ($tokens[$i] =~ /^\d+$/) { # spent 3µs making 2 calls to C4::ClassSortRoutine::Dewey::CORE:match, avg 1µs/call | ||
72 | $digit_group_count++; | ||||
73 | if (2 == $digit_group_count) { | ||||
74 | $tokens[$i] = sprintf("%-15.15s", $tokens[$i]); | ||||
75 | $tokens[$i] =~ tr/ /0/; | ||||
76 | } | ||||
77 | } | ||||
78 | } | ||||
79 | # Pad the first digit_group if there was only one | ||||
80 | if (1 == $digit_group_count) { | ||||
81 | $tokens[0] .= '_000000000000000' | ||||
82 | } | ||||
83 | my $key = join("_", @tokens); | ||||
84 | 1 | 20µs | 2 | 11.0ms | $key =~ s/[^\p{IsAlnum}_]//g; # spent 5.52ms making 1 call to C4::ClassSortRoutine::Dewey::CORE:subst
# spent 5.49ms making 1 call to utf8::SWASHNEW |
85 | |||||
86 | return $key; | ||||
87 | |||||
88 | } | ||||
89 | |||||
90 | 1 | 3µs | 1; | ||
91 | |||||
92 | =head1 AUTHOR | ||||
93 | |||||
- - | |||||
# spent 3µs within C4::ClassSortRoutine::Dewey::CORE:match which was called 2 times, avg 1µs/call:
# 2 times (3µs+0s) by C4::ClassSortRoutine::Dewey::get_class_sort_key at line 71, avg 1µs/call | |||||
# spent 10.9ms (57µs+10.8) within C4::ClassSortRoutine::Dewey::CORE:subst which was called 5 times, avg 2.17ms/call:
# once (27µs+5.49ms) by C4::ClassSortRoutine::Dewey::get_class_sort_key at line 84
# once (24µs+5.31ms) by C4::ClassSortRoutine::Dewey::get_class_sort_key at line 67
# once (2µs+0s) by C4::ClassSortRoutine::Dewey::get_class_sort_key at line 64
# once (2µs+0s) by C4::ClassSortRoutine::Dewey::get_class_sort_key at line 65
# once (500ns+0s) by C4::ClassSortRoutine::Dewey::get_class_sort_key at line 66 | |||||
# spent 2µs within C4::ClassSortRoutine::Dewey::CORE:substcont which was called 2 times, avg 1µs/call:
# 2 times (2µs+0s) by C4::ClassSortRoutine::Dewey::get_class_sort_key at line 67, avg 1µs/call |