Filename | /usr/lib/x86_64-linux-gnu/perl5/5.20/Class/XSAccessor.pm |
Statements | Executed 0 statements in 0s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
28 | 2 | 2 | 1.50ms | 2.41ms | import | Class::XSAccessor::
1 | 1 | 1 | 412µs | 527µs | BEGIN@6 | Class::XSAccessor::
28 | 1 | 1 | 362µs | 640µs | _generate_method | Class::XSAccessor::
224 | 8 | 1 | 267µs | 267µs | _make_hash | Class::XSAccessor::
24 | 1 | 1 | 213µs | 213µs | newxs_accessor (xsub) | Class::XSAccessor::
28 | 1 | 1 | 46µs | 46µs | CORE:match (opcode) | Class::XSAccessor::
1 | 1 | 1 | 24µs | 24µs | BEGIN@2 | Class::XSAccessor::
4 | 1 | 1 | 20µs | 20µs | newxs_getter (xsub) | Class::XSAccessor::
1 | 1 | 1 | 16µs | 26µs | BEGIN@3 | Class::XSAccessor::
1 | 1 | 1 | 8µs | 39µs | BEGIN@5 | Class::XSAccessor::
1 | 1 | 1 | 8µs | 15µs | BEGIN@4 | Class::XSAccessor::
1 | 1 | 1 | 8µs | 19µs | BEGIN@84 | Class::XSAccessor::
1 | 1 | 1 | 7µs | 7µs | BEGIN@7 | Class::XSAccessor::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::XSAccessor; | ||||
2 | 1 | 24µs | # spent 24µs within Class::XSAccessor::BEGIN@2 which was called:
# once (24µs+0s) by Module::Runtime::require_module at line 2 # spent 24µs making 1 call to Class::XSAccessor::BEGIN@2 | ||
3 | 2 | 36µs | # spent 26µs (16+10) within Class::XSAccessor::BEGIN@3 which was called:
# once (16µs+10µs) by Module::Runtime::require_module at line 3 # spent 26µs making 1 call to Class::XSAccessor::BEGIN@3
# spent 10µs making 1 call to strict::import | ||
4 | 2 | 22µs | # spent 15µs (8+7) within Class::XSAccessor::BEGIN@4 which was called:
# once (8µs+7µs) by Module::Runtime::require_module at line 4 # spent 15µs making 1 call to Class::XSAccessor::BEGIN@4
# spent 7µs making 1 call to warnings::import | ||
5 | 2 | 70µs | # spent 39µs (8+31) within Class::XSAccessor::BEGIN@5 which was called:
# once (8µs+31µs) by Module::Runtime::require_module at line 5 # spent 39µs making 1 call to Class::XSAccessor::BEGIN@5
# spent 31µs making 1 call to Exporter::import | ||
6 | 1 | 527µs | # spent 527µs (412+114) within Class::XSAccessor::BEGIN@6 which was called:
# once (412µs+114µs) by Module::Runtime::require_module at line 6 # spent 527µs making 1 call to Class::XSAccessor::BEGIN@6 | ||
7 | 1 | 7µs | # spent 7µs within Class::XSAccessor::BEGIN@7 which was called:
# once (7µs+0s) by Module::Runtime::require_module at line 7 # spent 7µs making 1 call to Class::XSAccessor::BEGIN@7 | ||
8 | |||||
9 | our $VERSION = '1.19'; | ||||
10 | |||||
11 | 1 | 279µs | XSLoader::load('Class::XSAccessor', $VERSION); # spent 279µs making 1 call to XSLoader::load | ||
12 | |||||
13 | # spent 267µs within Class::XSAccessor::_make_hash which was called 224 times, avg 1µs/call:
# 28 times (71µs+0s) by Class::XSAccessor::import at line 37, avg 3µs/call
# 28 times (32µs+0s) by Class::XSAccessor::import at line 38, avg 1µs/call
# 28 times (29µs+0s) by Class::XSAccessor::import at line 41, avg 1µs/call
# 28 times (28µs+0s) by Class::XSAccessor::import at line 40, avg 986ns/call
# 28 times (27µs+0s) by Class::XSAccessor::import at line 43, avg 971ns/call
# 28 times (27µs+0s) by Class::XSAccessor::import at line 39, avg 964ns/call
# 28 times (27µs+0s) by Class::XSAccessor::import at line 44, avg 961ns/call
# 28 times (26µs+0s) by Class::XSAccessor::import at line 42, avg 946ns/call | ||||
14 | my $ref = shift; | ||||
15 | |||||
16 | if (ref ($ref)) { | ||||
17 | if (ref($ref) eq 'ARRAY') { | ||||
18 | $ref = { map { $_ => $_ } @$ref } | ||||
19 | } | ||||
20 | } else { | ||||
21 | $ref = { $ref, $ref }; | ||||
22 | } | ||||
23 | |||||
24 | return $ref; | ||||
25 | } | ||||
26 | |||||
27 | # spent 2.41ms (1.50+908µs) within Class::XSAccessor::import which was called 28 times, avg 86µs/call:
# 24 times (1.32ms+818µs) by DBIx::Class::ResultSet::_result_class or DBIx::Class::ResultSet::result_source or DBIx::Class::ResultSource::_columns or DBIx::Class::ResultSource::_ordered_columns or DBIx::Class::ResultSource::_primaries or DBIx::Class::ResultSource::_relationships or DBIx::Class::ResultSource::_unique_constraints or DBIx::Class::ResultSource::name or DBIx::Class::ResultSource::source_name or DBIx::Class::Storage::DBI::_conn_pid or DBIx::Class::Storage::DBI::_connect_info or DBIx::Class::Storage::DBI::_dbh or DBIx::Class::Storage::DBI::_dbh_autocommit or DBIx::Class::Storage::DBI::_dbh_details or DBIx::Class::Storage::DBI::_dbic_connect_attributes or DBIx::Class::Storage::DBI::_driver_determined or DBIx::Class::Storage::DBI::_sql_maker or DBIx::Class::Storage::DBI::_sql_maker_opts or DBIx::Class::Storage::DBI::on_connect_call or DBIx::Class::Storage::DBI::on_connect_do or DBIx::Class::Storage::DBI::unsafe or DBIx::Class::Storage::debug or DBIx::Class::Storage::schema or DBIx::Class::Storage::transaction_depth at line 830 of Class/Accessor/Grouped.pm, avg 89µs/call
# 4 times (180µs+89µs) by Method::Generate::Accessor::_generate_xs at line 641 of Method/Generate/Accessor.pm, avg 67µs/call | ||||
28 | my $own_class = shift; | ||||
29 | my ($caller_pkg) = caller(); | ||||
30 | |||||
31 | # Support both { getters => ... } and plain getters => ... | ||||
32 | my %opts = ref($_[0]) eq 'HASH' ? %{$_[0]} : @_; | ||||
33 | |||||
34 | $caller_pkg = $opts{class} if defined $opts{class}; | ||||
35 | |||||
36 | # TODO: Refactor. Move more duplicated code to ::Heavy | ||||
37 | 28 | 71µs | my $read_subs = _make_hash($opts{getters} || {}); # spent 71µs making 28 calls to Class::XSAccessor::_make_hash, avg 3µs/call | ||
38 | 28 | 32µs | my $set_subs = _make_hash($opts{setters} || {}); # spent 32µs making 28 calls to Class::XSAccessor::_make_hash, avg 1µs/call | ||
39 | 28 | 27µs | my $acc_subs = _make_hash($opts{accessors} || {}); # spent 27µs making 28 calls to Class::XSAccessor::_make_hash, avg 964ns/call | ||
40 | 28 | 28µs | my $lvacc_subs = _make_hash($opts{lvalue_accessors} || {}); # spent 28µs making 28 calls to Class::XSAccessor::_make_hash, avg 986ns/call | ||
41 | 28 | 29µs | my $pred_subs = _make_hash($opts{predicates} || {}); # spent 29µs making 28 calls to Class::XSAccessor::_make_hash, avg 1µs/call | ||
42 | 28 | 26µs | my $ex_pred_subs = _make_hash($opts{exists_predicates} || {}); # spent 26µs making 28 calls to Class::XSAccessor::_make_hash, avg 946ns/call | ||
43 | 28 | 27µs | my $def_pred_subs = _make_hash($opts{defined_predicates} || {}); # spent 27µs making 28 calls to Class::XSAccessor::_make_hash, avg 971ns/call | ||
44 | 28 | 27µs | my $test_subs = _make_hash($opts{__tests__} || {}); # spent 27µs making 28 calls to Class::XSAccessor::_make_hash, avg 961ns/call | ||
45 | my $construct_subs = $opts{constructors} || [defined($opts{constructor}) ? $opts{constructor} : ()]; | ||||
46 | my $true_subs = $opts{true} || []; | ||||
47 | my $false_subs = $opts{false} || []; | ||||
48 | |||||
49 | foreach my $subtype ( ["getter", $read_subs], | ||||
50 | ["setter", $set_subs], | ||||
51 | ["accessor", $acc_subs], | ||||
52 | ["lvalue_accessor", $lvacc_subs], | ||||
53 | ["test", $test_subs], | ||||
54 | ["ex_predicate", $ex_pred_subs], | ||||
55 | ["def_predicate", $def_pred_subs], | ||||
56 | ["def_predicate", $pred_subs] ) | ||||
57 | { | ||||
58 | my $subs = $subtype->[1]; | ||||
59 | foreach my $subname (keys %$subs) { | ||||
60 | my $hashkey = $subs->{$subname}; | ||||
61 | 28 | 640µs | _generate_method($caller_pkg, $subname, $hashkey, \%opts, $subtype->[0]); # spent 640µs making 28 calls to Class::XSAccessor::_generate_method, avg 23µs/call | ||
62 | } | ||||
63 | } | ||||
64 | |||||
65 | foreach my $subtype ( ["constructor", $construct_subs], | ||||
66 | ["true", $true_subs], | ||||
67 | ["false", $false_subs] ) | ||||
68 | { | ||||
69 | foreach my $subname (@{$subtype->[1]}) { | ||||
70 | _generate_method($caller_pkg, $subname, "", \%opts, $subtype->[0]); | ||||
71 | } | ||||
72 | } | ||||
73 | } | ||||
74 | |||||
75 | # spent 640µs (362+279) within Class::XSAccessor::_generate_method which was called 28 times, avg 23µs/call:
# 28 times (362µs+279µs) by Class::XSAccessor::import at line 61, avg 23µs/call | ||||
76 | my ($caller_pkg, $subname, $hashkey, $opts, $type) = @_; | ||||
77 | |||||
78 | croak("Cannot use undef as a hash key for generating an XS $type accessor. (Sub: $subname)") | ||||
79 | if not defined $hashkey; | ||||
80 | |||||
81 | 28 | 46µs | $subname = "${caller_pkg}::$subname" if $subname !~ /::/; # spent 46µs making 28 calls to Class::XSAccessor::CORE:match, avg 2µs/call | ||
82 | |||||
83 | Class::XSAccessor::Heavy::check_sub_existence($subname) if not $opts->{replace}; | ||||
84 | 2 | 29µs | # spent 19µs (8+10) within Class::XSAccessor::BEGIN@84 which was called:
# once (8µs+10µs) by Module::Runtime::require_module at line 84 # spent 19µs making 1 call to Class::XSAccessor::BEGIN@84
# spent 10µs making 1 call to warnings::unimport | ||
85 | |||||
86 | 4 | 20µs | if ($type eq 'getter') { # spent 20µs making 4 calls to Class::XSAccessor::newxs_getter, avg 5µs/call | ||
87 | newxs_getter($subname, $hashkey); | ||||
88 | } | ||||
89 | elsif ($type eq 'lvalue_accessor') { | ||||
90 | newxs_lvalue_accessor($subname, $hashkey); | ||||
91 | } | ||||
92 | elsif ($type eq 'setter') { | ||||
93 | newxs_setter($subname, $hashkey, $opts->{chained}||0); | ||||
94 | } | ||||
95 | elsif ($type eq 'def_predicate') { | ||||
96 | newxs_defined_predicate($subname, $hashkey); | ||||
97 | } | ||||
98 | elsif ($type eq 'ex_predicate') { | ||||
99 | newxs_exists_predicate($subname, $hashkey); | ||||
100 | } | ||||
101 | elsif ($type eq 'constructor') { | ||||
102 | newxs_constructor($subname); | ||||
103 | } | ||||
104 | elsif ($type eq 'true') { | ||||
105 | newxs_boolean($subname, 1); | ||||
106 | } | ||||
107 | elsif ($type eq 'false') { | ||||
108 | newxs_boolean($subname, 0); | ||||
109 | } | ||||
110 | elsif ($type eq 'test') { | ||||
111 | newxs_test($subname, $hashkey); | ||||
112 | } | ||||
113 | else { | ||||
114 | 24 | 213µs | newxs_accessor($subname, $hashkey, $opts->{chained}||0); # spent 213µs making 24 calls to Class::XSAccessor::newxs_accessor, avg 9µs/call | ||
115 | } | ||||
116 | } | ||||
117 | |||||
118 | 1; | ||||
119 | |||||
120 | __END__ | ||||
# spent 46µs within Class::XSAccessor::CORE:match which was called 28 times, avg 2µs/call:
# 28 times (46µs+0s) by Class::XSAccessor::_generate_method at line 81, avg 2µs/call | |||||
# spent 213µs within Class::XSAccessor::newxs_accessor which was called 24 times, avg 9µs/call:
# 24 times (213µs+0s) by Class::XSAccessor::_generate_method at line 114, avg 9µs/call | |||||
# spent 20µs within Class::XSAccessor::newxs_getter which was called 4 times, avg 5µs/call:
# 4 times (20µs+0s) by Class::XSAccessor::_generate_method at line 86, avg 5µs/call |