← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 19:05:14 2015
Reported on Fri Jul 31 19:08:09 2015

Filename/var/www/foswiki11/lib/Foswiki/Engine/CLI.pm
StatementsExecuted 56 statements in 1.34ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1115.88ms5.89msFoswiki::Engine::CLI::::preparePathFoswiki::Engine::CLI::preparePath
1112.65ms9.07msFoswiki::Engine::CLI::::BEGIN@23Foswiki::Engine::CLI::BEGIN@23
1111.98ms2.05msFoswiki::Engine::CLI::::BEGIN@25Foswiki::Engine::CLI::BEGIN@25
1111.78ms2.00msFoswiki::Engine::CLI::::BEGIN@20Foswiki::Engine::CLI::BEGIN@20
111452µs533µsFoswiki::Engine::CLI::::BEGIN@24Foswiki::Engine::CLI::BEGIN@24
11180µs61.4sFoswiki::Engine::CLI::::runFoswiki::Engine::CLI::run
11173µs73µsFoswiki::Engine::CLI::::writeFoswiki::Engine::CLI::write
11118µs35µsFoswiki::Engine::CLI::::BEGIN@16Foswiki::Engine::CLI::BEGIN@16
11117µs111µsFoswiki::Engine::CLI::::prepareQueryParametersFoswiki::Engine::CLI::prepareQueryParameters
11115µs44µsFoswiki::Engine::CLI::::BEGIN@18Foswiki::Engine::CLI::BEGIN@18
11112µs18µsFoswiki::Engine::CLI::::prepareConnectionFoswiki::Engine::CLI::prepareConnection
11111µs18µsFoswiki::Engine::CLI::::BEGIN@17Foswiki::Engine::CLI::BEGIN@17
1118µs11µsFoswiki::Engine::CLI::::prepareHeadersFoswiki::Engine::CLI::prepareHeaders
1113µs3µsFoswiki::Engine::CLI::::finalizeHeadersFoswiki::Engine::CLI::finalizeHeaders
1111µs1µsFoswiki::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
16235µs252µs
# spent 35µs (18+17) within Foswiki::Engine::CLI::BEGIN@16 which was called: # once (18µs+17µs) by Foswiki::BEGIN@1 at line 16
use strict;
# spent 35µs making 1 call to Foswiki::Engine::CLI::BEGIN@16 # spent 17µs making 1 call to strict::import
17228µs225µs
# spent 18µs (11+7) within Foswiki::Engine::CLI::BEGIN@17 which was called: # once (11µs+7µs) by Foswiki::BEGIN@1 at line 17
use warnings;
# spent 18µs making 1 call to Foswiki::Engine::CLI::BEGIN@17 # spent 7µs making 1 call to warnings::import
18241µs273µs
# spent 44µs (15+29) within Foswiki::Engine::CLI::BEGIN@18 which was called: # once (15µs+29µs) by Foswiki::BEGIN@1 at line 18
use Assert;
# spent 44µs making 1 call to Foswiki::Engine::CLI::BEGIN@18 # spent 29µs making 1 call to Assert::import
19
202141µs12.00ms
# spent 2.00ms (1.78+225µs) within Foswiki::Engine::CLI::BEGIN@20 which was called: # once (1.78ms+225µs) by Foswiki::BEGIN@1 at line 20
use Foswiki::Engine ();
# spent 2.00ms making 1 call to Foswiki::Engine::CLI::BEGIN@20
2119µsour @ISA = ('Foswiki::Engine');
22
232127µs19.07ms
# spent 9.07ms (2.65+6.42) within Foswiki::Engine::CLI::BEGIN@23 which was called: # once (2.65ms+6.42ms) by Foswiki::BEGIN@1 at line 23
use Foswiki::Request ();
# spent 9.07ms making 1 call to Foswiki::Engine::CLI::BEGIN@23
242115µs1533µs
# spent 533µs (452+81) within Foswiki::Engine::CLI::BEGIN@24 which was called: # once (452µs+81µs) by Foswiki::BEGIN@1 at line 24
use Foswiki::Request::Upload ();
# spent 533µs making 1 call to Foswiki::Engine::CLI::BEGIN@24
252638µs12.05ms
# spent 2.05ms (1.98+76µs) within Foswiki::Engine::CLI::BEGIN@25 which was called: # once (1.98ms+76µs) by Foswiki::BEGIN@1 at line 25
use Foswiki::Response ();
# spent 2.05ms making 1 call to Foswiki::Engine::CLI::BEGIN@25
26
27
# spent 61.4s (80µs+61.4) within Foswiki::Engine::CLI::run which was called: # once (80µs+61.4s) by main::RUNTIME at line 24 of view
sub run {
281900ns my $this = shift;
2912µs my @args = @ARGV; # Copy, so original @ARGV doesn't get modified
3011µs while ( scalar @args ) {
312300ns my $name;
3222µs my $arg = shift @args;
3327µs if ( $arg =~ /^-?([a-z0-9_]+)=(.*)$/i ) {
3427µs48µs ( $name, $arg ) = ( TAINT($1), TAINT($2) );
# spent 8µs making 4 calls to Assert::noop, avg 2µs/call
35 }
36 elsif ( $arg =~ /^-([a-z0-9_]+)/i ) {
37 ( $name, $arg ) = ( TAINT($1), shift(@args) );
38 }
3923µs if ( $name && $name eq 'user' ) {
40 $this->{user} = $arg;
41 }
42 elsif ($name) {
4324µs push @{ $this->{plist} }, $name
44 unless exists $this->{params}->{$name};
4522µs push @{ $this->{params}->{$name} }, $arg;
46 }
47 else {
48 $this->{path_info} = $arg; # keep it tainted
49 }
50 }
5116µs16.19ms my $req = $this->prepare;
# spent 6.19ms making 1 call to Foswiki::Engine::prepare
52111µs12µs if ( UNIVERSAL::isa( $req, 'Foswiki::Request' ) ) {
# spent 2µs making 1 call to UNIVERSAL::isa
5312µs161.4s my $res = Foswiki::UI::handleRequest($req);
# spent 61.4s making 1 call to Foswiki::UI::handleRequest
54124µs1258µs $this->finalize( $res, $req );
# spent 258µs making 1 call to Foswiki::Engine::finalize
55 }
56}
57
58
# spent 18µs (12+7) within Foswiki::Engine::CLI::prepareConnection which was called: # once (12µs+7µs) by Foswiki::Engine::__ANON__[/var/www/foswiki11/lib/Foswiki/Engine.pm:77] at line 69 of /var/www/foswiki11/lib/Foswiki/Engine.pm
sub prepareConnection {
5911µs my ( $this, $req ) = @_;
6012µs14µs $req->remoteAddress('127.0.0.1');
# spent 4µs making 1 call to Foswiki::Request::remoteAddress
6117µs13µs $req->method( $ENV{FOSWIKI_ACTION} );
# spent 3µs making 1 call to Foswiki::Request::method
62}
63
64
# spent 111µs (17+95) within Foswiki::Engine::CLI::prepareQueryParameters which was called: # once (17µs+95µs) by Foswiki::Engine::__ANON__[/var/www/foswiki11/lib/Foswiki/Engine.pm:77] at line 70 of /var/www/foswiki11/lib/Foswiki/Engine.pm
sub prepareQueryParameters {
651800ns my ( $this, $req ) = @_;
6612µs foreach my $name ( @{ $this->{plist} } ) {
6728µs295µs $req->param( -name => $name, -value => $this->{params}->{$name} );
# spent 95µs making 2 calls to Foswiki::Request::param, avg 47µs/call
68 }
6911µs delete $this->{plist};
7014µs delete $this->{params};
71}
72
73
# spent 11µs (8+3) within Foswiki::Engine::CLI::prepareHeaders which was called: # once (8µs+3µs) by Foswiki::Engine::__ANON__[/var/www/foswiki11/lib/Foswiki/Engine.pm:77] at line 71 of /var/www/foswiki11/lib/Foswiki/Engine.pm
sub prepareHeaders {
741800ns my ( $this, $req ) = @_;
7517µs if ( defined $this->{user} ) {
76 $req->remoteUser( $this->{user} );
77 delete $this->{user};
78 }
79 else {
8013µs13µs $req->remoteUser( $Foswiki::cfg{AdminUserWikiName} );
# spent 3µs making 1 call to Foswiki::Request::remoteUser
81 }
82}
83
84
# spent 5.89ms (5.88+7µs) within Foswiki::Engine::CLI::preparePath which was called: # once (5.88ms+7µs) by Foswiki::Engine::__ANON__[/var/www/foswiki11/lib/Foswiki/Engine.pm:77] at line 73 of /var/www/foswiki11/lib/Foswiki/Engine.pm
sub preparePath {
8511µs my ( $this, $req ) = @_;
8612µs17µs if ( $ENV{FOSWIKI_ACTION} ) {
# spent 7µs making 1 call to Foswiki::Request::action
87 $req->action( $ENV{FOSWIKI_ACTION} );
88 }
89 else {
90 require File::Spec;
91 $req->action( ( File::Spec->splitpath($0) )[2] );
92 }
9317µs if ( exists $this->{path_info} ) {
94 $req->pathInfo( $this->{path_info} );
95 delete $this->{path_info};
96 }
97}
98
9913µs
# spent 1µs within Foswiki::Engine::CLI::prepareCookies which was called: # once (1µs+0s) by Foswiki::Engine::__ANON__[/var/www/foswiki11/lib/Foswiki/Engine.pm:77] at line 72 of /var/www/foswiki11/lib/Foswiki/Engine.pm
sub prepareCookies { }
100
10114µs
# spent 3µs within Foswiki::Engine::CLI::finalizeHeaders which was called: # once (3µs+0s) by Foswiki::Engine::finalize at line 278 of /var/www/foswiki11/lib/Foswiki/Engine.pm
sub finalizeHeaders { }
102
103
# spent 73µs within Foswiki::Engine::CLI::write which was called: # once (73µs+0s) by Foswiki::Engine::finalizeBody at line 391 of /var/www/foswiki11/lib/Foswiki/Engine.pm
sub write {
10415µs my ( $this, $buffer ) = @_;
105173µs print $buffer;
106}
107
10814µs1;
109__END__