← Index
NYTProf Performance Profile   « line view »
For bin/benchmark-perlformance
  Run on Fri Apr 17 15:31:48 2015
Reported on Fri Apr 17 15:32:03 2015

Filename/home/ss5/perl5/perlbrew/perls/tapper-perl/lib/site_perl/5.16.3/Sys/Info.pm
StatementsExecuted 33 statements in 696µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111630µs1.38msSys::Info::::BEGIN@6Sys::Info::BEGIN@6
11110µs21µsSys::Info::::BEGIN@2Sys::Info::BEGIN@2
11110µs2.37msSys::Info::::BEGIN@7Sys::Info::BEGIN@7
21110µs10µsSys::Info::::_mk_objectSys::Info::_mk_object
1119µs13µsSys::Info::::BEGIN@3Sys::Info::BEGIN@3
1119µs18µsSys::Info::::BEGIN@77Sys::Info::BEGIN@77
1117µs17µsSys::Info::::BEGIN@18Sys::Info::BEGIN@18
1117µs26µsSys::Info::::BEGIN@5Sys::Info::BEGIN@5
1116µs34µsSys::Info::::BEGIN@4Sys::Info::BEGIN@4
1115µs5µsSys::Info::::importSys::Info::import
0000s0sSys::Info::::__ANON__[:80]Sys::Info::__ANON__[:80]
0000s0sSys::Info::::_legacy_perlSys::Info::_legacy_perl
0000s0sSys::Info::::httpdSys::Info::httpd
0000s0sSys::Info::::newSys::Info::new
0000s0sSys::Info::::perlSys::Info::perl
0000s0sSys::Info::::perl_buildSys::Info::perl_build
0000s0sSys::Info::::perl_longSys::Info::perl_long
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Sys::Info;
2218µs231µs
# spent 21µs (10+10) within Sys::Info::BEGIN@2 which was called: # once (10µs+10µs) by Benchmark::Perl::Formance::BEGIN@21 at line 2
use strict;
# spent 21µs making 1 call to Sys::Info::BEGIN@2 # spent 10µs making 1 call to strict::import
3219µs217µs
# spent 13µs (9+4) within Sys::Info::BEGIN@3 which was called: # once (9µs+4µs) by Benchmark::Perl::Formance::BEGIN@21 at line 3
use warnings;
# spent 13µs making 1 call to Sys::Info::BEGIN@3 # spent 4µs making 1 call to warnings::import
4219µs261µs
# spent 34µs (6+27) within Sys::Info::BEGIN@4 which was called: # once (6µs+27µs) by Benchmark::Perl::Formance::BEGIN@21 at line 4
use vars qw( $VERSION @EXPORT_OK );
# spent 34µs making 1 call to Sys::Info::BEGIN@4 # spent 28µs making 1 call to vars::import
5219µs245µs
# spent 26µs (7+19) within Sys::Info::BEGIN@5 which was called: # once (7µs+19µs) by Benchmark::Perl::Formance::BEGIN@21 at line 5
use Carp qw( croak );
# spent 26µs making 1 call to Sys::Info::BEGIN@5 # spent 19µs making 1 call to Exporter::import
62109µs21.43ms
# spent 1.38ms (630µs+745µs) within Sys::Info::BEGIN@6 which was called: # once (630µs+745µs) by Benchmark::Perl::Formance::BEGIN@21 at line 6
use Sys::Info::Constants qw( OSID );
# spent 1.38ms making 1 call to Sys::Info::BEGIN@6 # spent 52µs making 1 call to Exporter::import
7263µs24.74ms
# spent 2.37ms (10µs+2.36) within Sys::Info::BEGIN@7 which was called: # once (10µs+2.36ms) by Benchmark::Perl::Formance::BEGIN@21 at line 7
use base qw( Sys::Info::Base );
# spent 2.37ms making 1 call to Sys::Info::BEGIN@7 # spent 2.36ms making 1 call to base::import
8
91500ns$VERSION = '0.78';
101600ns@EXPORT_OK = qw( OSID );
11
1216µs210µs__PACKAGE__->_mk_object( $_ ) for qw( OS Device );
# spent 10µs making 2 calls to Sys::Info::_mk_object, avg 5µs/call
13
14
# spent 5µs within Sys::Info::import which was called: # once (5µs+0s) by Benchmark::Perl::Formance::BEGIN@21 at line 21 of lib/Benchmark/Perl/Formance.pm
sub import {
151700ns my($class, @names) = @_;
161400ns my $caller = caller;
1712µs my %cache = map { $_ => 1 } @EXPORT_OK;
182311µs227µs
# spent 17µs (7+10) within Sys::Info::BEGIN@18 which was called: # once (7µs+10µs) by Benchmark::Perl::Formance::BEGIN@21 at line 18
no strict qw( refs );
# spent 17µs making 1 call to Sys::Info::BEGIN@18 # spent 10µs making 1 call to strict::unimport
191700ns foreach my $name ( @names ) {
20 croak "Bogus import: $name" if not $class->can($name);
21 croak "Caller already has the $name method" if $caller->can($name);
22 croak "Access denied for $name" if not exists $cache{$name};
23 *{ $caller . q{::} . $name } = *{ $class . q{::} . $name };
24 }
2514µs return;
26}
27
28sub new {
29 my $class = shift;
30 my $self = {};
31 bless $self, $class;
32 return $self;
33}
34
35sub perl { return defined $^V ? sprintf( '%vd', $^V ) : _legacy_perl( $] ) }
36
37sub perl_build {
38 return 0 if OSID ne 'Windows';
39 require Win32 if $] >= 5.006;
40 return 0 if not defined &Win32::BuildNumber;
41 return Win32::BuildNumber();
42}
43
44sub perl_long { return join q{.}, perl(), perl_build() }
45
46sub httpd {
47 my $self = shift;
48 my $server = $ENV{SERVER_SOFTWARE} || return;
49
50 if ( $server =~ m{\A Microsoft\-IIS/ (.+?) \z}xms ) {
51 return 'Microsoft Internet Information Server ' . $1;
52 }
53
54 if ( $server =~ m{\A (Apache)/(.+?) \z}xmsi ) {
55 my $apache = $1;
56 my @data = split /\s+/xms, $2;
57 my $v = shift @data;
58 my @mods;
59 my($mn, $mv);
60 foreach my $e (@data) {
61 next if $e =~ m{ \A \( .+? \) \z}xms;
62 ($mn,$mv) = split m{/}xms, $e;
63 $mn =~ s{ \-(.+?) \z }{}xms;
64 push @mods, $mn .'(' . $mv . ')';
65 }
66 return "$apache $v. Modules: " . join q{ }, @mods;
67 }
68
69 return $server;
70}
71
72# ------------------------[ P R I V A T E ]------------------------ #
73
74
# spent 10µs within Sys::Info::_mk_object which was called 2 times, avg 5µs/call: # 2 times (10µs+0s) by Benchmark::Perl::Formance::BEGIN@21 at line 12, avg 5µs/call
sub _mk_object {
752600ns my $self = shift;
762500ns my $name = shift || croak '_mk_object() needs a name';
772107µs227µs
# spent 18µs (9+9) within Sys::Info::BEGIN@77 which was called: # once (9µs+9µs) by Benchmark::Perl::Formance::BEGIN@21 at line 77
no strict qw(refs);
# spent 18µs making 1 call to Sys::Info::BEGIN@77 # spent 9µs making 1 call to strict::unimport
78 *{ lc $name } = sub {
79 shift->load_module( 'Sys::Info::' . $name )->new( @_ );
8026µs };
8126µs return;
82}
83
84sub _legacy_perl { # function
85 my $v = shift or return;
86 my($rev, $patch_sub) = split m{[.]}xms, $v;
87 $patch_sub =~ s{[0_]}{}xmsg;
88 my @v = split m{}xms, $patch_sub;
89 return sprintf '%d.%d.%d', $rev, $v[0], $v[1] || '0';
90}
91
9214µs1;
93
94__END__