← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/local/src/github.com/foswiki/core/bin/view
  Run on Sun Dec 4 17:17:59 2011
Reported on Sun Dec 4 17:26:34 2011

Filename/usr/local/src/github.com/foswiki/core/lib/CPAN/lib/CGI/Session/Serialize/default.pm
StatementsExecuted 135 statements in 2.31ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1116.67ms7.21msCGI::Session::Serialize::default::::BEGIN@7CGI::Session::Serialize::default::BEGIN@7
1113.99ms91.2msCGI::Session::Serialize::default::::BEGIN@6CGI::Session::Serialize::default::BEGIN@6
111263µs508µsCGI::Session::Serialize::default::::__walkCGI::Session::Serialize::default::__walk
211220µs782µsCGI::Session::Serialize::default::::freezeCGI::Session::Serialize::default::freeze
421159µs197µsCGI::Session::Serialize::default::::__scanCGI::Session::Serialize::default::__scan
11171µs5.34msCGI::Session::Serialize::default::::thawCGI::Session::Serialize::default::thaw
11130µs38µsCGI::Session::Serialize::default::::BEGIN@5CGI::Session::Serialize::default::BEGIN@5
11121µs76µsCGI::Session::Serialize::default::::BEGIN@11CGI::Session::Serialize::default::BEGIN@11
11120µs118µsCGI::Session::Serialize::default::::BEGIN@9CGI::Session::Serialize::default::BEGIN@9
11117µs82µsCGI::Session::Serialize::default::::BEGIN@10CGI::Session::Serialize::default::BEGIN@10
11115µs15µsCGI::Session::Serialize::default::::BEGIN@8CGI::Session::Serialize::default::BEGIN@8
1116µs6µsCGI::Session::Serialize::default::::CORE:matchCGI::Session::Serialize::default::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
1package CGI::Session::Serialize::default;
2
3# $Id: default.pm 447 2008-11-01 03:46:08Z markstos $
4
5251µs246µs
# spent 38µs (30+8) within CGI::Session::Serialize::default::BEGIN@5 which was called: # once (30µs+8µs) by CGI::Session::_load_pluggables at line 5
use strict;
# spent 38µs making 1 call to CGI::Session::Serialize::default::BEGIN@5 # spent 8µs making 1 call to strict::import
62217µs191.2ms
# spent 91.2ms (3.99+87.2) within CGI::Session::Serialize::default::BEGIN@6 which was called: # once (3.99ms+87.2ms) by CGI::Session::_load_pluggables at line 6
use Safe;
# spent 91.2ms making 1 call to CGI::Session::Serialize::default::BEGIN@6
72248µs27.29ms
# spent 7.21ms (6.67+547µs) within CGI::Session::Serialize::default::BEGIN@7 which was called: # once (6.67ms+547µs) by CGI::Session::_load_pluggables at line 7
use Data::Dumper;
# spent 7.21ms making 1 call to CGI::Session::Serialize::default::BEGIN@7 # spent 73µs making 1 call to Exporter::import
8252µs115µs
# spent 15µs within CGI::Session::Serialize::default::BEGIN@8 which was called: # once (15µs+0s) by CGI::Session::_load_pluggables at line 8
use CGI::Session::ErrorHandler;
# spent 15µs making 1 call to CGI::Session::Serialize::default::BEGIN@8
9252µs2217µs
# spent 118µs (20+99) within CGI::Session::Serialize::default::BEGIN@9 which was called: # once (20µs+99µs) by CGI::Session::_load_pluggables at line 9
use Scalar::Util qw(blessed reftype refaddr);
# spent 118µs making 1 call to CGI::Session::Serialize::default::BEGIN@9 # spent 99µs making 1 call to Exporter::import
10248µs2146µs
# spent 82µs (17+65) within CGI::Session::Serialize::default::BEGIN@10 which was called: # once (17µs+65µs) by CGI::Session::_load_pluggables at line 10
use Carp "croak";
# spent 82µs making 1 call to CGI::Session::Serialize::default::BEGIN@10 # spent 64µs making 1 call to Exporter::import
112841µs2131µs
# spent 76µs (21+55) within CGI::Session::Serialize::default::BEGIN@11 which was called: # once (21µs+55µs) by CGI::Session::_load_pluggables at line 11
use vars qw( %overloaded );
# spent 76µs making 1 call to CGI::Session::Serialize::default::BEGIN@11 # spent 55µs making 1 call to vars::import
1212µsrequire overload;
13
14111µs@CGI::Session::Serialize::default::ISA = ( "CGI::Session::ErrorHandler" );
1512µs$CGI::Session::Serialize::default::VERSION = '4.38';
16
17
18
# spent 782µs (220+562) within CGI::Session::Serialize::default::freeze which was called 2 times, avg 391µs/call: # 2 times (220µs+562µs) by CGI::Session::flush at line 257 of /usr/local/src/github.com/foswiki/core/lib/CPAN/lib/CGI/Session.pm, avg 391µs/call
sub freeze {
1918198µs my ($class, $data) = @_;
20
212126µs my $d =
# spent 126µs making 2 calls to Data::Dumper::new, avg 63µs/call
22 new Data::Dumper([$data], ["D"]);
23245µs $d->Indent( 0 );
# spent 45µs making 2 calls to Data::Dumper::Indent, avg 23µs/call
24220µs $d->Purity( 1 );
# spent 20µs making 2 calls to Data::Dumper::Purity, avg 10µs/call
25219µs $d->Useqq( 0 );
# spent 19µs making 2 calls to Data::Dumper::Useqq, avg 9µs/call
26219µs $d->Deepcopy( 0 );
# spent 19µs making 2 calls to Data::Dumper::Deepcopy, avg 10µs/call
27215µs $d->Quotekeys( 1 );
# spent 15µs making 2 calls to Data::Dumper::Quotekeys, avg 8µs/call
28214µs $d->Terse( 0 );
# spent 14µs making 2 calls to Data::Dumper::Terse, avg 7µs/call
29
30 # ;$D added to make certain we get our data structure back when we thaw
312304µs return $d->Dump() . ';$D';
# spent 304µs making 2 calls to Data::Dumper::Dump, avg 152µs/call
32}
33
34
# spent 5.34ms (71µs+5.27) within CGI::Session::Serialize::default::thaw which was called: # once (71µs+5.27ms) by CGI::Session::load at line 758 of /usr/local/src/github.com/foswiki/core/lib/CPAN/lib/CGI/Session.pm
sub thaw {
35659µs my ($class, $string) = @_;
36
37 # To make -T happy
3816µs my ($safe_string) = $string =~ m/^(.*)$/s;
# spent 6µs making 1 call to CGI::Session::Serialize::default::CORE:match
3924.61ms my $rv = Safe->new->reval( $safe_string );
# spent 2.64ms making 1 call to Safe::new # spent 1.97ms making 1 call to Safe::reval
40112µs1150µs if ( $@ ) {
# spent 150µs making 1 call to Safe::DESTROY
41 return $class->set_error("thaw(): couldn't thaw. $@");
42 }
431508µs __walk($rv);
# spent 508µs making 1 call to CGI::Session::Serialize::default::__walk
44 return $rv;
45}
46
47
# spent 508µs (263+245) within CGI::Session::Serialize::default::__walk which was called: # once (263µs+245µs) by CGI::Session::Serialize::default::thaw at line 43
sub __walk {
4862306µs my %seen;
49120µs my @filter = __scan(shift);
# spent 20µs making 1 call to CGI::Session::Serialize::default::__scan
50 local %overloaded;
51
52 # We allow the value assigned to a key to be undef.
53 # Hence the defined() test is not in the while().
54
55 while (@filter) {
56 defined(my $x = shift @filter) or next;
572240µs $seen{refaddr $x || ''}++ and next;
# spent 40µs making 22 calls to Scalar::Util::refaddr, avg 2µs/call
58
5948µs my $r = reftype $x or next;
# spent 8µs making 4 calls to Scalar::Util::reftype, avg 2µs/call
60 if ($r eq "HASH") {
61 # we use this form to make certain we have aliases
62 # to the values in %$x and not copies
633177µs push @filter, __scan(@{$x}{keys %$x});
# spent 177µs making 3 calls to CGI::Session::Serialize::default::__scan, avg 59µs/call
64 } elsif ($r eq "ARRAY") {
65 push @filter, __scan(@$x);
66 } elsif ($r eq "SCALAR" || $r eq "REF") {
67 push @filter, __scan($$x);
68 }
69 }
70}
71
72# we need to do this because the values we get back from the safe compartment
73# will have packages defined from the safe compartment's *main instead of
74# the one we use
75
# spent 197µs (159+38) within CGI::Session::Serialize::default::__scan which was called 4 times, avg 49µs/call: # 3 times (141µs+36µs) by CGI::Session::Serialize::default::__walk at line 63, avg 59µs/call # once (18µs+2µs) by CGI::Session::Serialize::default::__walk at line 49
sub __scan {
76 # $_ gets aliased to each value from @_ which are aliases of the values in
77 # the current data structure
7831204µs for (@_) {
792338µs if (blessed $_) {
# spent 38µs making 23 calls to Scalar::Util::blessed, avg 2µs/call
80 if (overload::Overloaded($_)) {
81 my $address = refaddr $_;
82
83 # if we already rebuilt and reblessed this item, use the cached
84 # copy so our ds is consistent with the one we serialized
85 if (exists $overloaded{$address}) {
86 $_ = $overloaded{$address};
87 } else {
88 my $reftype = reftype $_;
89 if ($reftype eq "HASH") {
90 $_ = $overloaded{$address} = bless { %$_ }, ref $_;
91 } elsif ($reftype eq "ARRAY") {
92 $_ = $overloaded{$address} = bless [ @$_ ], ref $_;
93 } elsif ($reftype eq "SCALAR" || $reftype eq "REF") {
94 $_ = $overloaded{$address} = bless \do{my $o = $$_},ref $_;
95 } else {
96 croak "Do not know how to reconstitute blessed object of base type $reftype";
97 }
98 }
99 } else {
100 bless $_, ref $_;
101 }
102 }
103 }
104 return @_;
105}
106
107
10817µs1;
109
110__END__;
 
# spent 6µs within CGI::Session::Serialize::default::CORE:match which was called: # once (6µs+0s) by CGI::Session::Serialize::default::thaw at line 38
sub CGI::Session::Serialize::default::CORE:match; # opcode