Profile of Tie/Hash.pm

← Index
NYTProf Performance Profile «line view»
For script/ponapi
Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:09 2016

Filename | /usr/share/perl/5.18/Tie/Hash.pm
Statements | Executed 7 statements in 498µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 10µs | 35µs | Tie::Hash::::BEGIN@5 Tie::Hash::BEGIN@5
1 | 1 | 1 | 6µs | 81µs | Tie::Hash::::BEGIN@6 Tie::Hash::BEGIN@6
1 | 1 | 1 | 4µs | 4µs | Tie::StdHash::::TIEHASH Tie::StdHash::TIEHASH
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::CLEARTie::ExtraHash::CLEAR
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::DELETETie::ExtraHash::DELETE
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::EXISTSTie::ExtraHash::EXISTS
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::FETCHTie::ExtraHash::FETCH
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::FIRSTKEYTie::ExtraHash::FIRSTKEY
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::NEXTKEYTie::ExtraHash::NEXTKEY
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::SCALARTie::ExtraHash::SCALAR
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::STORETie::ExtraHash::STORE
0 | 0 | 0 | 0s | 0s | Tie::ExtraHash::::TIEHASHTie::ExtraHash::TIEHASH
0 | 0 | 0 | 0s | 0s | Tie::Hash::::CLEAR Tie::Hash::CLEAR
0 | 0 | 0 | 0s | 0s | Tie::Hash::::EXISTS Tie::Hash::EXISTS
0 | 0 | 0 | 0s | 0s | Tie::Hash::::TIEHASH Tie::Hash::TIEHASH
0 | 0 | 0 | 0s | 0s | Tie::Hash::::new Tie::Hash::new
0 | 0 | 0 | 0s | 0s | Tie::StdHash::::CLEAR Tie::StdHash::CLEAR
0 | 0 | 0 | 0s | 0s | Tie::StdHash::::DELETE Tie::StdHash::DELETE
0 | 0 | 0 | 0s | 0s | Tie::StdHash::::EXISTS Tie::StdHash::EXISTS
0 | 0 | 0 | 0s | 0s | Tie::StdHash::::FETCH Tie::StdHash::FETCH
0 | 0 | 0 | 0s | 0s | Tie::StdHash::::FIRSTKEY Tie::StdHash::FIRSTKEY
0 | 0 | 0 | 0s | 0s | Tie::StdHash::::NEXTKEY Tie::StdHash::NEXTKEY
0 | 0 | 0 | 0s | 0s | Tie::StdHash::::SCALAR Tie::StdHash::SCALAR
0 | 0 | 0 | 0s | 0s | Tie::StdHash::::STORE Tie::StdHash::STORE

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Tie::Hash;
2 |  |  |  |  |
3 | 1 | 400ns |  |  | our $VERSION = '1.04';
4 |  |  |  |  |
5 | 2 | 20µs | 2 | 61µs | # spent 35µs (10+26) within Tie::Hash::BEGIN@5 which was called: # once (10µs+26µs) by IO::Dir::BEGIN@17 at line 5 use Carp; # spent 35µs making 1 call to Tie::Hash::BEGIN@5 # spent 26µs making 1 call to Exporter::import
6 | 2 | 469µs | 2 | 156µs | # spent 81µs (6+75) within Tie::Hash::BEGIN@6 which was called: # once (6µs+75µs) by IO::Dir::BEGIN@17 at line 6 use warnings::register; # spent 81µs making 1 call to Tie::Hash::BEGIN@6 # spent 75µs making 1 call to warnings::register::import
7 |  |  |  |  |
8 |  |  |  |  | sub new {
9 |  |  |  |  | my $pkg = shift;
10 |  |  |  |  | $pkg->TIEHASH(@_);
11 |  |  |  |  | }
12 |  |  |  |  |
13 |  |  |  |  | # Grandfather "new"
14 |  |  |  |  |
15 |  |  |  |  | sub TIEHASH {
16 |  |  |  |  | my $pkg = shift;
17 |  |  |  |  | my $pkg_new = $pkg -> can ('new');
18 |  |  |  |  |
19 |  |  |  |  | if ($pkg_new and $pkg ne __PACKAGE__) {
20 |  |  |  |  | my $my_new = __PACKAGE__ -> can ('new');
21 |  |  |  |  | if ($pkg_new == $my_new) {
22 |  |  |  |  | #
23 |  |  |  |  | # Prevent recursion
24 |  |  |  |  | #
25 |  |  |  |  | croak "$pkg must define either a TIEHASH() or a new() method";
26 |  |  |  |  | }
27 |  |  |  |  |
28 |  |  |  |  | warnings::warnif ("WARNING: calling ${pkg}->new since " .
29 |  |  |  |  | "${pkg}->TIEHASH is missing");
30 |  |  |  |  | $pkg -> new (@_);
31 |  |  |  |  | }
32 |  |  |  |  | else {
33 |  |  |  |  | croak "$pkg doesn't define a TIEHASH method";
34 |  |  |  |  | }
35 |  |  |  |  | }
36 |  |  |  |  |
37 |  |  |  |  | sub EXISTS {
38 |  |  |  |  | my $pkg = ref $_[0];
39 |  |  |  |  | croak "$pkg doesn't define an EXISTS method";
40 |  |  |  |  | }
41 |  |  |  |  |
42 |  |  |  |  | sub CLEAR {
43 |  |  |  |  | my $self = shift;
44 |  |  |  |  | my $key = $self->FIRSTKEY(@_);
45 |  |  |  |  | my @keys;
46 |  |  |  |  |
47 |  |  |  |  | while (defined $key) {
48 |  |  |  |  | push @keys, $key;
49 |  |  |  |  | $key = $self->NEXTKEY(@_, $key);
50 |  |  |  |  | }
51 |  |  |  |  | foreach $key (@keys) {
52 |  |  |  |  | $self->DELETE(@_, $key);
53 |  |  |  |  | }
54 |  |  |  |  | }
55 |  |  |  |  |
56 |  |  |  |  | # The Tie::StdHash package implements standard perl hash behaviour.
57 |  |  |  |  | # It exists to act as a base class for classes which only wish to
58 |  |  |  |  | # alter some parts of their behaviour.
59 |  |  |  |  |
60 |  |  |  |  | package Tie::StdHash;
61 |  |  |  |  | # @ISA = qw(Tie::Hash); # would inherit new() only
62 |  |  |  |  |
63 | 1 | 7µs |  |  | # spent 4µs within Tie::StdHash::TIEHASH which was called: # once (4µs+0s) by PONAPI::Server::BEGIN@34 at line 477 of POSIX.pm sub TIEHASH { bless {}, $_[0] }
64 |  |  |  |  | sub STORE { $_[0]->{$_[1]} = $_[2] }
65 |  |  |  |  | sub FETCH { $_[0]->{$_[1]} }
66 |  |  |  |  | sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} }
67 |  |  |  |  | sub NEXTKEY { each %{$_[0]} }
68 |  |  |  |  | sub EXISTS { exists $_[0]->{$_[1]} }
69 |  |  |  |  | sub DELETE { delete $_[0]->{$_[1]} }
70 |  |  |  |  | sub CLEAR { %{$_[0]} = () }
71 |  |  |  |  | sub SCALAR { scalar %{$_[0]} }
72 |  |  |  |  |
73 |  |  |  |  | package Tie::ExtraHash;
74 |  |  |  |  |
75 |  |  |  |  | sub TIEHASH { my $p = shift; bless [{}, @_], $p }
76 |  |  |  |  | sub STORE { $_[0][0]{$_[1]} = $_[2] }
77 |  |  |  |  | sub FETCH { $_[0][0]{$_[1]} }
78 |  |  |  |  | sub FIRSTKEY { my $a = scalar keys %{$_[0][0]}; each %{$_[0][0]} }
79 |  |  |  |  | sub NEXTKEY { each %{$_[0][0]} }
80 |  |  |  |  | sub EXISTS { exists $_[0][0]->{$_[1]} }
81 |  |  |  |  | sub DELETE { delete $_[0][0]->{$_[1]} }
82 |  |  |  |  | sub CLEAR { %{$_[0][0]} = () }
83 |  |  |  |  | sub SCALAR { scalar %{$_[0][0]} }
84 |  |  |  |  |
85 | 1 | 2µs |  |  | 1;