Profile of Test/Fixture/DBIC/Schema.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For xt/tapper-mcp-scheduler-with-db-longrun.t
Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:23:06 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Test/Fixture/DBIC/Schema.pm
Statements | Executed 84 statements in 4.48ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 2.23ms | 2.71s | Test::Fixture::DBIC::Schema::::_insertTest::Fixture::DBIC::Schema::_insert
1 | 1 | 1 | 2.22ms | 2.41ms | Test::Fixture::DBIC::Schema::::BEGIN@8Test::Fixture::DBIC::Schema::BEGIN@8
1 | 1 | 1 | 1.73ms | 2.18s | Test::Fixture::DBIC::Schema::::_delete_allTest::Fixture::DBIC::Schema::_delete_all
1 | 1 | 1 | 601µs | 2.02ms | Test::Fixture::DBIC::Schema::::BEGIN@7Test::Fixture::DBIC::Schema::BEGIN@7
1 | 1 | 1 | 170µs | 4.89s | Test::Fixture::DBIC::Schema::::construct_fixtureTest::Fixture::DBIC::Schema::construct_fixture
1 | 1 | 1 | 20µs | 35µs | Test::Fixture::DBIC::Schema::::BEGIN@3Test::Fixture::DBIC::Schema::BEGIN@3
1 | 1 | 1 | 19µs | 4.77ms | Test::Fixture::DBIC::Schema::::_validate_fixtureTest::Fixture::DBIC::Schema::_validate_fixture
1 | 1 | 1 | 16µs | 20µs | Test::Fixture::DBIC::Schema::::BEGIN@2Test::Fixture::DBIC::Schema::BEGIN@2
1 | 1 | 1 | 10µs | 64µs | Test::Fixture::DBIC::Schema::::BEGIN@9Test::Fixture::DBIC::Schema::BEGIN@9
1 | 1 | 1 | 9µs | 604µs | Test::Fixture::DBIC::Schema::::_load_fixtureTest::Fixture::DBIC::Schema::_load_fixture
1 | 1 | 1 | 8µs | 80µs | Test::Fixture::DBIC::Schema::::BEGIN@5Test::Fixture::DBIC::Schema::BEGIN@5

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Test::Fixture::DBIC::Schema;
2 | 3 | 20µs | 2 | 25µs | # spent 20µs (16+4) within Test::Fixture::DBIC::Schema::BEGIN@2 which was called: # once (16µs+4µs) by main::BEGIN@17 at line 2 use strict; # spent 20µs making 1 call to Test::Fixture::DBIC::Schema::BEGIN@2 # spent 4µs making 1 call to strict::import
3 | 3 | 30µs | 2 | 51µs | # spent 35µs (20+15) within Test::Fixture::DBIC::Schema::BEGIN@3 which was called: # once (20µs+15µs) by main::BEGIN@17 at line 3 use warnings; # spent 35µs making 1 call to Test::Fixture::DBIC::Schema::BEGIN@3 # spent 16µs making 1 call to warnings::import
4 | 1 | 600ns |  |  | our $VERSION = '0.03';
5 | 3 | 30µs | 2 | 154µs | # spent 80µs (8+73) within Test::Fixture::DBIC::Schema::BEGIN@5 which was called: # once (8µs+73µs) by main::BEGIN@17 at line 5 use base 'Exporter'; # spent 80µs making 1 call to Test::Fixture::DBIC::Schema::BEGIN@5 # spent 73µs making 1 call to base::import
6 | 1 | 900ns |  |  | our @EXPORT = qw/construct_fixture/;
7 | 3 | 101µs | 2 | 2.25ms | # spent 2.02ms (601µs+1.41) within Test::Fixture::DBIC::Schema::BEGIN@7 which was called: # once (601µs+1.41ms) by main::BEGIN@17 at line 7 use Params::Validate ':all'; # spent 2.02ms making 1 call to Test::Fixture::DBIC::Schema::BEGIN@7 # spent 231µs making 1 call to Exporter::import
8 | 3 | 157µs | 1 | 2.41ms | # spent 2.41ms (2.22+184µs) within Test::Fixture::DBIC::Schema::BEGIN@8 which was called: # once (2.22ms+184µs) by main::BEGIN@17 at line 8 use Kwalify (); # spent 2.41ms making 1 call to Test::Fixture::DBIC::Schema::BEGIN@8
9 | 3 | 263µs | 2 | 119µs | # spent 64µs (10+54) within Test::Fixture::DBIC::Schema::BEGIN@9 which was called: # once (10µs+54µs) by main::BEGIN@17 at line 9 use Carp; # spent 64µs making 1 call to Test::Fixture::DBIC::Schema::BEGIN@9 # spent 54µs making 1 call to Exporter::import
10 |  |  |  |  |
11 |  |  |  |  | # spent 4.89s (170µs+4.89) within Test::Fixture::DBIC::Schema::construct_fixture which was called: # once (170µs+4.89s) by main::RUNTIME at line 37 of xt/tapper-mcp-scheduler-with-db-longrun.t sub construct_fixture {
12 | 5 | 248µs | 2 | 103µs | validate( # spent 101µs making 1 call to Params::Validate::XS::validate # spent 3µs making 1 call to UNIVERSAL::isa # spent 5µs executing statements in string eval
13 |  |  |  |  | @_ => +{
14 |  |  |  |  | schema => +{ isa => 'DBIx::Class::Schema' },
15 |  |  |  |  | fixture => 1,
16 |  |  |  |  | }
17 |  |  |  |  | );
18 |  |  |  |  | my %args = @_;
19 |  |  |  |  |
20 |  |  | 2 | 5.38ms | my $fixture = _validate_fixture(_load_fixture($args{fixture})); # spent 4.77ms making 1 call to Test::Fixture::DBIC::Schema::_validate_fixture # spent 604µs making 1 call to Test::Fixture::DBIC::Schema::_load_fixture
21 |  |  | 1 | 2.18s | _delete_all($args{schema}); # spent 2.18s making 1 call to Test::Fixture::DBIC::Schema::_delete_all
22 |  |  | 1 | 2.71s | return _insert($args{schema}, $fixture); # spent 2.71s making 1 call to Test::Fixture::DBIC::Schema::_insert
23 |  |  |  |  | }
24 |  |  |  |  |
25 |  |  |  |  | # spent 604µs (9+594) within Test::Fixture::DBIC::Schema::_load_fixture which was called: # once (9µs+594µs) by Test::Fixture::DBIC::Schema::construct_fixture at line 20 sub _load_fixture {
26 | 2 | 2µs |  |  | my $stuff = shift;
27 |  |  |  |  |
28 | 2 | 8µs |  |  | if (ref $stuff) {
29 |  |  |  |  | if (ref $stuff eq 'ARRAY') {
30 |  |  |  |  | return $stuff;
31 |  |  |  |  | } else {
32 |  |  |  |  | croak "invalid fixture stuff. should be ARRAY: $stuff";
33 |  |  |  |  | }
34 |  |  |  |  | } else {
35 |  |  |  |  | require YAML::Syck;
36 |  |  | 1 | 594µs | return YAML::Syck::LoadFile($stuff); # spent 594µs making 1 call to YAML::Syck::LoadFile
37 |  |  |  |  | }
38 |  |  |  |  | }
39 |  |  |  |  |
40 |  |  |  |  | # spent 4.77ms (19µs+4.76) within Test::Fixture::DBIC::Schema::_validate_fixture which was called: # once (19µs+4.76ms) by Test::Fixture::DBIC::Schema::construct_fixture at line 20 sub _validate_fixture {
41 | 3 | 18µs |  |  | my $stuff = shift;
42 |  |  |  |  |
43 |  |  | 1 | 4.76ms | Kwalify::validate( # spent 4.76ms making 1 call to Kwalify::validate
44 |  |  |  |  | {
45 |  |  |  |  | type => 'seq',
46 |  |  |  |  | sequence => [
47 |  |  |  |  | {
48 |  |  |  |  | type => 'map',
49 |  |  |  |  | mapping => {
50 |  |  |  |  | schema => { type => 'str', required => 1 },
51 |  |  |  |  | name => { type => 'str', required => 1 },
52 |  |  |  |  | data => { type => 'any', required => 1 },
53 |  |  |  |  | },
54 |  |  |  |  | }
55 |  |  |  |  | ]
56 |  |  |  |  | },
57 |  |  |  |  | $stuff
58 |  |  |  |  | );
59 |  |  |  |  |
60 |  |  |  |  | $stuff;
61 |  |  |  |  | }
62 |  |  |  |  |
63 |  |  |  |  | # spent 2.18s (1.73ms+2.18) within Test::Fixture::DBIC::Schema::_delete_all which was called: # once (1.73ms+2.18s) by Test::Fixture::DBIC::Schema::construct_fixture at line 21 sub _delete_all {
64 | 3 | 1.59ms |  |  | my $schema = shift;
65 |  |  |  |  |
66 |  |  | 77 | 2.18s | $schema->resultset($_)->delete for # spent 2.16s making 19 calls to DBIx::Class::ResultSet::delete, avg 114ms/call # spent 15.5ms making 19 calls to DBIx::Class::Schema::resultset, avg 817µs/call # spent 140µs making 19 calls to DBIx::Class::Schema::source_registrations, avg 7µs/call # spent 34µs making 1 call to DBIx::Class::Schema::sources # spent 15µs making 19 calls to UNIVERSAL::isa, avg 779ns/call
67 |  |  |  |  | grep { $schema->source_registrations->{$_}->isa('DBIx::Class::ResultSource::Table') }
68 |  |  |  |  | $schema->sources;
69 |  |  |  |  | }
70 |  |  |  |  |
71 |  |  |  |  | # spent 2.71s (2.23ms+2.71) within Test::Fixture::DBIC::Schema::_insert which was called: # once (2.23ms+2.71s) by Test::Fixture::DBIC::Schema::construct_fixture at line 22 sub _insert {
72 | 4 | 128µs |  |  | my ($schema, $fixture) = @_;
73 |  |  |  |  |
74 |  |  |  |  | my $result = {};
75 |  |  |  |  | for my $row ( @{ $fixture } ) {
76 | 44 | 1.88ms | 44 | 2.58s | $schema->resultset( $row->{schema} )->create( $row->{data} ); # spent 2.57s making 22 calls to DBIx::Class::ResultSet::create, avg 117ms/call # spent 9.95ms making 22 calls to DBIx::Class::Schema::resultset, avg 452µs/call
77 |  |  | 44 | 127ms | $result->{ $row->{name} } = $schema->resultset( $row->{schema} )->find( $row->{data} ); # spent 115ms making 22 calls to DBIx::Class::ResultSet::find, avg 5.21ms/call # spent 12.1ms making 22 calls to DBIx::Class::Schema::resultset, avg 552µs/call
78 |  |  |  |  | }
79 |  |  |  |  | return $result;
80 |  |  |  |  | }
81 |  |  |  |  |
82 | 1 | 4µs |  |  | 1;
83 |  |  |  |  | __END__