Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Tapper/Schema/TestTools.pm |
Statements | Executed 57 statements in 1.42ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 370µs | 76.0ms | BEGIN@21 | Tapper::Schema::TestTools::
1 | 1 | 1 | 341µs | 178ms | BEGIN@20 | Tapper::Schema::TestTools::
2 | 1 | 1 | 330µs | 330µs | CORE:unlink (opcode) | Tapper::Schema::TestTools::
2 | 2 | 1 | 217µs | 8.52s | setup_db | Tapper::Schema::TestTools::
1 | 1 | 1 | 34µs | 3.53s | setup_reportsdb | Tapper::Schema::TestTools::
2 | 1 | 1 | 25µs | 25µs | CORE:match (opcode) | Tapper::Schema::TestTools::
1 | 1 | 1 | 19µs | 5.00s | setup_testrundb | Tapper::Schema::TestTools::
1 | 1 | 1 | 18µs | 18µs | import | Tapper::Schema::TestTools::
1 | 1 | 1 | 12µs | 12µs | BEGIN@2 | Tapper::Schema::TestTools::
1 | 1 | 1 | 11µs | 15µs | BEGIN@11 | Tapper::Schema::TestTools::
1 | 1 | 1 | 11µs | 26µs | BEGIN@15 | Tapper::Schema::TestTools::
1 | 1 | 1 | 10µs | 10µs | BEGIN@23 | Tapper::Schema::TestTools::
1 | 1 | 1 | 9µs | 27µs | BEGIN@60 | Tapper::Schema::TestTools::
1 | 1 | 1 | 8µs | 23µs | BEGIN@12 | Tapper::Schema::TestTools::
1 | 1 | 1 | 7µs | 7µs | BEGIN@16 | Tapper::Schema::TestTools::
1 | 1 | 1 | 7µs | 7µs | __ANON__[:61] | Tapper::Schema::TestTools::
1 | 1 | 1 | 3µs | 3µs | BEGIN@14 | Tapper::Schema::TestTools::
0 | 0 | 0 | 0s | 0s | __ANON__[:62] | Tapper::Schema::TestTools::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Tapper::Schema::TestTools; | ||||
2 | # spent 12µs within Tapper::Schema::TestTools::BEGIN@2 which was called:
# once (12µs+0s) by main::BEGIN@18 at line 4 | ||||
3 | 1 | 4µs | $Tapper::Schema::TestTools::AUTHORITY = 'cpan:AMD'; | ||
4 | 1 | 22µs | 1 | 12µs | } # spent 12µs making 1 call to Tapper::Schema::TestTools::BEGIN@2 |
5 | { | ||||
6 | 2 | 2µs | $Tapper::Schema::TestTools::VERSION = '0.001'; | ||
7 | } | ||||
8 | |||||
9 | # inspired by Test::Fixture::DBIC::Schema | ||||
10 | |||||
11 | 3 | 18µs | 2 | 19µs | # spent 15µs (11+4) within Tapper::Schema::TestTools::BEGIN@11 which was called:
# once (11µs+4µs) by main::BEGIN@18 at line 11 # spent 15µs making 1 call to Tapper::Schema::TestTools::BEGIN@11
# spent 4µs making 1 call to strict::import |
12 | 3 | 21µs | 2 | 38µs | # spent 23µs (8+15) within Tapper::Schema::TestTools::BEGIN@12 which was called:
# once (8µs+15µs) by main::BEGIN@18 at line 12 # spent 23µs making 1 call to Tapper::Schema::TestTools::BEGIN@12
# spent 15µs making 1 call to warnings::import |
13 | |||||
14 | # spent 3µs within Tapper::Schema::TestTools::BEGIN@14 which was called:
# once (3µs+0s) by main::BEGIN@18 at line 18 | ||||
15 | 3 | 24µs | 2 | 41µs | # spent 26µs (11+15) within Tapper::Schema::TestTools::BEGIN@15 which was called:
# once (11µs+15µs) by main::BEGIN@18 at line 15 # spent 26µs making 1 call to Tapper::Schema::TestTools::BEGIN@15
# spent 15µs making 1 call to Class::C3::import |
16 | 3 | 24µs | 1 | 7µs | # spent 7µs within Tapper::Schema::TestTools::BEGIN@16 which was called:
# once (7µs+0s) by main::BEGIN@18 at line 16 # spent 7µs making 1 call to Tapper::Schema::TestTools::BEGIN@16 |
17 | 1 | 3µs | $DBD::SQLite::sqlite_version; # fix "used only once" warning | ||
18 | 1 | 12µs | 1 | 3µs | } # spent 3µs making 1 call to Tapper::Schema::TestTools::BEGIN@14 |
19 | |||||
20 | 3 | 122µs | 1 | 178ms | # spent 178ms (341µs+178) within Tapper::Schema::TestTools::BEGIN@20 which was called:
# once (341µs+178ms) by main::BEGIN@18 at line 20 # spent 178ms making 1 call to Tapper::Schema::TestTools::BEGIN@20 |
21 | 3 | 188µs | 1 | 76.0ms | # spent 76.0ms (370µs+75.6) within Tapper::Schema::TestTools::BEGIN@21 which was called:
# once (370µs+75.6ms) by main::BEGIN@18 at line 21 # spent 76.0ms making 1 call to Tapper::Schema::TestTools::BEGIN@21 |
22 | |||||
23 | 3 | 230µs | 1 | 10µs | # spent 10µs within Tapper::Schema::TestTools::BEGIN@23 which was called:
# once (10µs+0s) by main::BEGIN@18 at line 23 # spent 10µs making 1 call to Tapper::Schema::TestTools::BEGIN@23 |
24 | |||||
25 | 1 | 100ns | my $testrundb_schema; | ||
26 | 1 | 200ns | my $reportsdb_schema; | ||
27 | |||||
28 | |||||
29 | sub setup_db | ||||
30 | { | ||||
31 | # explicitely prefix into {test} subhash of the config file, | ||||
32 | # to avoid painful mistakes with deploy | ||||
33 | |||||
34 | 2 | 4µs | my ($db, $cfgbase) = @_; | ||
35 | |||||
36 | 2 | 5µs | my $cfg = $cfgbase->{$db}; | ||
37 | 2 | 4µs | my $dsn = $cfg->{dsn}; | ||
38 | 2 | 41µs | 2 | 25µs | my ($tmpfname) = $dsn =~ m,dbi:SQLite:dbname=([\w./]+),i; # spent 25µs making 2 calls to Tapper::Schema::TestTools::CORE:match, avg 12µs/call |
39 | 2 | 344µs | 2 | 330µs | unlink $tmpfname; # spent 330µs making 2 calls to Tapper::Schema::TestTools::CORE:unlink, avg 165µs/call |
40 | 2 | 57µs | 2 | 32.6ms | my $schema = $db eq "ReportsDB" ? Tapper::Schema::ReportsDB->connect($dsn, $cfg->{username}, $cfg->{password}, { ignore_version => 1 }) # spent 32.6ms making 2 calls to DBIx::Class::Schema::connect, avg 16.3ms/call |
41 | : Tapper::Schema::TestrunDB->connect($dsn, $cfg->{username}, $cfg->{password}, { ignore_version => 1 }); | ||||
42 | 2 | 41µs | 2 | 8.48s | $schema->deploy; # spent 8.48s making 2 calls to DBIx::Class::Schema::Versioned::deploy, avg 4.24s/call |
43 | 2 | 41µs | 4 | 13.8ms | $schema->upgrade if $schema->schema_version > $schema->get_db_version; # spent 13.8ms making 2 calls to DBIx::Class::Schema::Versioned::get_db_version, avg 6.88ms/call
# spent 57µs making 2 calls to DBIx::Class::Schema::schema_version, avg 28µs/call |
44 | 2 | 21µs | return $schema; | ||
45 | } | ||||
46 | |||||
47 | |||||
48 | # spent 5.00s (19µs+5.00) within Tapper::Schema::TestTools::setup_testrundb which was called:
# once (19µs+5.00s) by main::BEGIN@18 at line 65 | ||||
49 | 1 | 14µs | 2 | 5.00s | $testrundb_schema = setup_db("TestrunDB", Tapper::Config->subconfig->{test}{database}); # spent 5.00s making 1 call to Tapper::Schema::TestTools::setup_db
# spent 2µs making 1 call to Tapper::Config::subconfig |
50 | } | ||||
51 | |||||
52 | |||||
53 | # spent 3.53s (34µs+3.53) within Tapper::Schema::TestTools::setup_reportsdb which was called:
# once (34µs+3.53s) by main::BEGIN@18 at line 66 | ||||
54 | 1 | 25µs | 2 | 3.53s | $reportsdb_schema = setup_db("ReportsDB", Tapper::Config->subconfig->{test}{database}); # spent 3.53s making 1 call to Tapper::Schema::TestTools::setup_db
# spent 4µs making 1 call to Tapper::Config::subconfig |
55 | } | ||||
56 | |||||
57 | |||||
58 | # spent 18µs within Tapper::Schema::TestTools::import which was called:
# once (18µs+0s) by main::BEGIN@18 at line 18 of xt/tapper-mcp-scheduler-with-db-longrun.t | ||||
59 | 1 | 2µs | my $pkg = caller(0); | ||
60 | 3 | 98µs | 2 | 44µs | # spent 27µs (9+18) within Tapper::Schema::TestTools::BEGIN@60 which was called:
# once (9µs+18µs) by main::BEGIN@18 at line 60 # spent 27µs making 1 call to Tapper::Schema::TestTools::BEGIN@60
# spent 18µs making 1 call to strict::unimport |
61 | 2 | 24µs | # spent 7µs within Tapper::Schema::TestTools::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Tapper/Schema/TestTools.pm:61] which was called:
# once (7µs+0s) by main::RUNTIME at line 37 of xt/tapper-mcp-scheduler-with-db-longrun.t | ||
62 | 1 | 9µs | *{"$pkg\::reportsdb_schema"} = sub () { $reportsdb_schema }; | ||
63 | } | ||||
64 | |||||
65 | 1 | 2µs | 1 | 5.00s | setup_testrundb; # spent 5.00s making 1 call to Tapper::Schema::TestTools::setup_testrundb |
66 | 1 | 6µs | 1 | 3.53s | setup_reportsdb; # spent 3.53s making 1 call to Tapper::Schema::TestTools::setup_reportsdb |
67 | |||||
68 | 1 | 12µs | 1; | ||
69 | |||||
70 | __END__ | ||||
# spent 25µs within Tapper::Schema::TestTools::CORE:match which was called 2 times, avg 12µs/call:
# 2 times (25µs+0s) by Tapper::Schema::TestTools::setup_db at line 38, avg 12µs/call | |||||
# spent 330µs within Tapper::Schema::TestTools::CORE:unlink which was called 2 times, avg 165µs/call:
# 2 times (330µs+0s) by Tapper::Schema::TestTools::setup_db at line 39, avg 165µs/call |