← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/hailo
  Run on Thu Oct 21 22:50:37 2010
Reported on Thu Oct 21 22:52:06 2010

Filename/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/Dir/Self.pm
StatementsExecuted 21 statements in 997µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.90ms2.12msDir::Self::::BEGIN@6Dir::Self::BEGIN@6
11130µs3.78msDir::Self::::__DIR__Dir::Self::__DIR__
11128µs28µsDir::Self::::BEGIN@3Dir::Self::BEGIN@3
11120µs20µsDir::Self::::importDir::Self::import
11112µs38µsDir::Self::::BEGIN@36Dir::Self::BEGIN@36
11112µs18µsDir::Self::::BEGIN@4Dir::Self::BEGIN@4
11111µs33µsDir::Self::::BEGIN@39Dir::Self::BEGIN@39
0000s0sDir::Self::::__ANON__[:25]Dir::Self::__ANON__[:25]
0000s0sDir::Self::::_constDir::Self::_const
0000s0sDir::Self::::_croakDir::Self::_croak
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1157µs362µspackage Dir::Self;
# spent 54µs making 1 call to Encode::utf8::decode_xs # spent 4µs making 1 call to Encode::Encoding::renewed # spent 3µs making 1 call to Encode::utf8::encode_xs
2
3286µs357µs
# spent 28µs within Dir::Self::BEGIN@3 which was called: # once (28µs+0s) by hailo::BEGIN@5 at line 3
use 5.005;
# spent 28µs making 1 call to Dir::Self::BEGIN@3 # spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
4226µs326µs
# spent 18µs (12+6) within Dir::Self::BEGIN@4 which was called: # once (12µs+6µs) by hailo::BEGIN@5 at line 4
use strict;
# spent 18µs making 1 call to Dir::Self::BEGIN@4 # spent 6µs making 1 call to strict::import # spent 2µs making 1 call to Encode::utf8::encode_xs
5
62215µs42.16ms
# spent 2.12ms (1.90+228µs) within Dir::Self::BEGIN@6 which was called: # once (1.90ms+228µs) by hailo::BEGIN@5 at line 6
use File::Spec ();
# spent 2.12ms making 1 call to Dir::Self::BEGIN@6 # spent 26µs making 1 call to Encode::utf8::decode_xs # spent 9µs making 1 call to Encode::utf8::encode_xs # spent 4µs making 1 call to Encode::Encoding::renewed
7
8150µs339µs*VERSION = \'0.10';
# spent 31µs making 1 call to Encode::utf8::decode_xs # spent 6µs making 1 call to Encode::Encoding::renewed # spent 2µs making 1 call to Encode::utf8::encode_xs
9
10171µs229µssub _croak {
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
11 require Carp;
12 local $^W = 0;
13 *_croak = \&Carp::croak;
14 goto &Carp::croak;
1513µs}
# spent 3µs making 1 call to Encode::utf8::encode_xs
16
17181µs230µs
# spent 3.78ms (30µs+3.75) within Dir::Self::__DIR__ which was called: # once (30µs+3.75ms) by main::RUNTIME at line 29 of bin/hailo
sub __DIR__ () {
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 4µs making 1 call to Encode::Encoding::renewed
18328µs my $level = shift || 0;
19 my $file = (caller $level)[1];
2023.75ms File::Spec->rel2abs(join '', (File::Spec->splitpath($file))[0, 1])
# spent 3.72ms making 1 call to File::Spec::Unix::rel2abs # spent 30µs making 1 call to File::Spec::Unix::splitpath
2112µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
22
23167µs230µssub _const {
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
24 my $value = shift;
25 sub () { $value }
2612µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
27
28146µs231µs
# spent 20µs within Dir::Self::import which was called: # once (20µs+0s) by hailo::BEGIN@5 at line 5 of bin/hailo
sub import {
# spent 28µs making 1 call to Encode::utf8::decode_xs # spent 4µs making 1 call to Encode::Encoding::renewed
29413µs my $class = shift;
3012µs my $caller = caller;
# spent 2µs making 1 call to Encode::utf8::encode_xs
31
32143µs332µs @_ or @_ = '__DIR__';
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed # spent 2µs making 1 call to Encode::utf8::encode_xs
33
34147µs230µs for my $item (@_) {
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
3529µs if ($item eq '__DIR__') {
36244µs264µs
# spent 38µs (12+26) within Dir::Self::BEGIN@36 which was called: # once (12µs+26µs) by hailo::BEGIN@5 at line 36
no strict 'refs';
# spent 38µs making 1 call to Dir::Self::BEGIN@36 # spent 26µs making 1 call to strict::unimport
37 *{$caller . '::__DIR__'} = \&__DIR__;
38 } elsif ($item eq ':static') {
39274µs255µs
# spent 33µs (11+22) within Dir::Self::BEGIN@39 which was called: # once (11µs+22µs) by hailo::BEGIN@5 at line 39
no strict 'refs';
# spent 33µs making 1 call to Dir::Self::BEGIN@39 # spent 22µs making 1 call to strict::unimport
40 *{$caller . '::__DIR__'} = _const &__DIR__(1);
41 } else {
42 _croak qq{"$item" is not exported by the $class module};
43 }
44 }
4512µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
46
47142µs230µs1
# spent 27µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
48__END__
49
50=head1 NAME
51
52Dir::Self - a __DIR__ constant for the directory your source file is in
53
54=head1 SYNOPSIS
55
56 use Dir::Self;
57
58 use lib __DIR__ . "/lib";
59
60 my $conffile = __DIR__ . "/config";
61
62=head1 DESCRIPTION
63
64Perl has two pseudo-constants describing the current location in your source
65code, C<__FILE__> and C<__LINE__>. This module adds C<__DIR__>, which expands
66to the directory your source file is in, as an absolute pathname.
67
68This is useful if your code wants to access files in the same directory, like
69helper modules or configuration data. This is a bit like L<FindBin> except
70it's not limited to the main program, i.e. you can also use it in modules. And
71it actually works.
72
73As of version 0.10 each use of C<__DIR__> recomputes the directory name; this
74ensures that files in different directories that share the same package name
75get correct results. If you don't want this, C<use Dir::Self qw(:static)> will
76create a true C<__DIR__> constant in your package that contains the directory
77name at the point of C<use>.
78
79=head1 AUTHOR
80
81Lukas Mai E<lt>l.mai @web.deE<gt>
82
83=head1 COPYRIGHT AND LICENSE
84
85Copyright (C) 2007, 2008 by Lukas Mai
86
87This library is free software; you can redistribute it and/or modify
88it under the same terms as Perl itself, either Perl version 5.8.8 or,
89at your option, any later version of Perl 5 you may have available.
90
91=cut