← 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:51 2012

Filename/cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/scpzipfiles.pm
StatementsExecuted 349317 statements in 1.23s

NOTE!

While profiling this file Perl noted the use of one or more special variables that impact the performance of all regular expressions in the program.

Use of the "$`", "$&", and "$'" variables should be replaced with faster alternatives.
See the WARNING at the end of the Capture Buffers section of the perlre documentation.

The use is detected by perl at compile time but by NYTProf during execution. NYTProf first noted it when executing line 34. That was probably the first statement executed by the program after perl compiled the code containing the variables. If the variables can't be found by studying the source code, try using the Devel::FindAmpersand or B::Lint modules.

Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11232930ms1.11sinstaller::scpzipfiles::::replace_all_ziplistvariables_in_fileinstaller::scpzipfiles::replace_all_ziplistvariables_in_file
28350811154ms154msinstaller::scpzipfiles::::CORE:substinstaller::scpzipfiles::CORE:subst (opcode)
221115ms1.42sinstaller::scpzipfiles::::resolving_scpzip_replace_flaginstaller::scpzipfiles::resolving_scpzip_replace_flag
91091125.7ms25.7msinstaller::scpzipfiles::::CORE:substcontinstaller::scpzipfiles::CORE:substcont (opcode)
16005217.71ms7.71msinstaller::scpzipfiles::::CORE:matchinstaller::scpzipfiles::CORE:match (opcode)
111347µs350µsinstaller::scpzipfiles::::BEGIN@30installer::scpzipfiles::BEGIN@30
11011202µs202µsinstaller::scpzipfiles::::CORE:regcompinstaller::scpzipfiles::CORE:regcomp (opcode)
11119µs49µsinstaller::scpzipfiles::::BEGIN@32installer::scpzipfiles::BEGIN@32
11116µs18µsinstaller::scpzipfiles::::BEGIN@34installer::scpzipfiles::BEGIN@34
11115µs17µsinstaller::scpzipfiles::::BEGIN@31installer::scpzipfiles::BEGIN@31
11114µs16µsinstaller::scpzipfiles::::BEGIN@33installer::scpzipfiles::BEGIN@33
0000s0sinstaller::scpzipfiles::::replace_all_ziplistvariables_in_rtffileinstaller::scpzipfiles::replace_all_ziplistvariables_in_rtffile
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::scpzipfiles;
29
30260µs2353µs
# spent 350µs (347+3) within installer::scpzipfiles::BEGIN@30 which was called: # once (347µs+3µs) by installer::worker::BEGIN@42 at line 30
use installer::files;
# spent 350µs making 1 call to installer::scpzipfiles::BEGIN@30 # spent 3µs making 1 call to UNIVERSAL::import
31262µs220µs
# spent 17µs (15+3) within installer::scpzipfiles::BEGIN@31 which was called: # once (15µs+3µs) by installer::worker::BEGIN@42 at line 31
use installer::globals;
# spent 17µs making 1 call to installer::scpzipfiles::BEGIN@31 # spent 3µs making 1 call to UNIVERSAL::import
32254µs279µs
# spent 49µs (19+30) within installer::scpzipfiles::BEGIN@32 which was called: # once (19µs+30µs) by installer::worker::BEGIN@42 at line 32
use installer::logger;
# spent 49µs making 1 call to installer::scpzipfiles::BEGIN@32 # spent 30µs making 1 call to Exporter::import
33252µs218µs
# spent 16µs (14+2) within installer::scpzipfiles::BEGIN@33 which was called: # once (14µs+2µs) by installer::worker::BEGIN@42 at line 33
use installer::pathanalyzer;
# spent 16µs making 1 call to installer::scpzipfiles::BEGIN@33 # spent 2µs making 1 call to UNIVERSAL::import
3421.03ms221µs
# spent 18µs (16+3) within installer::scpzipfiles::BEGIN@34 which was called: # once (16µs+3µs) by installer::worker::BEGIN@42 at line 34
use installer::systemactions;
# spent 18µs making 1 call to installer::scpzipfiles::BEGIN@34 # spent 3µs making 1 call to UNIVERSAL::import
35
36# Replacing all zip list variables.
37# Called for setup script as well as files with flag scpzip_replace.
38
39sub replace_all_ziplistvariables_in_file
40
# spent 1.11s (930ms+180ms) within installer::scpzipfiles::replace_all_ziplistvariables_in_file which was called 112 times, avg 9.91ms/call: # 110 times (114ms+52.7ms) by installer::scpzipfiles::resolving_scpzip_replace_flag at line 135, avg 1.52ms/call # once (412ms+63.4ms) by installer::run at line 350 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm # once (404ms+63.8ms) by installer::run at line 326 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
41112144µs my ( $fileref, $variablesref ) = @_;
42
43112688µs for my $line ( @{$fileref} )
44 {
45 # Avoid removing variables we do not recognise.
462835081.11s292617180ms $line =~ s/\$\{(\w+)\}/defined $variablesref->{$1}
# spent 154ms making 283508 calls to installer::scpzipfiles::CORE:subst, avg 544ns/call # spent 25.7ms making 9109 calls to installer::scpzipfiles::CORE:substcont, avg 3µs/call
47 ? $variablesref->{$1}
48 : $&/eg;
49 }
50}
51
52# Replacing all zip list variables in rtf files.
53
54sub replace_all_ziplistvariables_in_rtffile
55{
56 my ( $fileref, $variablesref ) = @_;
57
58 for my $line ( @{$fileref} )
59 {
60 # In rtf files the braces are backslash-escaped.
61 # Avoid removing variables we do not recognise.
62 $line =~ s/\$\\\{(\w+)\\\}/defined $variablesref->{$1}
63 ? $variablesref->{$1}
64 : $&/eg;
65 }
66}
67
68#########################################################
69# Analyzing files with flag SCPZIP_REPLACE
70# $item can be "File" or "ScpAction"
71#########################################################
72
73sub resolving_scpzip_replace_flag
74
# spent 1.42s (115ms+1.30) within installer::scpzipfiles::resolving_scpzip_replace_flag which was called 2 times, avg 708ms/call: # once (115ms+1.01s) by installer::run at line 713 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm # once (38µs+289ms) by installer::run at line 762 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
{
7526µs my ($filesarrayref, $variableshashref, $item, $languagestringref) = @_;
76
7724µs my $diritem = lc($item);
78
79215µs2558ms my $replacedirbase = installer::systemactions::create_directories("replace_$diritem", $languagestringref);
# spent 558ms making 2 calls to installer::systemactions::create_directories, avg 279ms/call
80
81218µs2320µs installer::logger::include_header_into_logfile("$item with flag SCPZIP:");
# spent 320µs making 2 calls to installer::logger::include_header_into_logfile, avg 160µs/call
82
83217.7ms for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
84 {
851589510.5ms my $onefile = ${$filesarrayref}[$i];
86158956.81ms my $styles = "";
87
881589519.6ms if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
89
901589553.6ms158957.55ms if ( $styles =~ /\bSCPZIP_REPLACE\b/ )
# spent 7.55ms making 15895 calls to installer::scpzipfiles::CORE:match, avg 475ns/call
91 {
92 # Language specific subdirectory
93
94110146µs my $onelanguage = $onefile->{'specificlanguage'};
95
9611080µs if ($onelanguage eq "")
97 {
98 $onelanguage = "00"; # files without language into directory "00"
99 }
100
101110167µs my $replacedir = $replacedirbase . $installer::globals::separator . $onelanguage . $installer::globals::separator;
102110374µs11076.0ms installer::systemactions::create_directory($replacedir); # creating language specific directories
# spent 76.0ms making 110 calls to installer::systemactions::create_directory, avg 691µs/call
103
104 # copy files and edit them with the variables defined in the zip.lst
105
10611079µs my $longfilename = 0;
107
108110170µs my $onefilename = $onefile->{'Name'};
109110104µs my $sourcepath = $onefile->{'sourcepath'};
110
1111101.12ms220355µs if ( $onefilename =~ /^\s*\Q$installer::globals::separator\E/ ) # filename begins with a slash, for instance /registry/schema/org/openoffice/VCL.xcs
# spent 202µs making 110 calls to installer::scpzipfiles::CORE:regcomp, avg 2µs/call # spent 153µs making 110 calls to installer::scpzipfiles::CORE:match, avg 1µs/call
112 {
113 $onefilename =~ s/^\s*\Q$installer::globals::separator\E//;
114 $longfilename = 1;
115 }
116
117110105µs my $destinationpath = $replacedir . $onefilename;
11811094µs my $movepath = $destinationpath . ".orig";
119
12011043µs if ( $longfilename ) # the destination directory has to be created before copying
121 {
122 my $destdir = $movepath;
123 installer::pathanalyzer::get_path_from_fullqualifiedname(\$destdir);
124 installer::systemactions::create_directory_structure($destdir);
125 }
126
127110414µs110252ms my $copysuccess = installer::systemactions::copy_one_file($sourcepath, $movepath);
# spent 252ms making 110 calls to installer::systemactions::copy_one_file, avg 2.29ms/call
128
129110158µs if ( $copysuccess )
130 {
131 # Now the file can be edited
132 # ToDo: How about binary patching?
133
134110463µs110148ms my $onefileref = installer::files::read_file($movepath);
# spent 148ms making 110 calls to installer::files::read_file, avg 1.35ms/call
135110452µs110167ms replace_all_ziplistvariables_in_file($onefileref, $variableshashref);
# spent 167ms making 110 calls to installer::scpzipfiles::replace_all_ziplistvariables_in_file, avg 1.52ms/call
1361109.56ms11090.3ms installer::files::save_file($destinationpath ,$onefileref);
# spent 90.3ms making 110 calls to installer::files::save_file, avg 821µs/call
137 }
138
139 # Saving the original source, where the file was found
140110368µs $onefile->{'originalsourcepath'} = $onefile->{'sourcepath'};
141
142 # Writing the new sourcepath into the hashref, even if it was no copied
143
144110239µs $onefile->{'sourcepath'} = $destinationpath;
145 }
146 }
147
14823µs my $infoline = "\n";
149229µs push( @installer::globals::logfileinfo, $infoline);
150}
151
15218µs1;
 
# spent 7.71ms within installer::scpzipfiles::CORE:match which was called 16005 times, avg 481ns/call: # 15895 times (7.55ms+0s) by installer::scpzipfiles::resolving_scpzip_replace_flag at line 90, avg 475ns/call # 110 times (153µs+0s) by installer::scpzipfiles::resolving_scpzip_replace_flag at line 111, avg 1µs/call
sub installer::scpzipfiles::CORE:match; # opcode
# spent 202µs within installer::scpzipfiles::CORE:regcomp which was called 110 times, avg 2µs/call: # 110 times (202µs+0s) by installer::scpzipfiles::resolving_scpzip_replace_flag at line 111, avg 2µs/call
sub installer::scpzipfiles::CORE:regcomp; # opcode
# spent 154ms within installer::scpzipfiles::CORE:subst which was called 283508 times, avg 544ns/call: # 283508 times (154ms+0s) by installer::scpzipfiles::replace_all_ziplistvariables_in_file at line 46, avg 544ns/call
sub installer::scpzipfiles::CORE:subst; # opcode
# spent 25.7ms within installer::scpzipfiles::CORE:substcont which was called 9109 times, avg 3µs/call: # 9109 times (25.7ms+0s) by installer::scpzipfiles::replace_all_ziplistvariables_in_file at line 46, avg 3µs/call
sub installer::scpzipfiles::CORE:substcont; # opcode