← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:13 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Engine/CLI.pm
StatementsExecuted 57 statements in 1.19ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.39ms10.6msFoswiki::Engine::CLI::::BEGIN@23Foswiki::Engine::CLI::BEGIN@23
1111.69ms1.77msFoswiki::Engine::CLI::::BEGIN@25Foswiki::Engine::CLI::BEGIN@25
1111.55ms1.78msFoswiki::Engine::CLI::::BEGIN@20Foswiki::Engine::CLI::BEGIN@20
111388µs469µsFoswiki::Engine::CLI::::BEGIN@24Foswiki::Engine::CLI::BEGIN@24
11187µs138sFoswiki::Engine::CLI::::runFoswiki::Engine::CLI::run
11177µs77µsFoswiki::Engine::CLI::::writeFoswiki::Engine::CLI::write
11116µs108µsFoswiki::Engine::CLI::::prepareQueryParametersFoswiki::Engine::CLI::prepareQueryParameters
11115µs23µsFoswiki::Engine::CLI::::BEGIN@17Foswiki::Engine::CLI::BEGIN@17
11114µs28µsFoswiki::Engine::CLI::::BEGIN@16Foswiki::Engine::CLI::BEGIN@16
11112µs41µsFoswiki::Engine::CLI::::BEGIN@18Foswiki::Engine::CLI::BEGIN@18
11110µs16µsFoswiki::Engine::CLI::::prepareConnectionFoswiki::Engine::CLI::prepareConnection
1118µs11µsFoswiki::Engine::CLI::::prepareHeadersFoswiki::Engine::CLI::prepareHeaders
1117µs15µsFoswiki::Engine::CLI::::preparePathFoswiki::Engine::CLI::preparePath
1114µs4µsFoswiki::Engine::CLI::::BEGIN@27Foswiki::Engine::CLI::BEGIN@27
1112µs2µsFoswiki::Engine::CLI::::finalizeHeadersFoswiki::Engine::CLI::finalizeHeaders
111900ns900nsFoswiki::Engine::CLI::::prepareCookiesFoswiki::Engine::CLI::prepareCookies
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2
3=begin TML
4
5---+!! package Foswiki::Engine::CLI
6
7Class that implements CGI scripts functionality when called from
8command line or cron job
9
10Refer to Foswiki::Engine documentation for explanation about methos below.
11
12=cut
13
14package Foswiki::Engine::CLI;
15
16229µs242µs
# spent 28µs (14+14) within Foswiki::Engine::CLI::BEGIN@16 which was called: # once (14µs+14µs) by Foswiki::BEGIN@1 at line 16
use strict;
# spent 28µs making 1 call to Foswiki::Engine::CLI::BEGIN@16 # spent 14µs making 1 call to strict::import
17228µs231µs
# spent 23µs (15+8) within Foswiki::Engine::CLI::BEGIN@17 which was called: # once (15µs+8µs) by Foswiki::BEGIN@1 at line 17
use warnings;
# spent 23µs making 1 call to Foswiki::Engine::CLI::BEGIN@17 # spent 8µs making 1 call to warnings::import
18229µs271µs
# spent 41µs (12+29) within Foswiki::Engine::CLI::BEGIN@18 which was called: # once (12µs+29µs) by Foswiki::BEGIN@1 at line 18
use Assert;
# spent 41µs making 1 call to Foswiki::Engine::CLI::BEGIN@18 # spent 29µs making 1 call to Exporter::import
19
202112µs11.78ms
# spent 1.78ms (1.55+229µs) within Foswiki::Engine::CLI::BEGIN@20 which was called: # once (1.55ms+229µs) by Foswiki::BEGIN@1 at line 20
use Foswiki::Engine ();
# spent 1.78ms making 1 call to Foswiki::Engine::CLI::BEGIN@20
2118µsour @ISA = ('Foswiki::Engine');
22
232102µs110.6ms
# spent 10.6ms (2.39+8.21) within Foswiki::Engine::CLI::BEGIN@23 which was called: # once (2.39ms+8.21ms) by Foswiki::BEGIN@1 at line 23
use Foswiki::Request ();
# spent 10.6ms making 1 call to Foswiki::Engine::CLI::BEGIN@23
24293µs1469µs
# spent 469µs (388+81) within Foswiki::Engine::CLI::BEGIN@24 which was called: # once (388µs+81µs) by Foswiki::BEGIN@1 at line 24
use Foswiki::Request::Upload ();
# spent 469µs making 1 call to Foswiki::Engine::CLI::BEGIN@24
252113µs11.77ms
# spent 1.77ms (1.69+77µs) within Foswiki::Engine::CLI::BEGIN@25 which was called: # once (1.69ms+77µs) by Foswiki::BEGIN@1 at line 25
use Foswiki::Response ();
# spent 1.77ms making 1 call to Foswiki::Engine::CLI::BEGIN@25
26
27
# spent 4µs within Foswiki::Engine::CLI::BEGIN@27 which was called: # once (4µs+0s) by Foswiki::BEGIN@1 at line 32
BEGIN {
2815µs if ( $Foswiki::cfg{UseLocale} ) {
29 require locale;
30 import locale();
31 }
321458µs14µs}
# spent 4µs making 1 call to Foswiki::Engine::CLI::BEGIN@27
33
34
# spent 138s (87µs+138) within Foswiki::Engine::CLI::run which was called: # once (87µs+138s) by main::RUNTIME at line 29 of view
sub run {
3511µs my $this = shift;
3612µs my @args = @ARGV; # Copy, so original @ARGV doesn't get modified
3711µs while ( scalar(@args) ) {
382600ns my $name;
3921µs my $arg = shift @args;
4028µs if ( $arg =~ m/^-?([a-z0-9_]+)=(.*)$/i ) {
4127µs48µs ( $name, $arg ) = ( TAINT($1), TAINT($2) );
# spent 8µs making 4 calls to Assert::TAINT, avg 2µs/call
42 }
43 elsif ( $arg =~ m/^-([a-z0-9_]+)/i ) {
44 ( $name, $arg ) = ( TAINT($1), shift(@args) );
45 }
4623µs if ( $name && $name eq 'user' ) {
47 $this->{user} = $arg;
48 }
49 elsif ($name) {
5024µs push @{ $this->{plist} }, $name
51 unless exists $this->{params}->{$name};
5222µs push @{ $this->{params}->{$name} }, $arg;
53 }
54 else {
55 $this->{path_info} = $arg; # keep it tainted
56 }
57 }
5816µs1315µs my $req = $this->prepare;
# spent 315µs making 1 call to Foswiki::Engine::prepare
59111µs12µs if ( UNIVERSAL::isa( $req, 'Foswiki::Request' ) ) {
# spent 2µs making 1 call to UNIVERSAL::isa
6012µs1138s my $res = Foswiki::UI::handleRequest($req);
# spent 138s making 1 call to Foswiki::UI::handleRequest
61128µs11.22ms $this->finalize( $res, $req );
# spent 1.22ms making 1 call to Foswiki::Engine::finalize
62 }
63}
64
65
# spent 16µs (10+6) within Foswiki::Engine::CLI::prepareConnection which was called: # once (10µs+6µs) by Foswiki::Engine::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Engine.pm:110] at line 102 of /var/www/foswikidev/core/lib/Foswiki/Engine.pm
sub prepareConnection {
6611µs my ( $this, $req ) = @_;
6712µs14µs $req->remoteAddress('127.0.0.1');
# spent 4µs making 1 call to Foswiki::Request::remoteAddress
6816µs12µs $req->method( $ENV{FOSWIKI_ACTION} );
# spent 2µs making 1 call to Foswiki::Request::method
69}
70
71
# spent 108µs (16+92) within Foswiki::Engine::CLI::prepareQueryParameters which was called: # once (16µs+92µs) by Foswiki::Engine::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Engine.pm:110] at line 103 of /var/www/foswikidev/core/lib/Foswiki/Engine.pm
sub prepareQueryParameters {
7211µs my ( $this, $req ) = @_;
7311µs foreach my $name ( @{ $this->{plist} } ) {
7427µs292µs $req->param( -name => $name, -value => $this->{params}->{$name} );
# spent 92µs making 2 calls to Foswiki::Request::param, avg 46µs/call
75 }
7612µs delete $this->{plist};
7715µs delete $this->{params};
78}
79
80
# spent 11µs (8+3) within Foswiki::Engine::CLI::prepareHeaders which was called: # once (8µs+3µs) by Foswiki::Engine::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Engine.pm:110] at line 104 of /var/www/foswikidev/core/lib/Foswiki/Engine.pm
sub prepareHeaders {
811800ns my ( $this, $req ) = @_;
8214µs if ( defined $this->{user} ) {
83 $req->remoteUser( $this->{user} );
84 delete $this->{user};
85 }
86 else {
8713µs13µs if ( $Foswiki::cfg{Register}{AllowLoginName} ) {
# spent 3µs making 1 call to Foswiki::Request::remoteUser
88 $req->remoteUser( $Foswiki::cfg{AdminUserLogin} );
89 }
90 else {
91 $req->remoteUser( $Foswiki::cfg{AdminUserWikiName} );
92 }
93 }
94}
95
96
# spent 15µs (7+7) within Foswiki::Engine::CLI::preparePath which was called: # once (7µs+7µs) by Foswiki::Engine::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Engine.pm:110] at line 106 of /var/www/foswikidev/core/lib/Foswiki/Engine.pm
sub preparePath {
9711µs my ( $this, $req ) = @_;
9813µs17µs if ( $ENV{FOSWIKI_ACTION} ) {
# spent 7µs making 1 call to Foswiki::Request::action
99 $req->action( $ENV{FOSWIKI_ACTION} );
100 }
101 else {
102 require File::Spec;
103 $req->action( ( File::Spec->splitpath($0) )[2] );
104 }
10513µs if ( exists $this->{path_info} ) {
106 $req->pathInfo( $this->{path_info} );
107 delete $this->{path_info};
108 }
109}
110
11113µs
# spent 900ns within Foswiki::Engine::CLI::prepareCookies which was called: # once (900ns+0s) by Foswiki::Engine::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Engine.pm:110] at line 105 of /var/www/foswikidev/core/lib/Foswiki/Engine.pm
sub prepareCookies { }
112
11314µs
# spent 2µs within Foswiki::Engine::CLI::finalizeHeaders which was called: # once (2µs+0s) by Foswiki::Engine::finalize at line 318 of /var/www/foswikidev/core/lib/Foswiki/Engine.pm
sub finalizeHeaders { }
114
115
# spent 77µs within Foswiki::Engine::CLI::write which was called: # once (77µs+0s) by Foswiki::Engine::finalizeBody at line 431 of /var/www/foswikidev/core/lib/Foswiki/Engine.pm
sub write {
11619µs my ( $this, $buffer ) = @_;
117173µs print $buffer;
118}
119
12013µs1;
121__END__