Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/BenchmarkAnything/Config.pm |
Statements | Executed 29 statements in 359µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.48ms | 37.9ms | _read_config | BenchmarkAnything::Config::
1 | 1 | 1 | 16µs | 16µs | BEGIN@1 | BenchmarkAnything::Storage::Frontend::Lib::
1 | 1 | 1 | 13µs | 13µs | CORE:open (opcode) | BenchmarkAnything::Config::
1 | 1 | 1 | 7µs | 9µs | BEGIN@2 | BenchmarkAnything::Storage::Frontend::Lib::
1 | 1 | 1 | 6µs | 37.9ms | new | BenchmarkAnything::Config::
1 | 1 | 1 | 6µs | 6µs | CORE:readline (opcode) | BenchmarkAnything::Config::
1 | 1 | 1 | 5µs | 13µs | BEGIN@3 | BenchmarkAnything::Storage::Frontend::Lib::
1 | 1 | 1 | 3µs | 3µs | BEGIN@5 | BenchmarkAnything::Config::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 2 | 40µs | 1 | 16µs | # spent 16µs within BenchmarkAnything::Storage::Frontend::Lib::BEGIN@1 which was called:
# once (16µs+0s) by BenchmarkAnything::Storage::Frontend::Lib::new at line 1 # spent 16µs making 1 call to BenchmarkAnything::Storage::Frontend::Lib::BEGIN@1 |
2 | 2 | 14µs | 2 | 12µs | # spent 9µs (7+3) within BenchmarkAnything::Storage::Frontend::Lib::BEGIN@2 which was called:
# once (7µs+3µs) by BenchmarkAnything::Storage::Frontend::Lib::new at line 2 # spent 9µs making 1 call to BenchmarkAnything::Storage::Frontend::Lib::BEGIN@2
# spent 3µs making 1 call to strict::import |
3 | 2 | 23µs | 2 | 20µs | # spent 13µs (5+8) within BenchmarkAnything::Storage::Frontend::Lib::BEGIN@3 which was called:
# once (5µs+8µs) by BenchmarkAnything::Storage::Frontend::Lib::new at line 3 # spent 13µs making 1 call to BenchmarkAnything::Storage::Frontend::Lib::BEGIN@3
# spent 8µs making 1 call to warnings::import |
4 | package BenchmarkAnything::Config; | ||||
5 | # spent 3µs within BenchmarkAnything::Config::BEGIN@5 which was called:
# once (3µs+0s) by BenchmarkAnything::Storage::Frontend::Lib::new at line 7 | ||||
6 | 1 | 3µs | $BenchmarkAnything::Config::AUTHORITY = 'cpan:SCHWIGON'; | ||
7 | 1 | 120µs | 1 | 3µs | } # spent 3µs making 1 call to BenchmarkAnything::Config::BEGIN@5 |
8 | # ABSTRACT: Read BenchmarkAnything configfile | ||||
9 | 1 | 300ns | $BenchmarkAnything::Config::VERSION = '0.003'; | ||
10 | |||||
11 | sub new | ||||
12 | # spent 37.9ms (6µs+37.9) within BenchmarkAnything::Config::new which was called:
# once (6µs+37.9ms) by BenchmarkAnything::Storage::Frontend::Lib::new at line 18 of BenchmarkAnything/Storage/Frontend/Lib.pm | ||||
13 | 1 | 300ns | my $class = shift; | ||
14 | 1 | 1µs | my $self = bless { @_ }, $class; | ||
15 | 1 | 700ns | 1 | 37.9ms | $self->_read_config; # spent 37.9ms making 1 call to BenchmarkAnything::Config::_read_config |
16 | 1 | 3µs | return $self; | ||
17 | } | ||||
18 | |||||
19 | |||||
20 | sub _read_config | ||||
21 | # spent 37.9ms (1.48+36.4) within BenchmarkAnything::Config::_read_config which was called:
# once (1.48ms+36.4ms) by BenchmarkAnything::Config::new at line 15 | ||||
22 | 1 | 300ns | my ($self) = @_; | ||
23 | |||||
24 | 1 | 37µs | require File::HomeDir; | ||
25 | 1 | 43µs | require YAML::Any; | ||
26 | |||||
27 | # don't look into user's homedir if we are running tests | ||||
28 | 1 | 2µs | my $default_cfgfile = $ENV{HARNESS_ACTIVE} ? "t/benchmarkanything.cfg" : $ENV{BENCHMARKANYTHING_CONFIGFILE} || File::HomeDir->my_home . "/.benchmarkanything/default.cfg"; | ||
29 | |||||
30 | # read file | ||||
31 | 1 | 700ns | eval { | ||
32 | 1 | 8µs | $self->{cfgfile} = $self->{cfgfile} || $default_cfgfile; | ||
33 | 1 | 300ns | my $cfg_yaml; | ||
34 | 1 | 20µs | 1 | 13µs | open (my $CFG, "<", $self->{cfgfile}) or die "Can't read: ".$self->{cfgfile}."\n"; # spent 13µs making 1 call to BenchmarkAnything::Config::CORE:open |
35 | { | ||||
36 | 2 | 2µs | local $/; | ||
37 | 1 | 10µs | 1 | 6µs | $cfg_yaml = <$CFG>; # spent 6µs making 1 call to BenchmarkAnything::Config::CORE:readline |
38 | } | ||||
39 | 1 | 4µs | 1 | 32.1ms | my $config = YAML::Any::Load($cfg_yaml); # spent 32.1ms making 1 call to YAML::Any::Load |
40 | 1 | 18µs | $self->{benchmarkanything} = $config->{benchmarkanything}; | ||
41 | }; | ||||
42 | 1 | 300ns | if ($@) | ||
43 | { | ||||
44 | die "benchmarkanything: error loading configfile: $@\n"; | ||||
45 | } | ||||
46 | |||||
47 | # defaults | ||||
48 | 1 | 1µs | $self->{benchmarkanything}{backend} ||= 'local'; | ||
49 | |||||
50 | 1 | 4µs | return $self; | ||
51 | } | ||||
52 | |||||
53 | 1 | 2µs | 1; | ||
54 | |||||
55 | __END__ | ||||
# spent 13µs within BenchmarkAnything::Config::CORE:open which was called:
# once (13µs+0s) by BenchmarkAnything::Config::_read_config at line 34 | |||||
# spent 6µs within BenchmarkAnything::Config::CORE:readline which was called:
# once (6µs+0s) by BenchmarkAnything::Config::_read_config at line 37 |