File | /project/perl/lib/Class/DBI/Column.pm |
Statements Executed | 6662 |
Statement Execution Time | 137ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3292 | 3 | 3 | 86.8ms | 130ms | name_lc | Class::DBI::Column::
10 | 1 | 1 | 655µs | 1.81ms | new | Class::DBI::Column::
10 | 1 | 1 | 190µs | 190µs | add_group | Class::DBI::Column::
5 | 2 | 2 | 172µs | 172µs | groups | Class::DBI::Column::
4 | 1 | 1 | 117µs | 254µs | in_database | Class::DBI::Column::
0 | 0 | 0 | 0s | 0s | BEGIN | Class::DBI::Column::
0 | 0 | 0 | 0s | 0s | __ANON__[:37] | Class::DBI::Column::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::DBI::Column; | ||||
2 | |||||
3 | =head1 NAME | ||||
4 | |||||
5 | Class::DBI::Column - A column in a table | ||||
6 | |||||
7 | =head1 SYNOPSIS | ||||
8 | |||||
9 | my $column = Class::DBI::Column->new($name); | ||||
10 | |||||
11 | my $name = $column->name; | ||||
12 | |||||
13 | my @groups = $column->groups; | ||||
14 | my $pri_col = $colg->primary; | ||||
15 | |||||
16 | if ($column->in_database) { ... } | ||||
17 | |||||
18 | =head1 DESCRIPTION | ||||
19 | |||||
20 | Each Class::DBI class maintains a list of its columns as class data. | ||||
21 | This provides an interface to those columns. You probably shouldn't be | ||||
22 | dealing with this directly. | ||||
23 | |||||
24 | =head1 METHODS | ||||
25 | |||||
26 | =cut | ||||
27 | |||||
28 | 3 | 97µs | 1 | 26µs | use strict; # spent 26µs making 1 call to strict::import |
29 | 3 | 93µs | 1 | 0s | use base 'Class::Accessor::Fast'; # spent 2.05ms making 1 call to base::import, recursion: max depth 3, time 2.05ms |
30 | 3 | 185µs | 1 | 248µs | use Carp; # spent 248µs making 1 call to Exporter::import |
31 | |||||
32 | 1 | 37µs | 1 | 1.12ms | __PACKAGE__->mk_accessors( # spent 1.12ms making 1 call to Class::Accessor::mk_accessors |
33 | qw/name accessor mutator placeholder is_constrained/ | ||||
34 | ); | ||||
35 | |||||
36 | use overload | ||||
37 | 3272 | 54.7ms | 3272 | 129ms | '""' => sub { shift->name_lc }, # spent 129ms making 3272 calls to Class::DBI::Column::name_lc, avg 39µs/call |
38 | 3 | 2.31ms | 1 | 185µs | fallback => 1; # spent 185µs making 1 call to overload::import |
39 | |||||
40 | =head2 new | ||||
41 | |||||
42 | my $column = Class::DBI::Column->new($column) | ||||
43 | |||||
44 | A new object for this column. | ||||
45 | |||||
46 | =cut | ||||
47 | |||||
48 | # spent 1.81ms (655µs+1.16) within Class::DBI::Column::new which was called 10 times, avg 182µs/call:
# 10 times (655µs+1.16ms) by Class::DBI::_set_columns at line 246 of Class/DBI.pm, avg 182µs/call | ||||
49 | 40 | 642µs | my $class = shift; | ||
50 | my $name = shift or croak "Column needs a name"; | ||||
51 | my $opt = shift || {}; | ||||
52 | return $class->SUPER::new( # spent 1.16ms making 10 calls to Class::Accessor::new, avg 116µs/call | ||||
53 | { | ||||
54 | name => $name, | ||||
55 | accessor => $name, | ||||
56 | mutator => $name, | ||||
57 | _groups => {}, | ||||
58 | placeholder => '?', | ||||
59 | %$opt, | ||||
60 | } | ||||
61 | ); | ||||
62 | } | ||||
63 | |||||
64 | 3292 | 78.2ms | 3292 | 42.9ms | # spent 130ms (86.8+42.9) within Class::DBI::Column::name_lc which was called 3292 times, avg 39µs/call:
# 3272 times (86.2ms+42.6ms) by Class::DBI::ColumnGrouper::_uniq or Class::DBI::ColumnGrouper::add_column or Class::DBI::ColumnGrouper::find_column or Class::DBI::Relationship::HasA::remap_arguments or Class::DBI::Relationship::HasA::triggers or Class::DBI::SQL::Transformer::_do_transformation or Class::DBI::_attribute_exists or Class::DBI::_attribute_store or Class::DBI::_attrs or Class::DBI::_extend_class_data or Class::DBI::_extend_meta or Class::DBI::_flesh or Class::DBI::_live_object_key or Class::DBI::_make_method or Class::DBI::meta_info at line 37, avg 39µs/call
# 10 times (260µs+136µs) by Class::DBI::ColumnGrouper::add_column at line 85 of Class/DBI/ColumnGrouper.pm, avg 40µs/call
# 10 times (270µs+125µs) by Class::DBI::_mk_column_accessors at line 359 of Class/DBI.pm, avg 40µs/call # spent 42.9ms making 3292 calls to Class::Accessor::Fast::__ANON__[Class/Accessor/Fast.pm:41], avg 13µs/call |
65 | |||||
66 | # spent 190µs within Class::DBI::Column::add_group which was called 10 times, avg 19µs/call:
# 10 times (190µs+0s) by Class::DBI::ColumnGrouper::add_group at line 113 of Class/DBI/ColumnGrouper.pm, avg 19µs/call | ||||
67 | 20 | 210µs | my ($self, $group) = @_; | ||
68 | $self->{_groups}->{$group} = 1; | ||||
69 | } | ||||
70 | |||||
71 | # spent 172µs within Class::DBI::Column::groups which was called 5 times, avg 34µs/call:
# 4 times (137µs+0s) by Class::DBI::Column::in_database at line 79, avg 34µs/call
# once (35µs+0s) by Class::DBI::ColumnGrouper::groups_for at line 136 of Class/DBI/ColumnGrouper.pm | ||||
72 | 20 | 188µs | my $self = shift; | ||
73 | my %groups = %{ $self->{_groups} }; | ||||
74 | delete $groups{All} if keys %groups > 1; | ||||
75 | return keys %groups; | ||||
76 | } | ||||
77 | |||||
78 | # spent 254µs (117+137) within Class::DBI::Column::in_database which was called 4 times, avg 64µs/call:
# 4 times (117µs+137µs) by Class::DBI::ColumnGrouper::all_columns at line 174 of Class/DBI/ColumnGrouper.pm, avg 64µs/call | ||||
79 | 4 | 115µs | 4 | 137µs | return !scalar grep $_ eq "TEMP", shift->groups; # spent 137µs making 4 calls to Class::DBI::Column::groups, avg 34µs/call |
80 | } | ||||
81 | |||||
82 | 1 | 16µs | 1; |