Filename | /usr/local/src/github.com/foswiki/core/lib/CPAN/lib/CGI/Session/Serialize/default.pm |
Statements | Executed 135 statements in 2.31ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 6.67ms | 7.21ms | BEGIN@7 | CGI::Session::Serialize::default::
1 | 1 | 1 | 3.99ms | 91.2ms | BEGIN@6 | CGI::Session::Serialize::default::
1 | 1 | 1 | 263µs | 508µs | __walk | CGI::Session::Serialize::default::
2 | 1 | 1 | 220µs | 782µs | freeze | CGI::Session::Serialize::default::
4 | 2 | 1 | 159µs | 197µs | __scan | CGI::Session::Serialize::default::
1 | 1 | 1 | 71µs | 5.34ms | thaw | CGI::Session::Serialize::default::
1 | 1 | 1 | 30µs | 38µs | BEGIN@5 | CGI::Session::Serialize::default::
1 | 1 | 1 | 21µs | 76µs | BEGIN@11 | CGI::Session::Serialize::default::
1 | 1 | 1 | 20µs | 118µs | BEGIN@9 | CGI::Session::Serialize::default::
1 | 1 | 1 | 17µs | 82µs | BEGIN@10 | CGI::Session::Serialize::default::
1 | 1 | 1 | 15µs | 15µs | BEGIN@8 | CGI::Session::Serialize::default::
1 | 1 | 1 | 6µs | 6µs | CORE:match (opcode) | CGI::Session::Serialize::default::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package CGI::Session::Serialize::default; | ||||
2 | |||||
3 | # $Id: default.pm 447 2008-11-01 03:46:08Z markstos $ | ||||
4 | |||||
5 | 2 | 51µs | 2 | 46µ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 # spent 38µs making 1 call to CGI::Session::Serialize::default::BEGIN@5
# spent 8µs making 1 call to strict::import |
6 | 2 | 217µs | 1 | 91.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 # spent 91.2ms making 1 call to CGI::Session::Serialize::default::BEGIN@6 |
7 | 2 | 248µs | 2 | 7.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 # spent 7.21ms making 1 call to CGI::Session::Serialize::default::BEGIN@7
# spent 73µs making 1 call to Exporter::import |
8 | 2 | 52µs | 1 | 15µ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 # spent 15µs making 1 call to CGI::Session::Serialize::default::BEGIN@8 |
9 | 2 | 52µs | 2 | 217µ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 # spent 118µs making 1 call to CGI::Session::Serialize::default::BEGIN@9
# spent 99µs making 1 call to Exporter::import |
10 | 2 | 48µs | 2 | 146µ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 # spent 82µs making 1 call to CGI::Session::Serialize::default::BEGIN@10
# spent 64µs making 1 call to Exporter::import |
11 | 2 | 841µs | 2 | 131µ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 # spent 76µs making 1 call to CGI::Session::Serialize::default::BEGIN@11
# spent 55µs making 1 call to vars::import |
12 | 1 | 2µs | require overload; | ||
13 | |||||
14 | 1 | 11µs | @CGI::Session::Serialize::default::ISA = ( "CGI::Session::ErrorHandler" ); | ||
15 | 1 | 2µ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 | ||||
19 | 18 | 198µs | my ($class, $data) = @_; | ||
20 | |||||
21 | 2 | 126µs | my $d = # spent 126µs making 2 calls to Data::Dumper::new, avg 63µs/call | ||
22 | new Data::Dumper([$data], ["D"]); | ||||
23 | 2 | 45µs | $d->Indent( 0 ); # spent 45µs making 2 calls to Data::Dumper::Indent, avg 23µs/call | ||
24 | 2 | 20µs | $d->Purity( 1 ); # spent 20µs making 2 calls to Data::Dumper::Purity, avg 10µs/call | ||
25 | 2 | 19µs | $d->Useqq( 0 ); # spent 19µs making 2 calls to Data::Dumper::Useqq, avg 9µs/call | ||
26 | 2 | 19µs | $d->Deepcopy( 0 ); # spent 19µs making 2 calls to Data::Dumper::Deepcopy, avg 10µs/call | ||
27 | 2 | 15µs | $d->Quotekeys( 1 ); # spent 15µs making 2 calls to Data::Dumper::Quotekeys, avg 8µs/call | ||
28 | 2 | 14µ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 | ||||
31 | 2 | 304µ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 | ||||
35 | 6 | 59µs | my ($class, $string) = @_; | ||
36 | |||||
37 | # To make -T happy | ||||
38 | 1 | 6µs | my ($safe_string) = $string =~ m/^(.*)$/s; # spent 6µs making 1 call to CGI::Session::Serialize::default::CORE:match | ||
39 | 2 | 4.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 | ||
40 | 1 | 12µs | 1 | 150µs | if ( $@ ) { # spent 150µs making 1 call to Safe::DESTROY |
41 | return $class->set_error("thaw(): couldn't thaw. $@"); | ||||
42 | } | ||||
43 | 1 | 508µ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 | ||||
48 | 62 | 306µs | my %seen; | ||
49 | 1 | 20µ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; | ||||
57 | 22 | 40µs | $seen{refaddr $x || ''}++ and next; # spent 40µs making 22 calls to Scalar::Util::refaddr, avg 2µs/call | ||
58 | |||||
59 | 4 | 8µ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 | ||||
63 | 3 | 177µ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 | sub __scan { | ||||
76 | # $_ gets aliased to each value from @_ which are aliases of the values in | ||||
77 | # the current data structure | ||||
78 | 31 | 204µs | for (@_) { | ||
79 | 23 | 38µ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 | |||||
108 | 1 | 7µs | 1; | ||
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 |