← 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:41 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Tapper/Config.pm
StatementsExecuted 58 statements in 1.16ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.48ms12.0msTapper::Config::::BEGIN@16Tapper::Config::BEGIN@16
1111.57ms3.74msTapper::Config::::BEGIN@17Tapper::Config::BEGIN@17
111889µs1.48msTapper::Config::::BEGIN@15Tapper::Config::BEGIN@15
111701µs2.00msTapper::Config::::_switch_contextTapper::Config::_switch_context
111363µs480µsTapper::Config::::BEGIN@18Tapper::Config::BEGIN@18
11149µs99µsTapper::Config::::BEGIN@10Tapper::Config::BEGIN@10
53217µs17µsTapper::Config::::subconfigTapper::Config::subconfig
11111µs16µsTapper::Config::::default_mergeTapper::Config::default_merge
11110µs407µsTapper::Config::::_prepare_special_entriesTapper::Config::_prepare_special_entries
1119µs9µsTapper::Config::::BEGIN@2Tapper::Config::BEGIN@2
1118µs50µsTapper::Config::::BEGIN@10.4Tapper::Config::BEGIN@10.4
1118µs23µsTapper::Config::::BEGIN@33Tapper::Config::BEGIN@33
1118µs23µsTapper::Config::::BEGIN@13Tapper::Config::BEGIN@13
1117µs9µsTapper::Config::::BEGIN@12Tapper::Config::BEGIN@12
1117µs24µsTapper::Config::::BEGIN@19Tapper::Config::BEGIN@19
1116µs2.01msTapper::Config::::BEGIN@92Tapper::Config::BEGIN@92
2114µs4µsTapper::Config::::CORE:ftisTapper::Config::CORE:ftis (opcode)
2213µs3µsTapper::Config::::CORE:matchTapper::Config::CORE:match (opcode)
1113µs3µsTapper::Config::::_getenvTapper::Config::_getenv
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Tapper::Config;
2
# spent 9µs within Tapper::Config::BEGIN@2 which was called: # once (9µs+0s) by Tapper::Model::BEGIN@25 at line 4
BEGIN {
314µs $Tapper::Config::AUTHORITY = 'cpan:AMD';
4123µs19µs}
# spent 9µs making 1 call to Tapper::Config::BEGIN@2
5{
621µs $Tapper::Config::VERSION = '0.001';
7}
8# ABSTRACT: Tapper - Context sensitive configuration hub for all Tapper libs
9
10669µs3192µs
# spent 99µs (49+50) within Tapper::Config::BEGIN@10 which was called: # once (49µs+50µs) by Tapper::Model::BEGIN@25 at line 10 # spent 50µs (8+42) within Tapper::Config::BEGIN@10.4 which was called: # once (8µs+42µs) by Tapper::Config::BEGIN@10 at line 10
use 5.010;
# spent 99µs making 1 call to Tapper::Config::BEGIN@10 # spent 50µs making 1 call to Tapper::Config::BEGIN@10.4 # spent 42µs making 1 call to feature::import
11
12317µs212µs
# spent 9µs (7+2) within Tapper::Config::BEGIN@12 which was called: # once (7µs+2µs) by Tapper::Model::BEGIN@25 at line 12
use strict;
# spent 9µs making 1 call to Tapper::Config::BEGIN@12 # spent 2µs making 1 call to strict::import
13318µs239µs
# spent 23µs (8+16) within Tapper::Config::BEGIN@13 which was called: # once (8µs+16µs) by Tapper::Model::BEGIN@25 at line 13
use warnings;
# spent 23µs making 1 call to Tapper::Config::BEGIN@13 # spent 16µs making 1 call to warnings::import
14
15389µs21.53ms
# spent 1.48ms (889µs+591µs) within Tapper::Config::BEGIN@15 which was called: # once (889µs+591µs) by Tapper::Model::BEGIN@25 at line 15
use YAML::Syck;
# spent 1.48ms making 1 call to Tapper::Config::BEGIN@15 # spent 47µs making 1 call to Exporter::import
163125µs212.1ms
# spent 12.0ms (2.48+9.51) within Tapper::Config::BEGIN@16 which was called: # once (2.48ms+9.51ms) by Tapper::Model::BEGIN@25 at line 16
use File::Slurp 'slurp';
# spent 12.0ms making 1 call to Tapper::Config::BEGIN@16 # spent 59µs making 1 call to Exporter::import
173154µs23.80ms
# spent 3.74ms (1.57+2.17) within Tapper::Config::BEGIN@17 which was called: # once (1.57ms+2.17ms) by Tapper::Model::BEGIN@25 at line 17
use File::ShareDir 'module_file';
# spent 3.74ms making 1 call to Tapper::Config::BEGIN@17 # spent 59µs making 1 call to Exporter::import
183118µs2511µs
# spent 480µs (363+117) within Tapper::Config::BEGIN@18 which was called: # once (363µs+117µs) by Tapper::Model::BEGIN@25 at line 18
use Hash::Merge::Simple 'merge';
# spent 480µs making 1 call to Tapper::Config::BEGIN@18 # spent 31µs making 1 call to Exporter::import
19340µs242µs
# spent 24µs (7+17) within Tapper::Config::BEGIN@19 which was called: # once (7µs+17µs) by Tapper::Model::BEGIN@25 at line 19
use File::ShareDir 'module_file';
# spent 24µs making 1 call to Tapper::Config::BEGIN@19 # spent 17µs making 1 call to Exporter::import
20
21
22# --- The configuration file is lib/auto/Tapper/Config/tapper.yml ---
23{
24 # closure to forbid direct access to the config hash
252800ns my $Config;
26
- -
29 sub default_merge
30
# spent 16µs (11+4) within Tapper::Config::default_merge which was called: # once (11µs+4µs) by Tapper::Config::_switch_context at line 73
{
311800ns my ($config) = @_;
321200ns my $new_config;
333342µs238µs
# spent 23µs (8+15) within Tapper::Config::BEGIN@33 which was called: # once (8µs+15µs) by Tapper::Model::BEGIN@25 at line 33
no warnings 'uninitialized'; # $ENV{HOME} can be undef
# spent 23µs making 1 call to Tapper::Config::BEGIN@33 # spent 15µs making 1 call to warnings::unimport
34113µs24µs if (exists $ENV{TAPPER_CONFIG_FILE}) {
# spent 4µs making 2 calls to Tapper::Config::CORE:ftis, avg 2µs/call
35 my $env_config_file = $ENV{TAPPER_CONFIG_FILE} || "";
36 die "Config file '$env_config_file' does not exist.\n" unless -r $env_config_file;
37 eval {
38 $new_config = LoadFile($env_config_file);
39 };
40 die "Can not load config file '$env_config_file': $@\n" if $@;
41 } elsif ( -e "$ENV{HOME}/.tapper.cfg" ) {
42 $new_config = LoadFile("$ENV{HOME}/.tapper.cfg");
43 } elsif ( -e "/etc/tapper.cfg" ) {
44 $new_config = LoadFile("/etc/tapper.cfg");
45 } else {
46115µs return $config;
47 }
48 $config = merge($config, $new_config);
49 return $config;
50 }
51
52
53 sub _getenv
54
# spent 3µs within Tapper::Config::_getenv which was called: # once (3µs+0s) by Tapper::Config::_switch_context at line 67
{
55 return
5616µs $ENV{HARNESS_ACTIVE} ? 'test'
57 : $ENV{TAPPER_DEVELOPMENT} ? 'development'
58 : 'live';
59 }
60
61
62 # TODO: automatically recognize context switch
63 sub _switch_context
64
# spent 2.00ms (701µs+1.30) within Tapper::Config::_switch_context which was called: # once (701µs+1.30ms) by Tapper::Config::BEGIN@92 at line 92
{
651400ns shift if @_ && $_[0] && $_[0] eq 'Tapper::Config'; # throw away class if called as method
66
6711µs13µs my $env = shift // _getenv();
# spent 3µs making 1 call to Tapper::Config::_getenv
68
6916µs12µs return unless $env =~ /^test|live|development$/;
# spent 2µs making 1 call to Tapper::Config::CORE:match
70
7114µs2658µs my $yaml = slurp module_file('Tapper::Config', 'tapper.yml');
# spent 558µs making 1 call to File::ShareDir::module_file # spent 101µs making 1 call to File::Slurp::read_file
7212µs115µs $Config = Load($yaml);
# spent 15µs making 1 call to YAML::Syck::Load
7312µs116µs $Config = default_merge($Config);
# spent 16µs making 1 call to Tapper::Config::default_merge
74
7519µs1198µs $Config = merge( $Config, $Config->{$env} );
# spent 198µs making 1 call to Hash::Merge::Simple::merge
7615µs1407µs $Config = _prepare_special_entries( $Config );
# spent 407µs making 1 call to Tapper::Config::_prepare_special_entries
77 }
78
79
# spent 407µs (10+397) within Tapper::Config::_prepare_special_entries which was called: # once (10µs+397µs) by Tapper::Config::_switch_context at line 76
sub _prepare_special_entries {
801400ns my ($Config) = @_;
81
8217µs2397µs if (not $Config->{files}{log4perl_cfg} =~ m,^/,) {
# spent 396µs making 1 call to File::ShareDir::module_file # spent 2µs making 1 call to Tapper::Config::CORE:match
83 $Config->{files}{log4perl_cfg} = module_file('Tapper::Config', $Config->{files}{log4perl_cfg});
84 }
8513µs return $Config;
86 }
87
88536µs
# spent 17µs within Tapper::Config::subconfig which was called 5 times, avg 3µs/call: # 3 times (10µs+0s) by Tapper::Model::model at line 46 of Tapper/Model.pm, avg 3µs/call # once (4µs+0s) by Tapper::Schema::TestTools::setup_reportsdb at line 54 of Tapper/Schema/TestTools.pm # once (2µs+0s) by Tapper::Schema::TestTools::setup_testrundb at line 49 of Tapper/Schema/TestTools.pm
sub subconfig { $Config }
89
90}
91
92141µs24.01ms
# spent 2.01ms (6µs+2.00) within Tapper::Config::BEGIN@92 which was called: # once (6µs+2.00ms) by Tapper::Model::BEGIN@25 at line 92
BEGIN { _switch_context() }
# spent 2.01ms making 1 call to Tapper::Config::BEGIN@92 # spent 2.00ms making 1 call to Tapper::Config::_switch_context
93
9414µs1;
95
96
97__END__
 
# spent 4µs within Tapper::Config::CORE:ftis which was called 2 times, avg 2µs/call: # 2 times (4µs+0s) by Tapper::Config::default_merge at line 34, avg 2µs/call
sub Tapper::Config::CORE:ftis; # opcode
# spent 3µs within Tapper::Config::CORE:match which was called 2 times, avg 2µs/call: # once (2µs+0s) by Tapper::Config::_switch_context at line 69 # once (2µs+0s) by Tapper::Config::_prepare_special_entries at line 82
sub Tapper::Config::CORE:match; # opcode