line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Time::HiRes; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
366046
|
{ use 5.006; } |
|
12
|
|
|
|
|
263
|
|
4
|
12
|
|
|
12
|
|
91
|
use strict; |
|
12
|
|
|
|
|
39
|
|
|
12
|
|
|
|
|
493
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
12
|
|
|
12
|
|
102
|
use XSLoader (); |
|
12
|
|
|
|
|
35
|
|
|
12
|
|
|
|
|
3648
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT = qw( ); |
12
|
|
|
|
|
|
|
# More or less this same list is in Makefile.PL. Should unify. |
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval |
14
|
|
|
|
|
|
|
getitimer setitimer nanosleep clock_gettime clock_getres |
15
|
|
|
|
|
|
|
clock clock_nanosleep |
16
|
|
|
|
|
|
|
CLOCKS_PER_SEC |
17
|
|
|
|
|
|
|
CLOCK_BOOTTIME |
18
|
|
|
|
|
|
|
CLOCK_HIGHRES |
19
|
|
|
|
|
|
|
CLOCK_MONOTONIC |
20
|
|
|
|
|
|
|
CLOCK_MONOTONIC_COARSE |
21
|
|
|
|
|
|
|
CLOCK_MONOTONIC_FAST |
22
|
|
|
|
|
|
|
CLOCK_MONOTONIC_PRECISE |
23
|
|
|
|
|
|
|
CLOCK_MONOTONIC_RAW |
24
|
|
|
|
|
|
|
CLOCK_PROCESS_CPUTIME_ID |
25
|
|
|
|
|
|
|
CLOCK_PROF |
26
|
|
|
|
|
|
|
CLOCK_REALTIME |
27
|
|
|
|
|
|
|
CLOCK_REALTIME_COARSE |
28
|
|
|
|
|
|
|
CLOCK_REALTIME_FAST |
29
|
|
|
|
|
|
|
CLOCK_REALTIME_PRECISE |
30
|
|
|
|
|
|
|
CLOCK_REALTIME_RAW |
31
|
|
|
|
|
|
|
CLOCK_SECOND |
32
|
|
|
|
|
|
|
CLOCK_SOFTTIME |
33
|
|
|
|
|
|
|
CLOCK_THREAD_CPUTIME_ID |
34
|
|
|
|
|
|
|
CLOCK_TIMEOFDAY |
35
|
|
|
|
|
|
|
CLOCK_UPTIME |
36
|
|
|
|
|
|
|
CLOCK_UPTIME_COARSE |
37
|
|
|
|
|
|
|
CLOCK_UPTIME_FAST |
38
|
|
|
|
|
|
|
CLOCK_UPTIME_PRECISE |
39
|
|
|
|
|
|
|
CLOCK_UPTIME_RAW |
40
|
|
|
|
|
|
|
CLOCK_VIRTUAL |
41
|
|
|
|
|
|
|
ITIMER_PROF |
42
|
|
|
|
|
|
|
ITIMER_REAL |
43
|
|
|
|
|
|
|
ITIMER_REALPROF |
44
|
|
|
|
|
|
|
ITIMER_VIRTUAL |
45
|
|
|
|
|
|
|
TIMER_ABSTIME |
46
|
|
|
|
|
|
|
d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer |
47
|
|
|
|
|
|
|
d_nanosleep d_clock_gettime d_clock_getres |
48
|
|
|
|
|
|
|
d_clock d_clock_nanosleep d_hires_stat |
49
|
|
|
|
|
|
|
d_futimens d_utimensat d_hires_utime |
50
|
|
|
|
|
|
|
stat lstat utime |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
our $VERSION = '1.9764_02'; |
54
|
|
|
|
|
|
|
our $XS_VERSION = $VERSION; |
55
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
our $AUTOLOAD; |
58
|
|
|
|
|
|
|
sub AUTOLOAD { |
59
|
20
|
|
|
20
|
|
135367
|
my $constname; |
60
|
20
|
|
|
|
|
139
|
($constname = $AUTOLOAD) =~ s/.*:://; |
61
|
|
|
|
|
|
|
# print "AUTOLOAD: constname = $constname ($AUTOLOAD)\n"; |
62
|
20
|
50
|
|
|
|
84
|
die "&Time::HiRes::constant not defined" if $constname eq 'constant'; |
63
|
20
|
|
|
|
|
111
|
my ($error, $val) = constant($constname); |
64
|
|
|
|
|
|
|
# print "AUTOLOAD: error = $error, val = $val\n"; |
65
|
20
|
50
|
|
|
|
70
|
if ($error) { |
66
|
0
|
|
|
|
|
0
|
my (undef,$file,$line) = caller; |
67
|
0
|
|
|
|
|
0
|
die "$error at $file line $line.\n"; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
{ |
70
|
12
|
|
|
12
|
|
99
|
no strict 'refs'; |
|
12
|
|
|
|
|
37
|
|
|
12
|
|
|
|
|
4853
|
|
|
20
|
|
|
|
|
40
|
|
71
|
20
|
|
|
2081
|
|
142
|
*$AUTOLOAD = sub { $val }; |
|
2081
|
|
|
|
|
5210592
|
|
72
|
|
|
|
|
|
|
} |
73
|
20
|
|
|
|
|
101
|
goto &$AUTOLOAD; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub import { |
77
|
4
|
|
|
4
|
|
483
|
my $this = shift; |
78
|
4
|
|
|
|
|
15
|
for my $i (@_) { |
79
|
4
|
50
|
33
|
|
|
191
|
if (($i eq 'clock_getres' && !&d_clock_getres) || |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
80
|
|
|
|
|
|
|
($i eq 'clock_gettime' && !&d_clock_gettime) || |
81
|
|
|
|
|
|
|
($i eq 'clock_nanosleep' && !&d_clock_nanosleep) || |
82
|
|
|
|
|
|
|
($i eq 'clock' && !&d_clock) || |
83
|
|
|
|
|
|
|
($i eq 'nanosleep' && !&d_nanosleep) || |
84
|
|
|
|
|
|
|
($i eq 'usleep' && !&d_usleep) || |
85
|
|
|
|
|
|
|
($i eq 'utime' && !&d_hires_utime) || |
86
|
|
|
|
|
|
|
($i eq 'ualarm' && !&d_ualarm)) { |
87
|
0
|
|
|
|
|
0
|
require Carp; |
88
|
0
|
|
|
|
|
0
|
Carp::croak("Time::HiRes::$i(): unimplemented in this platform"); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
4
|
|
|
|
|
639
|
Time::HiRes->export_to_level(1, $this, @_); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
XSLoader::load( 'Time::HiRes', $XS_VERSION ); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# Preloaded methods go here. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub tv_interval { |
99
|
|
|
|
|
|
|
# probably could have been done in C |
100
|
18
|
|
|
18
|
1
|
3516387
|
my ($a, $b) = @_; |
101
|
18
|
100
|
|
|
|
248
|
$b = [gettimeofday()] unless defined($b); |
102
|
18
|
|
|
|
|
66
|
(${$b}[0] - ${$a}[0]) + ((${$b}[1] - ${$a}[1]) / 1_000_000); |
|
18
|
|
|
|
|
88
|
|
|
18
|
|
|
|
|
169
|
|
|
18
|
|
|
|
|
55
|
|
|
18
|
|
|
|
|
1160
|
|
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
__END__ |