← Index
NYTProf Performance Profile   « block view • line view • sub view »
For C:/lo/libo-master/solenv/bin/make_installer.pl
  Run on Mon Sep 24 00:52:54 2012
Reported on Mon Sep 24 07:34:33 2012

Filename/cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/scppatchsoname.pm
StatementsExecuted 65405 statements in 126ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
221110ms735msinstaller::scppatchsoname::::resolving_patchsoname_flaginstaller::scppatchsoname::resolving_patchsoname_flag
15904217.19ms7.19msinstaller::scppatchsoname::::CORE:matchinstaller::scppatchsoname::CORE:match (opcode)
1115.40ms6.10msinstaller::scppatchsoname::::BEGIN@33installer::scppatchsoname::BEGIN@33
9112.95ms2.95msinstaller::scppatchsoname::::CORE:substinstaller::scppatchsoname::CORE:subst (opcode)
9111.25ms1.25msinstaller::scppatchsoname::::change_length_of_stringinstaller::scppatchsoname::change_length_of_string
9111.15ms19.9msinstaller::scppatchsoname::::replace_productname_in_fileinstaller::scppatchsoname::replace_productname_in_file
911387µs387µsinstaller::scppatchsoname::::convert_to_unicodeinstaller::scppatchsoname::convert_to_unicode
111348µs352µsinstaller::scppatchsoname::::BEGIN@30installer::scppatchsoname::BEGIN@30
91147µs47µsinstaller::scppatchsoname::::CORE:regcompinstaller::scppatchsoname::CORE:regcomp (opcode)
11117µs20µsinstaller::scppatchsoname::::BEGIN@34installer::scppatchsoname::BEGIN@34
11115µs55µsinstaller::scppatchsoname::::BEGIN@32installer::scppatchsoname::BEGIN@32
11114µs16µsinstaller::scppatchsoname::::BEGIN@31installer::scppatchsoname::BEGIN@31
0000s0sinstaller::scppatchsoname::::change_length_of_string_with_letterinstaller::scppatchsoname::change_length_of_string_with_letter
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org. If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28package installer::scppatchsoname;
29
30266µs2355µs
# spent 352µs (348+4) within installer::scppatchsoname::BEGIN@30 which was called: # once (348µs+4µs) by installer::BEGIN@53 at line 30
use installer::files;
# spent 352µs making 1 call to installer::scppatchsoname::BEGIN@30 # spent 4µs making 1 call to UNIVERSAL::import
31253µs218µs
# spent 16µs (14+2) within installer::scppatchsoname::BEGIN@31 which was called: # once (14µs+2µs) by installer::BEGIN@53 at line 31
use installer::globals;
# spent 16µs making 1 call to installer::scppatchsoname::BEGIN@31 # spent 2µs making 1 call to UNIVERSAL::import
32254µs294µs
# spent 55µs (15+39) within installer::scppatchsoname::BEGIN@32 which was called: # once (15µs+39µs) by installer::BEGIN@53 at line 32
use installer::logger;
# spent 55µs making 1 call to installer::scppatchsoname::BEGIN@32 # spent 39µs making 1 call to Exporter::import
3321.14ms26.14ms
# spent 6.10ms (5.40+699µs) within installer::scppatchsoname::BEGIN@33 which was called: # once (5.40ms+699µs) by installer::BEGIN@53 at line 33
use installer::setupscript;
# spent 6.10ms making 1 call to installer::scppatchsoname::BEGIN@33 # spent 39µs making 1 call to Exporter::import
3421.46ms222µs
# spent 20µs (17+3) within installer::scppatchsoname::BEGIN@34 which was called: # once (17µs+3µs) by installer::BEGIN@53 at line 34
use installer::systemactions;
# spent 20µs making 1 call to installer::scppatchsoname::BEGIN@34 # spent 3µs making 1 call to UNIVERSAL::import
35
36########################################################################################
37# The length of the new string must be identical with the length of the old string
38########################################################################################
39
40sub change_length_of_string
41
# spent 1.25ms within installer::scppatchsoname::change_length_of_string which was called 9 times, avg 139µs/call: # 9 times (1.25ms+0s) by installer::scppatchsoname::replace_productname_in_file at line 105, avg 139µs/call
{
4211501.27ms my ($newstringref, $oldstring) = @_;
43
44 while ( length($$newstringref) < length($oldstring) )
45 {
46 $$newstringref = $$newstringref . chr(0);
47 }
48}
49
50########################################################################################
51# The length of the new string must be identical with the length of the old string
52########################################################################################
53
54sub change_length_of_string_with_letter
55{
56 my ($newstringref, $oldstring, $onestring) = @_;
57
58 while ( length($$newstringref) < length($oldstring) )
59 {
60 $$newstringref = $$newstringref . $onestring;
61 }
62}
63
64########################################################################################
65# Converting a string to a unicode string
66########################################################################################
67
68sub convert_to_unicode
69
# spent 387µs within installer::scppatchsoname::convert_to_unicode which was called 9 times, avg 43µs/call: # 9 times (387µs+0s) by installer::scppatchsoname::replace_productname_in_file at line 103, avg 43µs/call
{
70353405µs my ($string) = @_;
71
72 my $unicodestring = "";
73
74 my $stringlength = length($string);
75
76 for ( my $i = 0; $i < $stringlength; $i++ )
77 {
78 $unicodestring = $unicodestring . substr($string, $i, 1);
79 $unicodestring = $unicodestring . chr(0);
80 }
81
82 return $unicodestring;
83}
84
85########################################################################################
86# Replacing the so name in all files with flag PATCH_SO_NAME
87########################################################################################
88
89sub replace_productname_in_file
90
# spent 19.9ms (1.15+18.8) within installer::scppatchsoname::replace_productname_in_file which was called 9 times, avg 2.21ms/call: # 9 times (1.15ms+18.8ms) by installer::scppatchsoname::resolving_patchsoname_flag at line 183, avg 2.21ms/call
{
911354.09ms my ($sourcepath, $destpath, $variableshashref, $onefilehash, $styles) = @_;
92
9395.03ms my $onefile = installer::files::read_binary_file($sourcepath);
# spent 5.03ms making 9 calls to installer::files::read_binary_file, avg 558µs/call
94
95 # searching for "x"
96
97 my $onestring = "x" . chr(0);
98 my $replacestring = "";
99 for ( my $i = 1; $i <= 80; $i++ ) { $replacestring .= $onestring; }
100
101 my $productname = $variableshashref->{'PRODUCTNAME'} . " " . $variableshashref->{'PRODUCTVERSION'};
102 if ( exists($onefilehash->{'FileDescription'}) ) { $productname = $onefilehash->{'FileDescription'}; }
1039387µs my $unicode_productname = convert_to_unicode($productname);
# spent 387µs making 9 calls to installer::scppatchsoname::convert_to_unicode, avg 43µs/call
104
10591.25ms change_length_of_string(\$unicode_productname, $replacestring);
# spent 1.25ms making 9 calls to installer::scppatchsoname::change_length_of_string, avg 139µs/call
106
107183.00ms my $found1 = $onefile =~ s/$replacestring/$unicode_productname/sg;
# spent 2.95ms making 9 calls to installer::scppatchsoname::CORE:subst, avg 328µs/call # spent 47µs making 9 calls to installer::scppatchsoname::CORE:regcomp, avg 5µs/call
108
109 my $found2 = 0;
110
111915µs if ( $styles =~ /\bPATCH_SO_NAME_Z\b/ )
# spent 15µs making 9 calls to installer::scppatchsoname::CORE:match, avg 2µs/call
112 {
113 # searching for "z"
114
115 $onestring = "z" . chr(0);
116 $replacestring = "";
117 for ( my $i = 1; $i <= 80; $i++ ) { $replacestring .= $onestring; }
118
119 my $productname2 = $variableshashref->{'PRODUCTNAME'} . " " . $variableshashref->{'PRODUCTVERSION'};
120 if ( exists($onefilehash->{'FileDescriptionZ'}) ) { $productname2 = $onefilehash->{'FileDescriptionZ'}; }
121 my $unicode_productname2 = convert_to_unicode($productname2);
122
123 change_length_of_string_with_letter(\$unicode_productname2, $replacestring, $onestring);
124
125 $found2 = $onefile =~ s/$replacestring/$unicode_productname2/sg;
126 }
127
12899.09ms installer::files::save_binary_file($onefile, $destpath);
# spent 9.09ms making 9 calls to installer::files::save_binary_file, avg 1.01ms/call
129
130 my $found = $found1 + $found2;
131
132 return $found;
133}
134
135#########################################################
136# Analyzing files with flag PATCH_SO_NAME
137#########################################################
138
139sub resolving_patchsoname_flag
140
# spent 735ms (110+625) within installer::scppatchsoname::resolving_patchsoname_flag which was called 2 times, avg 367ms/call: # once (110ms+333ms) by installer::run at line 723 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm # once (38µs+292ms) by installer::run at line 764 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
14163756117ms my ($filesarrayref, $variableshashref, $item, $languagestringref) = @_;
142
143 my $diritem = lc($item);
144
1452574ms my $replacedirbase = installer::systemactions::create_directories("patchsoname_$diritem", $languagestringref);
# spent 574ms making 2 calls to installer::systemactions::create_directories, avg 287ms/call
146
1472320µs installer::logger::include_header_into_logfile("$item with flag PATCH_SO_NAME:");
# spent 320µs making 2 calls to installer::logger::include_header_into_logfile, avg 160µs/call
148
149 for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
150 {
151 my $onefile = ${$filesarrayref}[$i];
152 my $styles = "";
153
154 if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
155
156158957.18ms if ( $styles =~ /\bPATCH_SO_NAME\b/ )
# spent 7.18ms making 15895 calls to installer::scppatchsoname::CORE:match, avg 451ns/call
157 {
158 # Language specific subdirectory
159
160 my $onelanguage = $onefile->{'specificlanguage'};
161 my $filedescription = "";
162
163 if ($onelanguage eq "")
164 {
165 $onelanguage = "00"; # files without language into directory "00"
166 }
167
168 my $replacedir = $replacedirbase . $installer::globals::separator . $onelanguage . $installer::globals::separator;
16992.88ms installer::systemactions::create_directory($replacedir); # creating language specific directories
# spent 2.88ms making 9 calls to installer::systemactions::create_directory, avg 321µs/call
170
171 # copy files and edit them with the variables defined in the zip.lst
172
173 my $onefilename = $onefile->{'Name'};
174 my $sourcepath = $onefile->{'sourcepath'};
175 my $destinationpath = $replacedir . $onefilename;
176 my $movepath = $destinationpath . ".orig";
177
178920.8ms my $copysuccess = installer::systemactions::copy_one_file($sourcepath, $movepath);
# spent 20.8ms making 9 calls to installer::systemactions::copy_one_file, avg 2.31ms/call
179
180 if ( $copysuccess )
181 {
182 # Now the file can be patch (binary!)
183919.9ms my $found = replace_productname_in_file($movepath, $destinationpath, $variableshashref, $onefile, $styles);
# spent 19.9ms making 9 calls to installer::scppatchsoname::replace_productname_in_file, avg 2.21ms/call
184
185 if ($found == 0)
186 {
187 my $infoline = "Did not patch the file $destinationpath\n";
188 push( @installer::globals::logfileinfo, $infoline);
189 }
190 else
191 {
192 my $infoline = "Successfully patched $destinationpath, Count: $found\n";
193 push( @installer::globals::logfileinfo, $infoline);
194 }
195 }
196
197 # Saving the original source, where the file was found
198 $onefile->{'originalsourcepath'} = $onefile->{'sourcepath'};
199
200 # Saving the original source, where the file was found
201 $onefile->{'originalsourcepath'} = $onefile->{'sourcepath'};
202
203 # Writing the new sourcepath into the hashref, even if it was no copied
204
205 $onefile->{'sourcepath'} = $destinationpath;
206 }
207 }
208
209 my $infoline = "\n";
210 push( @installer::globals::logfileinfo, $infoline);
211}
212
21317µs1;
 
# spent 7.19ms within installer::scppatchsoname::CORE:match which was called 15904 times, avg 452ns/call: # 15895 times (7.18ms+0s) by installer::scppatchsoname::resolving_patchsoname_flag at line 156, avg 451ns/call # 9 times (15µs+0s) by installer::scppatchsoname::replace_productname_in_file at line 111, avg 2µs/call
sub installer::scppatchsoname::CORE:match; # opcode
# spent 47µs within installer::scppatchsoname::CORE:regcomp which was called 9 times, avg 5µs/call: # 9 times (47µs+0s) by installer::scppatchsoname::replace_productname_in_file at line 107, avg 5µs/call
sub installer::scppatchsoname::CORE:regcomp; # opcode
# spent 2.95ms within installer::scppatchsoname::CORE:subst which was called 9 times, avg 328µs/call: # 9 times (2.95ms+0s) by installer::scppatchsoname::replace_productname_in_file at line 107, avg 328µs/call
sub installer::scppatchsoname::CORE:subst; # opcode