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

Filename/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/IO/AtomicFile.pm
StatementsExecuted 668 statements in 13.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
39113.04ms11.7msRTP::IO::AtomicFile::::newRTP::IO::AtomicFile::new
39112.84ms29.2msRTP::IO::AtomicFile::::DESTROYRTP::IO::AtomicFile::DESTROY
39112.11ms24.2msRTP::IO::AtomicFile::::openRTP::IO::AtomicFile::open
39111.93ms25.3msRTP::IO::AtomicFile::::closeRTP::IO::AtomicFile::close
39111.86ms2.63msRTP::IO::AtomicFile::::_closedRTP::IO::AtomicFile::_closed
11187µs189µsRTP::IO::AtomicFile::::BEGIN@11RTP::IO::AtomicFile::BEGIN@11
11157µs48.0msRTP::IO::AtomicFile::::BEGIN@16RTP::IO::AtomicFile::BEGIN@16
0000s0sRTP::IO::AtomicFile::::deleteRTP::IO::AtomicFile::delete
0000s0sRTP::IO::AtomicFile::::detachRTP::IO::AtomicFile::detach
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::IO::AtomicFile;
6###################################################################################################
7# fork safe implementation of IO::AtomicFile
8###################################################################################################
9
10# Be strict:
112175µs2290µs
# spent 189µs (87+102) within RTP::IO::AtomicFile::BEGIN@11 which was called: # once (87µs+102µs) by RTP::Webmerge::Merge::BEGIN@44 at line 11
use strict;
# spent 189µs making 1 call to RTP::IO::AtomicFile::BEGIN@11 # spent 102µs making 1 call to strict::import
12
13###################################################################################################
14
15# External modules:
1621.81ms296.0ms
# spent 48.0ms (57µs+48.0) within RTP::IO::AtomicFile::BEGIN@16 which was called: # once (57µs+48.0ms) by RTP::Webmerge::Merge::BEGIN@44 at line 16
use base "IO::AtomicFile";
# spent 48.0ms making 1 call to RTP::IO::AtomicFile::BEGIN@16 # spent 48.0ms making 1 call to base::import
17
18###################################################################################################
19
20#------------------------------
21# new ARGS...
22#------------------------------
23# Class method, constructor.
24# Any arguments are sent to open().
25#
26sub new
27
# spent 11.7ms (3.04+8.67) within RTP::IO::AtomicFile::new which was called 39 times, avg 300µs/call: # 39 times (3.04ms+8.67ms) by RTP::Webmerge::IO::writefile at line 242 of webmerge/scripts/modules/RTP/Webmerge/IO.pm, avg 300µs/call
{
2839170µs my $pckg = shift;
29391.57ms398.67ms my $self = $pckg->SUPER::new();
# spent 8.67ms making 39 calls to IO::AtomicFile::new, avg 222µs/call
3039441µs ${*$self}{'io_atomicfile_pid'} = $$;
313975µs $self->open(@_) if @_;
3239609µs $self;
33}
34
35#------------------------------
36# DESTROY
37#------------------------------
38# Destructor.
39#
40
# spent 29.2ms (2.84+26.3) within RTP::IO::AtomicFile::DESTROY which was called 39 times, avg 748µs/call: # 39 times (2.84ms+26.3ms) by main::RUNTIME at line 677 of webmerge/scripts/webmerge.pl, avg 748µs/call
sub DESTROY {
4139135µs my $self = shift;
4239617µs return if ${*$self}{'io_atomicfile_pid'} ne $$;
43391.94ms3926.3ms $self->SUPER::DESTROY(@_);
# spent 26.3ms making 39 calls to IO::AtomicFile::DESTROY, avg 675µs/call
44}
45
46#------------------------------
47# open PATH, MODE
48#------------------------------
49# Class/instance method.
50#
51sub open
52
# spent 24.2ms (2.11+22.1) within RTP::IO::AtomicFile::open which was called 39 times, avg 620µs/call: # 39 times (2.11ms+22.1ms) by RTP::Webmerge::IO::writefile at line 247 of webmerge/scripts/modules/RTP/Webmerge/IO.pm, avg 620µs/call
{
533997µs my $self = shift;
5439480µs if (${*$self}{'io_atomicfile_pid'} ne $$)
55 { die "atomic file operation of foreign pid"; }
56391.53ms3922.1ms $self->SUPER::open(@_);
# spent 22.1ms making 39 calls to IO::AtomicFile::open, avg 566µs/call
57}
58
59#------------------------------
60# _closed [YESNO]
61#------------------------------
62# Instance method, private.
63# Are we already closed? Argument sets new value, returns previous one.
64#
65sub _closed
66
# spent 2.63ms (1.86+767µs) within RTP::IO::AtomicFile::_closed which was called 39 times, avg 67µs/call: # 39 times (1.86ms+767µs) by IO::AtomicFile::close at line 88 of IO/AtomicFile.pm, avg 67µs/call
{
673981µs my $self = shift;
6839332µs if (${*$self}{'io_atomicfile_pid'} ne $$)
69 { die "atomic file operation of foreign pid"; }
70391.34ms39767µs $self->SUPER::_closed(@_);
# spent 767µs making 39 calls to IO::AtomicFile::_closed, avg 20µs/call
71}
72
73#------------------------------
74# close
75#------------------------------
76# Instance method.
77# Close the handle, and rename the temp file to its final name.
78#
79sub close
80
# spent 25.3ms (1.93+23.3) within RTP::IO::AtomicFile::close which was called 39 times, avg 648µs/call: # 39 times (1.93ms+23.3ms) by IO::AtomicFile::DESTROY at line 46 of IO/AtomicFile.pm, avg 648µs/call
{
813978µs my $self = shift;
8239357µs if (${*$self}{'io_atomicfile_pid'} ne $$)
83 { die "atomic file operation of foreign pid"; }
84391.40ms3923.3ms $self->SUPER::close(@_);
# spent 23.3ms making 39 calls to IO::AtomicFile::close, avg 598µs/call
85}
86
87#------------------------------
88# delete
89#------------------------------
90# Instance method.
91# Close the handle, and delete the temp file.
92#
93sub delete
94{
95 my $self = shift;
96 if (${*$self}{'io_atomicfile_pid'} ne $$)
97 { die "atomic file operation of foreign pid"; }
98 $self->SUPER::delete(@_);
99}
100
101#------------------------------
102# detach
103#------------------------------
104# Instance method.
105# Close the handle, but DO NOT delete the temp file.
106#
107sub detach
108{
109 my $self = shift;
110 if (${*$self}{'io_atomicfile_pid'} ne $$)
111 { die "atomic file operation of foreign pid"; }
112 $self->SUPER::detach(@_);
113}
114
115###################################################################################################
116###################################################################################################
117113µs1;