← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:14 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/5.18.0/darwin-thread-multi-2level/Time/HiRes.pm
StatementsExecuted 26 statements in 554µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11140µs40µsTime::HiRes::::bootstrapTime::HiRes::bootstrap (xsub)
44122µs22µsTime::HiRes::::timeTime::HiRes::time (xsub)
22218µs1.50msTime::HiRes::::importTime::HiRes::import
11113µs13µsTime::HiRes::::BEGIN@3Time::HiRes::BEGIN@3
1116µs14µsTime::HiRes::::BEGIN@43Time::HiRes::BEGIN@43
1116µs16µsTime::HiRes::::BEGIN@4Time::HiRes::BEGIN@4
0000s0sTime::HiRes::::AUTOLOADTime::HiRes::AUTOLOAD
0000s0sTime::HiRes::::__ANON__[:44]Time::HiRes::__ANON__[:44]
0000s0sTime::HiRes::::tv_intervalTime::HiRes::tv_interval
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Time::HiRes;
2
3339µs113µs
# spent 13µs within Time::HiRes::BEGIN@3 which was called: # once (13µs+0s) by main::BEGIN@3 at line 3
{ use 5.006; }
# spent 13µs making 1 call to Time::HiRes::BEGIN@3
42167µs226µs
# spent 16µs (6+10) within Time::HiRes::BEGIN@4 which was called: # once (6µs+10µs) by main::BEGIN@3 at line 4
use strict;
# spent 16µs making 1 call to Time::HiRes::BEGIN@4 # spent 10µs making 1 call to strict::import
5
61300nsrequire Exporter;
7176µsrequire DynaLoader;
8
916µsour @ISA = qw(Exporter DynaLoader);
10
111100nsour @EXPORT = qw( );
1216µsour @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval
13 getitimer setitimer nanosleep clock_gettime clock_getres
14 clock clock_nanosleep
15 CLOCK_HIGHRES CLOCK_MONOTONIC CLOCK_PROCESS_CPUTIME_ID
16 CLOCK_REALTIME CLOCK_SOFTTIME CLOCK_THREAD_CPUTIME_ID
17 CLOCK_TIMEOFDAY CLOCKS_PER_SEC
18 ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF
19 TIMER_ABSTIME
20 d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer
21 d_nanosleep d_clock_gettime d_clock_getres
22 d_clock d_clock_nanosleep
23 stat
24 );
25
261200nsour $VERSION = '1.9725';
271100nsour $XS_VERSION = $VERSION;
28116µs$VERSION = eval $VERSION;
# spent 2µs executing statements in string eval
29
3010sour $AUTOLOAD;
31sub AUTOLOAD {
32 my $constname;
33 ($constname = $AUTOLOAD) =~ s/.*:://;
34 # print "AUTOLOAD: constname = $constname ($AUTOLOAD)\n";
35 die "&Time::HiRes::constant not defined" if $constname eq 'constant';
36 my ($error, $val) = constant($constname);
37 # print "AUTOLOAD: error = $error, val = $val\n";
38 if ($error) {
39 my (undef,$file,$line) = caller;
40 die "$error at $file line $line.\n";
41 }
42 {
432217µs222µs
# spent 14µs (6+8) within Time::HiRes::BEGIN@43 which was called: # once (6µs+8µs) by main::BEGIN@3 at line 43
no strict 'refs';
# spent 14µs making 1 call to Time::HiRes::BEGIN@43 # spent 8µs making 1 call to strict::unimport
44 *$AUTOLOAD = sub { $val };
45 }
46 goto &$AUTOLOAD;
47}
48
49
# spent 1.50ms (18µs+1.48) within Time::HiRes::import which was called 2 times, avg 748µs/call: # once (12µs+1.43ms) by main::BEGIN@3 at line 3 of examples/Atom-timer.pl # once (6µs+52µs) by Benchmark::BEGIN@453 at line 455 of Benchmark.pm
sub import {
502700ns my $this = shift;
5121µs for my $i (@_) {
5222µs if (($i eq 'clock_getres' && !&d_clock_getres) ||
53 ($i eq 'clock_gettime' && !&d_clock_gettime) ||
54 ($i eq 'clock_nanosleep' && !&d_clock_nanosleep) ||
55 ($i eq 'clock' && !&d_clock) ||
56 ($i eq 'nanosleep' && !&d_nanosleep) ||
57 ($i eq 'usleep' && !&d_usleep) ||
58 ($i eq 'ualarm' && !&d_ualarm)) {
59 require Carp;
60 Carp::croak("Time::HiRes::$i(): unimplemented in this platform");
61 }
62 }
6328µs21.33ms Time::HiRes->export_to_level(1, $this, @_);
# spent 1.33ms making 2 calls to Exporter::export_to_level, avg 663µs/call
64}
65
6615µs1231µsbootstrap Time::HiRes;
# spent 231µs making 1 call to DynaLoader::bootstrap
67
68# Preloaded methods go here.
69
70sub tv_interval {
71 # probably could have been done in C
72 my ($a, $b) = @_;
73 $b = [gettimeofday()] unless defined($b);
74 (${$b}[0] - ${$a}[0]) + ((${$b}[1] - ${$a}[1]) / 1_000_000);
75}
76
77# Autoload methods go after =cut, and are processed by the autosplit program.
78
7919µs1;
80__END__
 
# spent 40µs within Time::HiRes::bootstrap which was called: # once (40µs+0s) by DynaLoader::bootstrap at line 217 of DynaLoader.pm
sub Time::HiRes::bootstrap; # xsub
# spent 22µs within Time::HiRes::time which was called 4 times, avg 6µs/call: # once (10µs+0s) by main::RUNTIME at line 10 of examples/Atom-timer.pl # once (9µs+0s) by main::RUNTIME at line 15 of examples/Atom-timer.pl # once (2µs+0s) by main::RUNTIME at line 19 of examples/Atom-timer.pl # once (2µs+0s) by main::RUNTIME at line 23 of examples/Atom-timer.pl
sub Time::HiRes::time; # xsub