| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Time::HiRes; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 12 |  |  | 12 |  | 351072 | { use 5.006; } | 
|  | 12 |  |  |  |  | 236 |  | 
| 4 | 12 |  |  | 12 |  | 84 | use strict; | 
|  | 12 |  |  |  |  | 43 |  | 
|  | 12 |  |  |  |  | 507 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | require Exporter; | 
| 7 | 12 |  |  | 12 |  | 91 | use XSLoader (); | 
|  | 12 |  |  |  |  | 28 |  | 
|  | 12 |  |  |  |  | 3344 |  | 
| 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_01'; | 
| 54 |  |  |  |  |  |  | our $XS_VERSION = $VERSION; | 
| 55 |  |  |  |  |  |  | $VERSION = eval $VERSION; | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | our $AUTOLOAD; | 
| 58 |  |  |  |  |  |  | sub AUTOLOAD { | 
| 59 | 20 |  |  | 20 |  | 138525 | my $constname; | 
| 60 | 20 |  |  |  |  | 117 | ($constname = $AUTOLOAD) =~ s/.*:://; | 
| 61 |  |  |  |  |  |  | # print "AUTOLOAD: constname = $constname ($AUTOLOAD)\n"; | 
| 62 | 20 | 50 |  |  |  | 77 | die "&Time::HiRes::constant not defined" if $constname eq 'constant'; | 
| 63 | 20 |  |  |  |  | 99 | my ($error, $val) = constant($constname); | 
| 64 |  |  |  |  |  |  | # print "AUTOLOAD: error = $error, val = $val\n"; | 
| 65 | 20 | 50 |  |  |  | 68 | 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 |  | 108 | no strict 'refs'; | 
|  | 12 |  |  |  |  | 53 |  | 
|  | 12 |  |  |  |  | 4594 |  | 
|  | 20 |  |  |  |  | 41 |  | 
| 71 | 20 |  |  | 2236 |  | 122 | *$AUTOLOAD = sub { $val }; | 
|  | 2236 |  |  |  |  | 5213283 |  | 
| 72 |  |  |  |  |  |  | } | 
| 73 | 20 |  |  |  |  | 73 | goto &$AUTOLOAD; | 
| 74 |  |  |  |  |  |  | } | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | sub import { | 
| 77 | 4 |  |  | 4 |  | 391 | my $this = shift; | 
| 78 | 4 |  |  |  |  | 16 | for my $i (@_) { | 
| 79 | 4 | 50 | 33 |  |  | 132 | 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 |  |  |  |  | 570 | 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 | 3513452 | my ($a, $b) = @_; | 
| 101 | 18 | 100 |  |  |  | 158 | $b = [gettimeofday()] unless defined($b); | 
| 102 | 18 |  |  |  |  | 55 | (${$b}[0] - ${$a}[0]) + ((${$b}[1] - ${$a}[1]) / 1_000_000); | 
|  | 18 |  |  |  |  | 51 |  | 
|  | 18 |  |  |  |  | 103 |  | 
|  | 18 |  |  |  |  | 38 |  | 
|  | 18 |  |  |  |  | 644 |  | 
| 103 |  |  |  |  |  |  | } | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | # Autoload methods go after =cut, and are processed by the autosplit program. | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | 1; | 
| 108 |  |  |  |  |  |  | __END__ |