Profile of Tapper/Config.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:22:55 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Tapper/Config.pm
Statements | Executed 58 statements in 1.16ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 2.48ms | 12.0ms | Tapper::Config::::BEGIN@16Tapper::Config::BEGIN@16
1 | 1 | 1 | 1.57ms | 3.74ms | Tapper::Config::::BEGIN@17Tapper::Config::BEGIN@17
1 | 1 | 1 | 889µs | 1.48ms | Tapper::Config::::BEGIN@15Tapper::Config::BEGIN@15
1 | 1 | 1 | 701µs | 2.00ms | Tapper::Config::::_switch_contextTapper::Config::_switch_context
1 | 1 | 1 | 363µs | 480µs | Tapper::Config::::BEGIN@18Tapper::Config::BEGIN@18
1 | 1 | 1 | 49µs | 99µs | Tapper::Config::::BEGIN@10Tapper::Config::BEGIN@10
5 | 3 | 2 | 17µs | 17µs | Tapper::Config::::subconfigTapper::Config::subconfig
1 | 1 | 1 | 11µs | 16µs | Tapper::Config::::default_mergeTapper::Config::default_merge
1 | 1 | 1 | 10µs | 407µs | Tapper::Config::::_prepare_special_entriesTapper::Config::_prepare_special_entries
1 | 1 | 1 | 9µs | 9µs | Tapper::Config::::BEGIN@2Tapper::Config::BEGIN@2
1 | 1 | 1 | 8µs | 50µs | Tapper::Config::::BEGIN@10.4Tapper::Config::BEGIN@10.4
1 | 1 | 1 | 8µs | 23µs | Tapper::Config::::BEGIN@33Tapper::Config::BEGIN@33
1 | 1 | 1 | 8µs | 23µs | Tapper::Config::::BEGIN@13Tapper::Config::BEGIN@13
1 | 1 | 1 | 7µs | 9µs | Tapper::Config::::BEGIN@12Tapper::Config::BEGIN@12
1 | 1 | 1 | 7µs | 24µs | Tapper::Config::::BEGIN@19Tapper::Config::BEGIN@19
1 | 1 | 1 | 6µs | 2.01ms | Tapper::Config::::BEGIN@92Tapper::Config::BEGIN@92
2 | 1 | 1 | 4µs | 4µs | Tapper::Config::::CORE:ftisTapper::Config::CORE:ftis (opcode)
2 | 2 | 1 | 3µs | 3µs | Tapper::Config::::CORE:matchTapper::Config::CORE:match (opcode)
1 | 1 | 1 | 3µs | 3µs | Tapper::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package 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 {
3 | 1 | 4µs |  |  | $Tapper::Config::AUTHORITY = 'cpan:AMD';
4 | 1 | 23µs | 1 | 9µs | } # spent 9µs making 1 call to Tapper::Config::BEGIN@2
5 |  |  |  |  | {
6 | 2 | 1µs |  |  | $Tapper::Config::VERSION = '0.001';
7 |  |  |  |  | }
8 |  |  |  |  | # ABSTRACT: Tapper - Context sensitive configuration hub for all Tapper libs
9 |  |  |  |  |
10 | 6 | 69µs | 3 | 192µ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 |  |  |  |  |
12 | 3 | 17µs | 2 | 12µ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
13 | 3 | 18µs | 2 | 39µ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 |  |  |  |  |
15 | 3 | 89µs | 2 | 1.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
16 | 3 | 125µs | 2 | 12.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
17 | 3 | 154µs | 2 | 3.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
18 | 3 | 118µs | 2 | 511µ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
19 | 3 | 40µs | 2 | 42µ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
25 | 2 | 800ns |  |  | 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 {
31 | 3 | 14µs |  |  | my ($config) = @_;
32 |  |  |  |  | my $new_config;
33 | 3 | 342µs | 2 | 38µ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
34 | 1 | 15µs | 2 | 4µ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 {
46 |  |  |  |  | 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
56 | 1 | 6µ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 {
65 | 8 | 30µs |  |  | shift if @_ && $_[0] && $_[0] eq 'Tapper::Config'; # throw away class if called as method
66 |  |  |  |  |
67 |  |  | 1 | 3µs | my $env = shift // _getenv(); # spent 3µs making 1 call to Tapper::Config::_getenv
68 |  |  |  |  |
69 |  |  | 1 | 2µs | return unless $env =~ /^test|live|development$/; # spent 2µs making 1 call to Tapper::Config::CORE:match
70 |  |  |  |  |
71 |  |  | 2 | 658µ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
72 |  |  | 1 | 15µs | $Config = Load($yaml); # spent 15µs making 1 call to YAML::Syck::Load
73 |  |  | 1 | 16µs | $Config = default_merge($Config); # spent 16µs making 1 call to Tapper::Config::default_merge
74 |  |  |  |  |
75 |  |  | 1 | 198µs | $Config = merge( $Config, $Config->{$env} ); # spent 198µs making 1 call to Hash::Merge::Simple::merge
76 |  |  | 1 | 407µ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 {
80 | 3 | 11µs |  |  | my ($Config) = @_;
81 |  |  |  |  |
82 |  |  | 2 | 397µ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 |  |  |  |  | }
85 |  |  |  |  | return $Config;
86 |  |  |  |  | }
87 |  |  |  |  |
88 | 5 | 36µ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 |  |  |  |  |
92 | 1 | 41µs | 2 | 4.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 |  |  |  |  |
94 | 1 | 4µs |  |  | 1;
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