← Index
NYTProf Performance Profile   « line view »
For webmerge/scripts/webmerge.pl
  Run on Mon Oct 7 02:42:42 2013
Reported on Mon Oct 7 03:03:23 2013

Filename/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Optimize.pm
StatementsExecuted 34 statements in 6.08ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
777278µs278µsRTP::Webmerge::Optimize::::optimizeRTP::Webmerge::Optimize::optimize
111113µs401µsRTP::Webmerge::Optimize::::BEGIN@84RTP::Webmerge::Optimize::BEGIN@84
11192µs323µsRTP::Webmerge::Optimize::::BEGIN@87RTP::Webmerge::Optimize::BEGIN@87
11189µs354µsRTP::Webmerge::Optimize::::BEGIN@11RTP::Webmerge::Optimize::BEGIN@11
11183µs312µsRTP::Webmerge::Optimize::::BEGIN@90RTP::Webmerge::Optimize::BEGIN@90
11157µs57µsRTP::Webmerge::Optimize::::BEGIN@26.24RTP::Webmerge::Optimize::BEGIN@26.24
11156µs90µsRTP::Webmerge::Optimize::::BEGIN@13RTP::Webmerge::Optimize::BEGIN@13
11152µs139µsRTP::Webmerge::Optimize::::BEGIN@12RTP::Webmerge::Optimize::BEGIN@12
11130µs30µsRTP::Webmerge::Optimize::::BEGIN@29RTP::Webmerge::Optimize::BEGIN@29
11129µs29µsRTP::Webmerge::Optimize::::BEGIN@32RTP::Webmerge::Optimize::BEGIN@32
11124µs24µsRTP::Webmerge::Optimize::::BEGIN@23RTP::Webmerge::Optimize::BEGIN@23
11124µs24µsRTP::Webmerge::Optimize::::BEGIN@26RTP::Webmerge::Optimize::BEGIN@26
0000s0sRTP::Webmerge::Optimize::::__ANON__[:150]RTP::Webmerge::Optimize::__ANON__[:150]
0000s0sRTP::Webmerge::Optimize::::optimizerRTP::Webmerge::Optimize::optimizer
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1###################################################################################################
2# Copyright 2013 by Marcel Greter
3# This file is part of Webmerge (GPL3)
4###################################################################################################
5# If you need to optimize other files, you may use this software
6# http://nikkhokkho.sourceforge.net/static.php?page=FileOptimizer
7###################################################################################################
8package RTP::Webmerge::Optimize;
9###################################################################################################
10
112165µs2618µs
# spent 354µs (89+265) within RTP::Webmerge::Optimize::BEGIN@11 which was called: # once (89µs+265µs) by main::BEGIN@35 at line 11
use Carp;
# spent 354µs making 1 call to RTP::Webmerge::Optimize::BEGIN@11 # spent 265µs making 1 call to Exporter::import
122146µs2227µs
# spent 139µs (52+88) within RTP::Webmerge::Optimize::BEGIN@12 which was called: # once (52µs+88µs) by main::BEGIN@35 at line 12
use strict;
# spent 139µs making 1 call to RTP::Webmerge::Optimize::BEGIN@12 # spent 88µs making 1 call to strict::import
132255µs2123µs
# spent 90µs (56+33) within RTP::Webmerge::Optimize::BEGIN@13 which was called: # once (56µs+33µs) by main::BEGIN@35 at line 13
use warnings;
# spent 90µs making 1 call to RTP::Webmerge::Optimize::BEGIN@13 # spent 33µs making 1 call to warnings::import
14
15###################################################################################################
16
17# global variables
1812µsour (%optimizer);
19
20###################################################################################################
21
22# define our version string
231168µs124µs
# spent 24µs within RTP::Webmerge::Optimize::BEGIN@23 which was called: # once (24µs+0s) by main::BEGIN@35 at line 23
BEGIN { $RTP::Webmerge::Optimize::VERSION = "0.70" }
# spent 24µs making 1 call to RTP::Webmerge::Optimize::BEGIN@23
24
25# load exporter and inherit from it
263374µs280µs
# spent 24µs within RTP::Webmerge::Optimize::BEGIN@26 which was called: # once (24µs+0s) by main::BEGIN@35 at line 26 # spent 57µs within RTP::Webmerge::Optimize::BEGIN@26.24 which was called: # once (57µs+0s) by main::BEGIN@35 at line 26
BEGIN { use Exporter qw(); our @ISA = qw(Exporter) }
# spent 57µs making 1 call to RTP::Webmerge::Optimize::BEGIN@26.24 # spent 24µs making 1 call to RTP::Webmerge::Optimize::BEGIN@26
27
28# define our functions to be exported
291184µs130µs
# spent 30µs within RTP::Webmerge::Optimize::BEGIN@29 which was called: # once (30µs+0s) by main::BEGIN@35 at line 29
BEGIN { our @EXPORT = qw(optimizer); }
# spent 30µs making 1 call to RTP::Webmerge::Optimize::BEGIN@29
30
31# define our functions that can be exported
3211.80ms129µs
# spent 29µs within RTP::Webmerge::Optimize::BEGIN@32 which was called: # once (29µs+0s) by main::BEGIN@35 at line 32
BEGIN { our @EXPORT_OK = qw(%optimizer optimize); }
# spent 29µs making 1 call to RTP::Webmerge::Optimize::BEGIN@32
33
34###################################################################################################
35
36# main optimizer function
37# call all optimizer steps
38sub optimizer
39{
40
41 # get input variables
42 my ($config, $optimize) = @_;
43
44 # do nothing if level is zero
45 return unless $config->{'level'};
46
47 # check for configuration option
48 return unless $config->{'optimize'};
49
50 # should we commit filesystem changes?
51 my $commit = $optimize->{'commit'} || 0;
52
53 # commit all changes to the filesystem if configured
54 $config->{'atomic'} = {} if $commit =~ m/^\s*(?:bo|be)/i;
55
56 # do not process if disabled attribute is given and set to true
57 unless ($optimize->{'disabled'} && lc $optimize->{'disabled'} eq 'true')
58 {
59
60 # change directory (restore previous state after this block)
61 my $dir = RTP::Webmerge::Path->chdir($optimize->{'chdir'});
62
63 # process all optimizers
64 foreach my $key (sort keys %optimizer)
65 {
66 # check if this optimizer is enabled
67 next unless $config->{'optimize-' . $key};
68 # call the optimizer functions (see modules)
69 $optimizer{$key}->($config, $optimize->{$key} || []);
70 }
71
72 }
73 # EO unless disabled
74
75 # commit all changes to the filesystem if configured
76 $config->{'atomic'} = {} if $commit =~ m/^\s*(?:bo|af)/i;
77
78}
79# EO sub optimize
80
81###################################################################################################
82
83# load function from main module
842318µs2689µs
# spent 401µs (113+288) within RTP::Webmerge::Optimize::BEGIN@84 which was called: # once (113µs+288µs) by main::BEGIN@35 at line 84
use RTP::Webmerge::Path qw(check_path);
# spent 401µs making 1 call to RTP::Webmerge::Optimize::BEGIN@84 # spent 288µs making 1 call to Exporter::import
85
86# load functions from webmerge io library
872276µs2554µs
# spent 323µs (92+231) within RTP::Webmerge::Optimize::BEGIN@87 which was called: # once (92µs+231µs) by main::BEGIN@35 at line 87
use RTP::Webmerge::IO qw(filelist);
# spent 323µs making 1 call to RTP::Webmerge::Optimize::BEGIN@87 # spent 231µs making 1 call to Exporter::import
88
89# load function from main module
9021.90ms2540µs
# spent 312µs (83+228) within RTP::Webmerge::Optimize::BEGIN@90 which was called: # once (83µs+228µs) by main::BEGIN@35 at line 90
use RTP::Webmerge qw(callProgram);
# spent 312µs making 1 call to RTP::Webmerge::Optimize::BEGIN@90 # spent 228µs making 1 call to Exporter::import
91
92###################################################################################################
93
94# create a new sub to optimize files
95# pass the filetype to be optimized
96sub optimize ($)
97
# spent 278µs within RTP::Webmerge::Optimize::optimize which was called 7 times, avg 40µs/call: # once (62µs+0s) by main::BEGIN@49 at line 86 of webmerge/scripts/modules/RTP/Webmerge/Optimize/PNG.pm # once (38µs+0s) by main::BEGIN@47 at line 78 of webmerge/scripts/modules/RTP/Webmerge/Optimize/GIF.pm # once (37µs+0s) by main::BEGIN@46 at line 138 of webmerge/scripts/modules/RTP/Webmerge/Optimize/TXT.pm # once (35µs+0s) by main::BEGIN@52 at line 78 of webmerge/scripts/modules/RTP/Webmerge/Optimize/GZ.pm # once (35µs+0s) by main::BEGIN@48 at line 77 of webmerge/scripts/modules/RTP/Webmerge/Optimize/JPG.pm # once (35µs+0s) by main::BEGIN@51 at line 78 of webmerge/scripts/modules/RTP/Webmerge/Optimize/ZIP.pm # once (35µs+0s) by main::BEGIN@50 at line 83 of webmerge/scripts/modules/RTP/Webmerge/Optimize/MNG.pm
{
98
99 # create a closure variable
100746µs my ($filetype) = @_;
101
102 # create new subroutine
103 return sub
104 {
105
106 # get input variables
107 my ($config, $entries) = @_;
108
109 # process all entries
110 foreach my $nodes (@{$entries})
111 {
112
113 # declare lexical variables
114 my $disabled = $nodes->{'disabled'};
115
116 # do not process if entry has been disabled
117 return if $disabled && lc $disabled eq 'true';
118
119 # process all file entries
120 foreach my $entry (@{$nodes->{'file'} || []})
121 {
122
123 # declare lexical variables
124 my $file = $entry->{'file'};
125 my $path = $entry->{'path'} || '.';
126 my $disabled = $entry->{'disabled'} || 'false';
127 my $recursive = $entry->{'recursive'} || 'false';
128
129 # do not process if entry has been disabled
130 return if $disabled && lc $disabled eq 'true';
131
132 # create pattern for logging
133 my $pattern = join('/', $path, $file);
134
135 # make sure we pass a boolean value
136 $recursive = 0 if $recursive eq 'false';
137
138 # get all files for the resolved path and pattern
139 my $files = filelist(check_path($path), $file, $recursive);
140
141 # call all possible optimizers
142 callProgram($config, $filetype . 'opt', $files, $pattern, $entry);
143
144 }
145 # EO each file entry
146
147 }
148 # EO each nodes
149
1507422µs };
151 # EO sub optimizer
152
153}
154# EO sub optimize
155
156###################################################################################################
157###################################################################################################
158120µs1;