| File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Params/ValidateXS.pm |
| Statements Executed | 38 |
| Statement Execution Time | 748µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 610 | 7 | 6 | 23.4ms | 25.2ms | Params::Validate::_validate (xsub) |
| 504 | 4 | 3 | 10.4ms | 10.4ms | Params::Validate::_validate_pos (xsub) |
| 10 | 1 | 1 | 99µs | 166µs | Params::Validate::_check_regex_from_xs |
| 10 | 1 | 2 | 41µs | 41µs | Params::Validate::CORE:match (opcode) |
| 2 | 2 | 2 | 37µs | 45µs | Params::Validate::BEGIN@3 |
| 10 | 1 | 2 | 27µs | 27µs | Params::Validate::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 18µs | 18µs | Params::Validate::BEGIN@41 |
| 1 | 1 | 1 | 12µs | 12µs | Params::Validate::validation_options |
| 1 | 1 | 1 | 9µs | 24µs | Params::Validate::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | Params::Validate::__ANON__[:11] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Params::Validate; | ||||
| 2 | |||||
| 3 | 3 | 22µs | 2 | 27µs | # spent 45µs (37+8) within Params::Validate::BEGIN@3 which was called 2 times, avg 22µs/call:
# once (21µs+3µs) by Params::Validate::BEGIN@5 at line 3
# once (16µs+5µs) by SimpleDB::Class::Cache::BEGIN@33 at line 3 of Params/Validate.pm # spent 24µs making 1 call to Params::Validate::BEGIN@3
# spent 3µs making 1 call to strict::import |
| 4 | 3 | 239µs | 2 | 38µs | # spent 24µs (9+15) within Params::Validate::BEGIN@4 which was called
# once (9µs+15µs) by Params::Validate::BEGIN@5 at line 4 # spent 24µs making 1 call to Params::Validate::BEGIN@4
# spent 15µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 600ns | require XSLoader; | ||
| 7 | 1 | 239µs | 1 | 234µs | XSLoader::load( 'Params::Validate', $Params::Validate::VERSION ); # spent 234µs making 1 call to XSLoader::load |
| 8 | |||||
| 9 | |||||
| 10 | my $default_fail = sub { require Carp; | ||||
| 11 | 1 | 2µs | Carp::confess($_[0]) }; | ||
| 12 | |||||
| 13 | { | ||||
| 14 | 2 | 4µs | my %defaults = ( ignore_case => 0, | ||
| 15 | strip_leading => 0, | ||||
| 16 | allow_extra => 0, | ||||
| 17 | on_fail => $default_fail, | ||||
| 18 | stack_skip => 1, | ||||
| 19 | normalize_keys => undef, | ||||
| 20 | ); | ||||
| 21 | |||||
| 22 | 1 | 1µs | *set_options = \&validation_options; | ||
| 23 | sub validation_options | ||||
| 24 | # spent 12µs within Params::Validate::validation_options which was called
# once (12µs+0s) by SimpleDB::Class::BEGIN@139 at line 38 of ../lib/SimpleDB/Class/Cache.pm | ||||
| 25 | 10 | 13µs | my %opts = @_; | ||
| 26 | |||||
| 27 | my $caller = caller; | ||||
| 28 | |||||
| 29 | foreach ( keys %defaults ) | ||||
| 30 | { | ||||
| 31 | $opts{$_} = $defaults{$_} unless exists $opts{$_}; | ||||
| 32 | } | ||||
| 33 | |||||
| 34 | $OPTIONS{$caller} = \%opts; | ||||
| 35 | } | ||||
| 36 | } | ||||
| 37 | |||||
| 38 | 10 | 171µs | 20 | 67µs | # spent 166µs (99+67) within Params::Validate::_check_regex_from_xs which was called 10 times, avg 17µs/call:
# 10 times (99µs+67µs) by Params::Validate::_validate at line 456 of DateTime.pm, avg 17µs/call # spent 41µs making 10 calls to Params::Validate::CORE:match, avg 4µs/call
# spent 27µs making 10 calls to Params::Validate::CORE:regcomp, avg 3µs/call |
| 39 | |||||
| 40 | BEGIN | ||||
| 41 | # spent 18µs within Params::Validate::BEGIN@41 which was called
# once (18µs+0s) by Params::Validate::BEGIN@5 at line 135 | ||||
| 42 | 4 | 19µs | if ( $] >= 5.006 && $] < 5.007 ) | ||
| 43 | { | ||||
| 44 | eval <<'EOF'; | ||||
| 45 | sub check_for_error | ||||
| 46 | { | ||||
| 47 | if ( defined $Params::Validate::ERROR ) | ||||
| 48 | { | ||||
| 49 | $Params::Validate::ON_FAIL ||= sub { require Carp; Carp::croak( $_[0] ) }; | ||||
| 50 | |||||
| 51 | $Params::Validate::ON_FAIL->($Params::Validate::ERROR) | ||||
| 52 | } | ||||
| 53 | } | ||||
| 54 | |||||
| 55 | sub validate_pos (\@@) | ||||
| 56 | { | ||||
| 57 | local $Params::Validate::ERROR; | ||||
| 58 | local $Params::Validate::ON_FAIL; | ||||
| 59 | local $Params::Validate::CALLER = caller; | ||||
| 60 | |||||
| 61 | my $r; | ||||
| 62 | if (defined wantarray) | ||||
| 63 | { | ||||
| 64 | $r = &_validate_pos; | ||||
| 65 | } | ||||
| 66 | else | ||||
| 67 | { | ||||
| 68 | &_validate_pos; | ||||
| 69 | } | ||||
| 70 | |||||
| 71 | check_for_error(); | ||||
| 72 | |||||
| 73 | return wantarray ? @$r : $r if defined wantarray; | ||||
| 74 | } | ||||
| 75 | |||||
| 76 | sub validate (\@$) | ||||
| 77 | { | ||||
| 78 | local $Params::Validate::ERROR; | ||||
| 79 | local $Params::Validate::ON_FAIL; | ||||
| 80 | local $Params::Validate::CALLER = caller; | ||||
| 81 | |||||
| 82 | my $r; | ||||
| 83 | if (defined wantarray) | ||||
| 84 | { | ||||
| 85 | $r = &_validate; | ||||
| 86 | } | ||||
| 87 | else | ||||
| 88 | { | ||||
| 89 | &_validate; | ||||
| 90 | } | ||||
| 91 | |||||
| 92 | check_for_error(); | ||||
| 93 | |||||
| 94 | return wantarray ? %$r : $r if defined wantarray; | ||||
| 95 | } | ||||
| 96 | |||||
| 97 | sub validate_with | ||||
| 98 | { | ||||
| 99 | local $Params::Validate::ERROR; | ||||
| 100 | local $Params::Validate::ON_FAIL; | ||||
| 101 | local $Params::Validate::CALLER = caller; | ||||
| 102 | |||||
| 103 | my $r; | ||||
| 104 | if (defined wantarray) | ||||
| 105 | { | ||||
| 106 | $r = &_validate_with; | ||||
| 107 | } | ||||
| 108 | else | ||||
| 109 | { | ||||
| 110 | &_validate_with; | ||||
| 111 | } | ||||
| 112 | |||||
| 113 | check_for_error(); | ||||
| 114 | |||||
| 115 | my %p = @_; | ||||
| 116 | if ( UNIVERSAL::isa( $p{spec}, 'ARRAY' ) ) | ||||
| 117 | { | ||||
| 118 | return wantarray ? @$r : $r if defined wantarray; | ||||
| 119 | } | ||||
| 120 | else | ||||
| 121 | { | ||||
| 122 | return wantarray ? %$r : $r if defined wantarray; | ||||
| 123 | } | ||||
| 124 | } | ||||
| 125 | EOF | ||||
| 126 | |||||
| 127 | die $@ if $@; | ||||
| 128 | } | ||||
| 129 | else | ||||
| 130 | { | ||||
| 131 | *validate = \&_validate; | ||||
| 132 | *validate_pos = \&_validate_pos; | ||||
| 133 | *validate_with = \&_validate_with; | ||||
| 134 | } | ||||
| 135 | 1 | 26µs | 1 | 18µs | } # spent 18µs making 1 call to Params::Validate::BEGIN@41 |
| 136 | |||||
| 137 | 1 | 10µs | 1; | ||
| 138 | |||||
| 139 | __END__ | ||||
| 140 | |||||
| 141 | =head1 NAME | ||||
| 142 | |||||
| 143 | Params::ValidateXS - XS implementation of Params::Validate | ||||
| 144 | |||||
| 145 | =head1 SYNOPSIS | ||||
| 146 | |||||
| 147 | See Params::Validate | ||||
| 148 | |||||
| 149 | =head1 DESCRIPTION | ||||
| 150 | |||||
| 151 | This is an XS implementation of Params::Validate. See the | ||||
| 152 | Params::Validate documentation for details. | ||||
| 153 | |||||
| 154 | =head1 COPYRIGHT | ||||
| 155 | |||||
| 156 | Copyright (c) 2004-2007 David Rolsky. All rights reserved. This | ||||
| 157 | program is free software; you can redistribute it and/or modify it | ||||
| 158 | under the same terms as Perl itself. | ||||
| 159 | |||||
| 160 | =cut | ||||
# spent 41µs within Params::Validate::CORE:match which was called 10 times, avg 4µs/call:
# 10 times (41µs+0s) by Params::Validate::_check_regex_from_xs at line 38 of Params/ValidateXS.pm, avg 4µs/call | |||||
# spent 27µs within Params::Validate::CORE:regcomp which was called 10 times, avg 3µs/call:
# 10 times (27µs+0s) by Params::Validate::_check_regex_from_xs at line 38 of Params/ValidateXS.pm, avg 3µs/call | |||||
# spent 25.2ms (23.4+1.77) within Params::Validate::_validate which was called 610 times, avg 41µs/call:
# 466 times (16.7ms+0s) by DateTime::Locale::_register at line 46 of DateTime/Locale.pm, avg 36µs/call
# 63 times (1.75ms+0s) by DateTime::TimeZone::new at line 34 of DateTime/TimeZone.pm, avg 28µs/call
# 39 times (3.14ms+1.57ms) by DateTime::new at line 189 of DateTime.pm, avg 121µs/call
# 17 times (773µs+28µs) by DateTime::from_object at line 501 of DateTime.pm, avg 47µs/call
# 10 times (574µs+166µs) by DateTime::from_epoch at line 456 of DateTime.pm, avg 74µs/call
# 10 times (254µs+0s) by DateTime::TimeZone::OffsetOnly::new at line 16 of DateTime/TimeZone/OffsetOnly.pm, avg 25µs/call
# 5 times (268µs+0s) by DateTime::Format::Strptime::new at line 127 of DateTime/Format/Strptime.pm, avg 54µs/call | |||||
# spent 10.4ms within Params::Validate::_validate_pos which was called 504 times, avg 21µs/call:
# 423 times (7.21ms+0s) by DateTime::Locale::_registered_id at line 96 of DateTime/Locale.pm, avg 17µs/call
# 40 times (1.16ms+0s) by DateTime::Locale::load at line 187 of DateTime/Locale.pm, avg 29µs/call
# 24 times (1.36ms+0s) by SimpleDB::Class::Cache::get at line 254 of ../lib/SimpleDB/Class/Cache.pm, avg 57µs/call
# 17 times (714µs+0s) by SimpleDB::Class::Cache::set at line 379 of ../lib/SimpleDB/Class/Cache.pm, avg 42µs/call |