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

Filename/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Prepare.pm
StatementsExecuted 44 statements in 3.82ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
211463µs3.76msRTP::Webmerge::Prepare::::prepareRTP::Webmerge::Prepare::prepare
111132µs348µsRTP::Webmerge::Prepare::::BEGIN@26RTP::Webmerge::Prepare::BEGIN@26
11192µs346µsRTP::Webmerge::Prepare::::BEGIN@8RTP::Webmerge::Prepare::BEGIN@8
41164µs64µsRTP::Webmerge::Prepare::::CORE:ftdirRTP::Webmerge::Prepare::CORE:ftdir (opcode)
11163µs346µsRTP::Webmerge::Prepare::::BEGIN@28RTP::Webmerge::Prepare::BEGIN@28
11158µs91µsRTP::Webmerge::Prepare::::BEGIN@10RTP::Webmerge::Prepare::BEGIN@10
11156µs56µsRTP::Webmerge::Prepare::::BEGIN@18.21RTP::Webmerge::Prepare::BEGIN@18.21
11153µs140µsRTP::Webmerge::Prepare::::BEGIN@9RTP::Webmerge::Prepare::BEGIN@9
11127µs27µsRTP::Webmerge::Prepare::::BEGIN@21RTP::Webmerge::Prepare::BEGIN@21
11125µs25µsRTP::Webmerge::Prepare::::BEGIN@18RTP::Webmerge::Prepare::BEGIN@18
11123µs23µsRTP::Webmerge::Prepare::::BEGIN@15RTP::Webmerge::Prepare::BEGIN@15
42112µs12µsRTP::Webmerge::Prepare::::CORE:matchRTP::Webmerge::Prepare::CORE:match (opcode)
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###################################################################################################
5package RTP::Webmerge::Prepare;
6###################################################################################################
7
82164µs2600µs
# spent 346µs (92+254) within RTP::Webmerge::Prepare::BEGIN@8 which was called: # once (92µs+254µs) by main::BEGIN@32 at line 8
use Carp;
# spent 346µs making 1 call to RTP::Webmerge::Prepare::BEGIN@8 # spent 254µs making 1 call to Exporter::import
92146µs2226µs
# spent 140µs (53+87) within RTP::Webmerge::Prepare::BEGIN@9 which was called: # once (53µs+87µs) by main::BEGIN@32 at line 9
use strict;
# spent 140µs making 1 call to RTP::Webmerge::Prepare::BEGIN@9 # spent 87µs making 1 call to strict::import
102194µs2124µs
# spent 91µs (58+33) within RTP::Webmerge::Prepare::BEGIN@10 which was called: # once (58µs+33µs) by main::BEGIN@32 at line 10
use warnings;
# spent 91µs making 1 call to RTP::Webmerge::Prepare::BEGIN@10 # spent 33µs making 1 call to warnings::import
11
12###################################################################################################
13
14# define our version string
151183µs123µs
# spent 23µs within RTP::Webmerge::Prepare::BEGIN@15 which was called: # once (23µs+0s) by main::BEGIN@32 at line 15
BEGIN { $RTP::Webmerge::Prepare::VERSION = "0.70" }
# spent 23µs making 1 call to RTP::Webmerge::Prepare::BEGIN@15
16
17# load exporter and inherit from it
183370µs282µs
# spent 25µs within RTP::Webmerge::Prepare::BEGIN@18 which was called: # once (25µs+0s) by main::BEGIN@32 at line 18 # spent 56µs within RTP::Webmerge::Prepare::BEGIN@18.21 which was called: # once (56µs+0s) by main::BEGIN@32 at line 18
BEGIN { use Exporter qw(); our @ISA = qw(Exporter) }
# spent 56µs making 1 call to RTP::Webmerge::Prepare::BEGIN@18.21 # spent 25µs making 1 call to RTP::Webmerge::Prepare::BEGIN@18
19
20# define our functions to be exported
211212µs127µs
# spent 27µs within RTP::Webmerge::Prepare::BEGIN@21 which was called: # once (27µs+0s) by main::BEGIN@32 at line 21
BEGIN { our @EXPORT = qw(prepare); }
# spent 27µs making 1 call to RTP::Webmerge::Prepare::BEGIN@21
22
23###################################################################################################
24
25# load core io module
262202µs2565µs
# spent 348µs (132+216) within RTP::Webmerge::Prepare::BEGIN@26 which was called: # once (132µs+216µs) by main::BEGIN@32 at line 26
use RTP::Webmerge::IO;
# spent 348µs making 1 call to RTP::Webmerge::Prepare::BEGIN@26 # spent 216µs making 1 call to Exporter::import
27# load core path module
2821.84ms2629µs
# spent 346µs (63+283) within RTP::Webmerge::Prepare::BEGIN@28 which was called: # once (63µs+283µs) by main::BEGIN@32 at line 28
use RTP::Webmerge::Path;
# spent 346µs making 1 call to RTP::Webmerge::Prepare::BEGIN@28 # spent 283µs making 1 call to Exporter::import
29
30###################################################################################################
31
32# prepare various stuff
33# only mkdir is implemented
34sub prepare
35
# spent 3.76ms (463µs+3.29) within RTP::Webmerge::Prepare::prepare which was called 2 times, avg 1.88ms/call: # 2 times (463µs+3.29ms) by main::RUNTIME at line 642 of webmerge/scripts/webmerge.pl, avg 1.88ms/call
{
36
37 # get input variables
3828µs my ($config, $prepare) = @_;
39
40 # should we commit filesystem changes?
4128µs my $commit = $prepare->{'commit'} || 0;
42
43 # commit all changes to the filesystem if configured
44252µs28µs $config->{'atomic'} = {} if $commit =~ m/^\s*(?:bo|be)/i;
# spent 8µs making 2 calls to RTP::Webmerge::Prepare::CORE:match, avg 4µs/call
45
46 # do not process if disabled attribute is given and set to true
47223µs unless ($prepare->{'disabled'} && lc $prepare->{'disabled'} eq 'true')
48 {
49
50 # change directory (restore previous state after this block)
51262µs234µs my $dir = RTP::Webmerge::Path->chdir($prepare->{'chdir'});
# spent 34µs making 2 calls to RTP::Webmerge::Path::chdir, avg 17µs/call
52
53 # process all directories to create
54231µs foreach my $mkdir (@{$prepare->{'mkdir'} || []})
55 {
56
57 # skip this if entry has been disabled
58426µs next if ($prepare->{'disabled'} && lc $prepare->{'disabled'} eq 'true');
59
60 # resolve the path to be created
61459µs43.18ms my $path = check_path $mkdir->{'path'};
# spent 3.18ms making 4 calls to RTP::Webmerge::Path::check_path, avg 796µs/call
62
63 # allready exists?
644136µs464µs next if -d $path;
# spent 64µs making 4 calls to RTP::Webmerge::Prepare::CORE:ftdir, avg 16µs/call
65
66 # try to create the given directory and give status messages (abort on error)
67 if (mkdir $path) { print "created directory ", exportURI($path), "\n"; }
68 else { die "could not create directory ", exportURI($path), ": ", $!; }
69
70 }
71 # EO each mkdir
72
73 # process all directories to create
74222µs foreach my $copy (@{$prepare->{'copy'} || []})
75 {
76
77 # get path for source and destination
78 my $src = check_path $copy->{'src'};
79 my $dst = check_path $copy->{'dst'};
80
81 print "copying ", exportURI($src), "\n";
82
83 # check if we do not copy a text file
84 my $bin = ($copy->{'text'} || '') ne "true";
85
86 # copy the file binary if text is not set to true
87 my $data = readfile($src, $config->{'atomic'}, $bin);
88 writefile($dst, $data, $config->{'atomic'}, $bin);
89
90 print " copied to ", exportURI($dst), "\n";
91
92 }
93 # EO each copy
94
95 }
96 # EO unless disabled
97
98 # commit all changes to the filesystem if configured
99271µs25µs $config->{'atomic'} = {} if $commit =~ m/^\s*(?:bo|af)/i;
# spent 5µs making 2 calls to RTP::Webmerge::Prepare::CORE:match, avg 2µs/call
100
101}
102# EO sub prepare
103
104###################################################################################################
105###################################################################################################
106115µs1;
 
# spent 64µs within RTP::Webmerge::Prepare::CORE:ftdir which was called 4 times, avg 16µs/call: # 4 times (64µs+0s) by RTP::Webmerge::Prepare::prepare at line 64, avg 16µs/call
sub RTP::Webmerge::Prepare::CORE:ftdir; # opcode
# spent 12µs within RTP::Webmerge::Prepare::CORE:match which was called 4 times, avg 3µs/call: # 2 times (8µs+0s) by RTP::Webmerge::Prepare::prepare at line 44, avg 4µs/call # 2 times (5µs+0s) by RTP::Webmerge::Prepare::prepare at line 99, avg 2µs/call
sub RTP::Webmerge::Prepare::CORE:match; # opcode