← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:22 2010

File /usr/local/lib/perl5/5.10.1/darwin-2level/Time/HiRes.pm
Statements Executed 35
Statement Execution Time 512µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11266µs66µsTime::HiRes::::bootstrapTime::HiRes::bootstrap (xsub)
11240µs40µsTime::HiRes::::timeTime::HiRes::time (xsub)
22236µs346µsTime::HiRes::::importTime::HiRes::import
11121µs34µsTime::HiRes::::AUTOLOADTime::HiRes::AUTOLOAD
11114µs17µsTime::HiRes::::BEGIN@3Time::HiRes::BEGIN@3
1129µs9µsTime::HiRes::::constantTime::HiRes::constant (xsub)
1117µs19µsTime::HiRes::::BEGIN@42Time::HiRes::BEGIN@42
1116µs75µsTime::HiRes::::BEGIN@4Time::HiRes::BEGIN@4
1123µs3µsTime::HiRes::::CORE:substTime::HiRes::CORE:subst (opcode)
1111µs1µsTime::HiRes::::__ANON__[:43]Time::HiRes::__ANON__[:43]
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
3324µs220µs
# spent 17µs (14+3) within Time::HiRes::BEGIN@3 which was called # once (14µs+3µs) by SimpleDB::Client::BEGIN@56 at line 3
use strict;
# spent 17µs making 1 call to Time::HiRes::BEGIN@3 # spent 3µs making 1 call to strict::import
43148µs2144µs
# spent 75µs (6+69) within Time::HiRes::BEGIN@4 which was called # once (6µs+69µs) by SimpleDB::Client::BEGIN@56 at line 4
use vars qw($VERSION $XS_VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
# spent 75µs making 1 call to Time::HiRes::BEGIN@4 # spent 69µs making 1 call to vars::import
5
61500nsrequire Exporter;
71500nsrequire DynaLoader;
8
9113µs@ISA = qw(Exporter DynaLoader);
10
111200ns@EXPORT = qw( );
1216µs@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
261200ns$VERSION = '1.9719';
271200ns$XS_VERSION = $VERSION;
28120µs$VERSION = eval $VERSION;
29
30
# spent 34µs (21+12) within Time::HiRes::AUTOLOAD which was called # once (21µs+12µs) by Time::HiRes::import at line 51
sub AUTOLOAD {
31833µs my $constname;
32 ($constname = $AUTOLOAD) =~ s/.*:://;
# spent 3µs making 1 call to Time::HiRes::CORE:subst
33 # print "AUTOLOAD: constname = $constname ($AUTOLOAD)\n";
34 die "&Time::HiRes::constant not defined" if $constname eq 'constant';
35 my ($error, $val) = constant($constname);
# spent 9µs making 1 call to Time::HiRes::constant
36 # print "AUTOLOAD: error = $error, val = $val\n";
37 if ($error) {
38 my (undef,$file,$line) = caller;
39 die "$error at $file line $line.\n";
40 }
41 {
423212µs231µs
# spent 19µs (7+12) within Time::HiRes::BEGIN@42 which was called # once (7µs+12µs) by SimpleDB::Client::BEGIN@56 at line 42
no strict 'refs';
# spent 19µs making 1 call to Time::HiRes::BEGIN@42 # spent 12µs making 1 call to strict::unimport
4313µs
# spent 1µs within Time::HiRes::__ANON__[/usr/local/lib/perl5/5.10.1/darwin-2level/Time/HiRes.pm:43] which was called # once (1µs+0s) by Time::HiRes::import at line 45
*$AUTOLOAD = sub { $val };
44 }
45 goto &$AUTOLOAD;
# spent 1µs making 1 call to Time::HiRes::__ANON__[Time/HiRes.pm:43]
46}
47
48
# spent 346µs (36+310) within Time::HiRes::import which was called 2 times, avg 173µs/call: # once (23µs+235µs) by SimpleDB::Client::BEGIN@56 at line 56 of SimpleDB/Client.pm # once (13µs+75µs) by UUID::Tiny::BEGIN@9 at line 9 of UUID/Tiny.pm
sub import {
49726µs my $this = shift;
50 for my $i (@_) {
51 if (($i eq 'clock_getres' && !&d_clock_getres) ||
# spent 34µs making 1 call to Time::HiRes::AUTOLOAD
52 ($i eq 'clock_gettime' && !&d_clock_gettime) ||
53 ($i eq 'clock_nanosleep' && !&d_clock_nanosleep) ||
54 ($i eq 'clock' && !&d_clock) ||
55 ($i eq 'nanosleep' && !&d_nanosleep) ||
56 ($i eq 'usleep' && !&d_usleep) ||
57 ($i eq 'ualarm' && !&d_ualarm)) {
58 require Carp;
59 Carp::croak("Time::HiRes::$i(): unimplemented in this platform");
60 }
61 }
62 Time::HiRes->export_to_level(1, $this, @_);
# spent 47µs making 2 calls to Exporter::export_to_level, avg 24µs/call
63}
64
6516µs1372µsbootstrap Time::HiRes;
# spent 372µs making 1 call to DynaLoader::bootstrap
66
67# Preloaded methods go here.
68
69sub tv_interval {
70 # probably could have been done in C
71 my ($a, $b) = @_;
72 $b = [gettimeofday()] unless defined($b);
73 (${$b}[0] - ${$a}[0]) + ((${$b}[1] - ${$a}[1]) / 1_000_000);
74}
75
76# Autoload methods go after =cut, and are processed by the autosplit program.
77
78120µs1;
79__END__
80
81=head1 NAME
82
83Time::HiRes - High resolution alarm, sleep, gettimeofday, interval timers
84
85=head1 SYNOPSIS
86
87 use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep
88 clock_gettime clock_getres clock_nanosleep clock
89 stat );
90
91 usleep ($microseconds);
92 nanosleep ($nanoseconds);
93
94 ualarm ($microseconds);
95 ualarm ($microseconds, $interval_microseconds);
96
97 $t0 = [gettimeofday];
98 ($seconds, $microseconds) = gettimeofday;
99
100 $elapsed = tv_interval ( $t0, [$seconds, $microseconds]);
101 $elapsed = tv_interval ( $t0, [gettimeofday]);
102 $elapsed = tv_interval ( $t0 );
103
104 use Time::HiRes qw ( time alarm sleep );
105
106 $now_fractions = time;
107 sleep ($floating_seconds);
108 alarm ($floating_seconds);
109 alarm ($floating_seconds, $floating_interval);
110
111 use Time::HiRes qw( setitimer getitimer );
112
113 setitimer ($which, $floating_seconds, $floating_interval );
114 getitimer ($which);
115
116 use Time::HiRes qw( clock_gettime clock_getres clock_nanosleep
117 ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF );
118
119 $realtime = clock_gettime(CLOCK_REALTIME);
120 $resolution = clock_getres(CLOCK_REALTIME);
121
122 clock_nanosleep(CLOCK_REALTIME, 1.5e9);
123 clock_nanosleep(CLOCK_REALTIME, time()*1e9 + 10e9, TIMER_ABSTIME);
124
125 my $ticktock = clock();
126
127 use Time::HiRes qw( stat );
128
129 my @stat = stat("file");
130 my @stat = stat(FH);
131
132=head1 DESCRIPTION
133
134The C<Time::HiRes> module implements a Perl interface to the
135C<usleep>, C<nanosleep>, C<ualarm>, C<gettimeofday>, and
136C<setitimer>/C<getitimer> system calls, in other words, high
137resolution time and timers. See the L</EXAMPLES> section below and the
138test scripts for usage; see your system documentation for the
139description of the underlying C<nanosleep> or C<usleep>, C<ualarm>,
140C<gettimeofday>, and C<setitimer>/C<getitimer> calls.
141
142If your system lacks C<gettimeofday()> or an emulation of it you don't
143get C<gettimeofday()> or the one-argument form of C<tv_interval()>.
144If your system lacks all of C<nanosleep()>, C<usleep()>,
145C<select()>, and C<poll>, you don't get C<Time::HiRes::usleep()>,
146C<Time::HiRes::nanosleep()>, or C<Time::HiRes::sleep()>.
147If your system lacks both C<ualarm()> and C<setitimer()> you don't get
148C<Time::HiRes::ualarm()> or C<Time::HiRes::alarm()>.
149
150If you try to import an unimplemented function in the C<use> statement
151it will fail at compile time.
152
153If your subsecond sleeping is implemented with C<nanosleep()> instead
154of C<usleep()>, you can mix subsecond sleeping with signals since
155C<nanosleep()> does not use signals. This, however, is not portable,
156and you should first check for the truth value of
157C<&Time::HiRes::d_nanosleep> to see whether you have nanosleep, and
158then carefully read your C<nanosleep()> C API documentation for any
159peculiarities.
160
161If you are using C<nanosleep> for something else than mixing sleeping
162with signals, give some thought to whether Perl is the tool you should
163be using for work requiring nanosecond accuracies.
164
165Remember that unless you are working on a I<hard realtime> system,
166any clocks and timers will be imprecise, especially so if you are working
167in a pre-emptive multiuser system. Understand the difference between
168I<wallclock time> and process time (in UNIX-like systems the sum of
169I<user> and I<system> times). Any attempt to sleep for X seconds will
170most probably end up sleeping B<more> than that, but don't be surpised
171if you end up sleeping slightly B<less>.
172
173The following functions can be imported from this module.
174No functions are exported by default.
175
176=over 4
177
178=item gettimeofday ()
179
180In array context returns a two-element array with the seconds and
181microseconds since the epoch. In scalar context returns floating
182seconds like C<Time::HiRes::time()> (see below).
183
184=item usleep ( $useconds )
185
186Sleeps for the number of microseconds (millionths of a second)
187specified. Returns the number of microseconds actually slept.
188Can sleep for more than one second, unlike the C<usleep> system call.
189Can also sleep for zero seconds, which often works like a I<thread yield>.
190See also C<Time::HiRes::usleep()>, C<Time::HiRes::sleep()>, and
191C<Time::HiRes::clock_nanosleep()>.
192
193Do not expect usleep() to be exact down to one microsecond.
194
195=item nanosleep ( $nanoseconds )
196
197Sleeps for the number of nanoseconds (1e9ths of a second) specified.
198Returns the number of nanoseconds actually slept (accurate only to
199microseconds, the nearest thousand of them). Can sleep for more than
200one second. Can also sleep for zero seconds, which often works like
201a I<thread yield>. See also C<Time::HiRes::sleep()>,
202C<Time::HiRes::usleep()>, and C<Time::HiRes::clock_nanosleep()>.
203
204Do not expect nanosleep() to be exact down to one nanosecond.
205Getting even accuracy of one thousand nanoseconds is good.
206
207=item ualarm ( $useconds [, $interval_useconds ] )
208
209Issues a C<ualarm> call; the C<$interval_useconds> is optional and
210will be zero if unspecified, resulting in C<alarm>-like behaviour.
211
212Returns the remaining time in the alarm in microseconds, or C<undef>
213if an error occurred.
214
215ualarm(0) will cancel an outstanding ualarm().
216
217Note that the interaction between alarms and sleeps is unspecified.
218
219=item tv_interval
220
221tv_interval ( $ref_to_gettimeofday [, $ref_to_later_gettimeofday] )
222
223Returns the floating seconds between the two times, which should have
224been returned by C<gettimeofday()>. If the second argument is omitted,
225then the current time is used.
226
227=item time ()
228
229Returns a floating seconds since the epoch. This function can be
230imported, resulting in a nice drop-in replacement for the C<time>
231provided with core Perl; see the L</EXAMPLES> below.
232
233B<NOTE 1>: This higher resolution timer can return values either less
234or more than the core C<time()>, depending on whether your platform
235rounds the higher resolution timer values up, down, or to the nearest second
236to get the core C<time()>, but naturally the difference should be never
237more than half a second. See also L</clock_getres>, if available
238in your system.
239
240B<NOTE 2>: Since Sunday, September 9th, 2001 at 01:46:40 AM GMT, when
241the C<time()> seconds since epoch rolled over to 1_000_000_000, the
242default floating point format of Perl and the seconds since epoch have
243conspired to produce an apparent bug: if you print the value of
244C<Time::HiRes::time()> you seem to be getting only five decimals, not
245six as promised (microseconds). Not to worry, the microseconds are
246there (assuming your platform supports such granularity in the first
247place). What is going on is that the default floating point format of
248Perl only outputs 15 digits. In this case that means ten digits
249before the decimal separator and five after. To see the microseconds
250you can use either C<printf>/C<sprintf> with C<"%.6f">, or the
251C<gettimeofday()> function in list context, which will give you the
252seconds and microseconds as two separate values.
253
254=item sleep ( $floating_seconds )
255
256Sleeps for the specified amount of seconds. Returns the number of
257seconds actually slept (a floating point value). This function can
258be imported, resulting in a nice drop-in replacement for the C<sleep>
259provided with perl, see the L</EXAMPLES> below.
260
261Note that the interaction between alarms and sleeps is unspecified.
262
263=item alarm ( $floating_seconds [, $interval_floating_seconds ] )
264
265The C<SIGALRM> signal is sent after the specified number of seconds.
266Implemented using C<setitimer()> if available, C<ualarm()> if not.
267The C<$interval_floating_seconds> argument is optional and will be
268zero if unspecified, resulting in C<alarm()>-like behaviour. This
269function can be imported, resulting in a nice drop-in replacement for
270the C<alarm> provided with perl, see the L</EXAMPLES> below.
271
272Returns the remaining time in the alarm in seconds, or C<undef>
273if an error occurred.
274
275B<NOTE 1>: With some combinations of operating systems and Perl
276releases C<SIGALRM> restarts C<select()>, instead of interrupting it.
277This means that an C<alarm()> followed by a C<select()> may together
278take the sum of the times specified for the the C<alarm()> and the
279C<select()>, not just the time of the C<alarm()>.
280
281Note that the interaction between alarms and sleeps is unspecified.
282
283=item setitimer ( $which, $floating_seconds [, $interval_floating_seconds ] )
284
285Start up an interval timer: after a certain time, a signal ($which) arrives,
286and more signals may keep arriving at certain intervals. To disable
287an "itimer", use C<$floating_seconds> of zero. If the
288C<$interval_floating_seconds> is set to zero (or unspecified), the
289timer is disabled B<after> the next delivered signal.
290
291Use of interval timers may interfere with C<alarm()>, C<sleep()>,
292and C<usleep()>. In standard-speak the "interaction is unspecified",
293which means that I<anything> may happen: it may work, it may not.
294
295In scalar context, the remaining time in the timer is returned.
296
297In list context, both the remaining time and the interval are returned.
298
299There are usually three or four interval timers (signals) available: the
300C<$which> can be C<ITIMER_REAL>, C<ITIMER_VIRTUAL>, C<ITIMER_PROF>, or
301C<ITIMER_REALPROF>. Note that which ones are available depends: true
302UNIX platforms usually have the first three, but only Solaris seems to
303have C<ITIMER_REALPROF> (which is used to profile multithreaded programs).
304Win32 unfortunately does not haveinterval timers.
305
306C<ITIMER_REAL> results in C<alarm()>-like behaviour. Time is counted in
307I<real time>; that is, wallclock time. C<SIGALRM> is delivered when
308the timer expires.
309
310C<ITIMER_VIRTUAL> counts time in (process) I<virtual time>; that is,
311only when the process is running. In multiprocessor/user/CPU systems
312this may be more or less than real or wallclock time. (This time is
313also known as the I<user time>.) C<SIGVTALRM> is delivered when the
314timer expires.
315
316C<ITIMER_PROF> counts time when either the process virtual time or when
317the operating system is running on behalf of the process (such as I/O).
318(This time is also known as the I<system time>.) (The sum of user
319time and system time is known as the I<CPU time>.) C<SIGPROF> is
320delivered when the timer expires. C<SIGPROF> can interrupt system calls.
321
322The semantics of interval timers for multithreaded programs are
323system-specific, and some systems may support additional interval
324timers. For example, it is unspecified which thread gets the signals.
325See your C<setitimer()> documentation.
326
327=item getitimer ( $which )
328
329Return the remaining time in the interval timer specified by C<$which>.
330
331In scalar context, the remaining time is returned.
332
333In list context, both the remaining time and the interval are returned.
334The interval is always what you put in using C<setitimer()>.
335
336=item clock_gettime ( $which )
337
338Return as seconds the current value of the POSIX high resolution timer
339specified by C<$which>. All implementations that support POSIX high
340resolution timers are supposed to support at least the C<$which> value
341of C<CLOCK_REALTIME>, which is supposed to return results close to the
342results of C<gettimeofday>, or the number of seconds since 00:00:00:00
343January 1, 1970 Greenwich Mean Time (GMT). Do not assume that
344CLOCK_REALTIME is zero, it might be one, or something else.
345Another potentially useful (but not available everywhere) value is
346C<CLOCK_MONOTONIC>, which guarantees a monotonically increasing time
347value (unlike time() or gettimeofday(), which can be adjusted).
348See your system documentation for other possibly supported values.
349
350=item clock_getres ( $which )
351
352Return as seconds the resolution of the POSIX high resolution timer
353specified by C<$which>. All implementations that support POSIX high
354resolution timers are supposed to support at least the C<$which> value
355of C<CLOCK_REALTIME>, see L</clock_gettime>.
356
357=item clock_nanosleep ( $which, $nanoseconds, $flags = 0)
358
359Sleeps for the number of nanoseconds (1e9ths of a second) specified.
360Returns the number of nanoseconds actually slept. The $which is the
361"clock id", as with clock_gettime() and clock_getres(). The flags
362default to zero but C<TIMER_ABSTIME> can specified (must be exported
363explicitly) which means that C<$nanoseconds> is not a time interval
364(as is the default) but instead an absolute time. Can sleep for more
365than one second. Can also sleep for zero seconds, which often works
366like a I<thread yield>. See also C<Time::HiRes::sleep()>,
367C<Time::HiRes::usleep()>, and C<Time::HiRes::nanosleep()>.
368
369Do not expect clock_nanosleep() to be exact down to one nanosecond.
370Getting even accuracy of one thousand nanoseconds is good.
371
372=item clock()
373
374Return as seconds the I<process time> (user + system time) spent by
375the process since the first call to clock() (the definition is B<not>
376"since the start of the process", though if you are lucky these times
377may be quite close to each other, depending on the system). What this
378means is that you probably need to store the result of your first call
379to clock(), and subtract that value from the following results of clock().
380
381The time returned also includes the process times of the terminated
382child processes for which wait() has been executed. This value is
383somewhat like the second value returned by the times() of core Perl,
384but not necessarily identical. Note that due to backward
385compatibility limitations the returned value may wrap around at about
3862147 seconds or at about 36 minutes.
387
388=item stat
389
390=item stat FH
391
392=item stat EXPR
393
394As L<perlfunc/stat> but with the access/modify/change file timestamps
395in subsecond resolution, if the operating system and the filesystem
396both support such timestamps. To override the standard stat():
397
398 use Time::HiRes qw(stat);
399
400Test for the value of &Time::HiRes::d_hires_stat to find out whether
401the operating system supports subsecond file timestamps: a value
402larger than zero means yes. There are unfortunately no easy
403ways to find out whether the filesystem supports such timestamps.
404UNIX filesystems often do; NTFS does; FAT doesn't (FAT timestamp
405granularity is B<two> seconds).
406
407A zero return value of &Time::HiRes::d_hires_stat means that
408Time::HiRes::stat is a no-op passthrough for CORE::stat(),
409and therefore the timestamps will stay integers. The same
410thing will happen if the filesystem does not do subsecond timestamps,
411even if the &Time::HiRes::d_hires_stat is non-zero.
412
413In any case do not expect nanosecond resolution, or even a microsecond
414resolution. Also note that the modify/access timestamps might have
415different resolutions, and that they need not be synchronized, e.g.
416if the operations are
417
418 write
419 stat # t1
420 read
421 stat # t2
422
423the access time stamp from t2 need not be greater-than the modify
424time stamp from t1: it may be equal or I<less>.
425
426=back
427
428=head1 EXAMPLES
429
430 use Time::HiRes qw(usleep ualarm gettimeofday tv_interval);
431
432 $microseconds = 750_000;
433 usleep($microseconds);
434
435 # signal alarm in 2.5s & every .1s thereafter
436 ualarm(2_500_000, 100_000);
437 # cancel that ualarm
438 ualarm(0);
439
440 # get seconds and microseconds since the epoch
441 ($s, $usec) = gettimeofday();
442
443 # measure elapsed time
444 # (could also do by subtracting 2 gettimeofday return values)
445 $t0 = [gettimeofday];
446 # do bunch of stuff here
447 $t1 = [gettimeofday];
448 # do more stuff here
449 $t0_t1 = tv_interval $t0, $t1;
450
451 $elapsed = tv_interval ($t0, [gettimeofday]);
452 $elapsed = tv_interval ($t0); # equivalent code
453
454 #
455 # replacements for time, alarm and sleep that know about
456 # floating seconds
457 #
458 use Time::HiRes;
459 $now_fractions = Time::HiRes::time;
460 Time::HiRes::sleep (2.5);
461 Time::HiRes::alarm (10.6666666);
462
463 use Time::HiRes qw ( time alarm sleep );
464 $now_fractions = time;
465 sleep (2.5);
466 alarm (10.6666666);
467
468 # Arm an interval timer to go off first at 10 seconds and
469 # after that every 2.5 seconds, in process virtual time
470
471 use Time::HiRes qw ( setitimer ITIMER_VIRTUAL time );
472
473 $SIG{VTALRM} = sub { print time, "\n" };
474 setitimer(ITIMER_VIRTUAL, 10, 2.5);
475
476 use Time::HiRes qw( clock_gettime clock_getres CLOCK_REALTIME );
477 # Read the POSIX high resolution timer.
478 my $high = clock_getres(CLOCK_REALTIME);
479 # But how accurate we can be, really?
480 my $reso = clock_getres(CLOCK_REALTIME);
481
482 use Time::HiRes qw( clock_nanosleep TIMER_ABSTIME );
483 clock_nanosleep(CLOCK_REALTIME, 1e6);
484 clock_nanosleep(CLOCK_REALTIME, 2e9, TIMER_ABSTIME);
485
486 use Time::HiRes qw( clock );
487 my $clock0 = clock();
488 ... # Do something.
489 my $clock1 = clock();
490 my $clockd = $clock1 - $clock0;
491
492 use Time::HiRes qw( stat );
493 my ($atime, $mtime, $ctime) = (stat("istics"))[8, 9, 10];
494
495=head1 C API
496
497In addition to the perl API described above, a C API is available for
498extension writers. The following C functions are available in the
499modglobal hash:
500
501 name C prototype
502 --------------- ----------------------
503 Time::NVtime double (*)()
504 Time::U2time void (*)(pTHX_ UV ret[2])
505
506Both functions return equivalent information (like C<gettimeofday>)
507but with different representations. The names C<NVtime> and C<U2time>
508were selected mainly because they are operating system independent.
509(C<gettimeofday> is Unix-centric, though some platforms like Win32 and
510VMS have emulations for it.)
511
512Here is an example of using C<NVtime> from C:
513
514 double (*myNVtime)(); /* Returns -1 on failure. */
515 SV **svp = hv_fetch(PL_modglobal, "Time::NVtime", 12, 0);
516 if (!svp) croak("Time::HiRes is required");
517 if (!SvIOK(*svp)) croak("Time::NVtime isn't a function pointer");
518 myNVtime = INT2PTR(double(*)(), SvIV(*svp));
519 printf("The current time is: %f\n", (*myNVtime)());
520
521=head1 DIAGNOSTICS
522
523=head2 useconds or interval more than ...
524
525In ualarm() you tried to use number of microseconds or interval (also
526in microseconds) more than 1_000_000 and setitimer() is not available
527in your system to emulate that case.
528
529=head2 negative time not invented yet
530
531You tried to use a negative time argument.
532
533=head2 internal error: useconds < 0 (unsigned ... signed ...)
534
535Something went horribly wrong-- the number of microseconds that cannot
536become negative just became negative. Maybe your compiler is broken?
537
538=head2 useconds or uinterval equal to or more than 1000000
539
540In some platforms it is not possible to get an alarm with subsecond
541resolution and later than one second.
542
543=head2 unimplemented in this platform
544
545Some calls simply aren't available, real or emulated, on every platform.
546
547=head1 CAVEATS
548
549Notice that the core C<time()> maybe rounding rather than truncating.
550What this means is that the core C<time()> may be reporting the time
551as one second later than C<gettimeofday()> and C<Time::HiRes::time()>.
552
553Adjusting the system clock (either manually or by services like ntp)
554may cause problems, especially for long running programs that assume
555a monotonously increasing time (note that all platforms do not adjust
556time as gracefully as UNIX ntp does). For example in Win32 (and derived
557platforms like Cygwin and MinGW) the Time::HiRes::time() may temporarily
558drift off from the system clock (and the original time()) by up to 0.5
559seconds. Time::HiRes will notice this eventually and recalibrate.
560Note that since Time::HiRes 1.77 the clock_gettime(CLOCK_MONOTONIC)
561might help in this (in case your system supports CLOCK_MONOTONIC).
562
563Some systems have APIs but not implementations: for example QNX and Haiku
564have the interval timer APIs but not the functionality.
565
566=head1 SEE ALSO
567
568Perl modules L<BSD::Resource>, L<Time::TAI64>.
569
570Your system documentation for C<clock>, C<clock_gettime>,
571C<clock_getres>, C<clock_nanosleep>, C<clock_settime>, C<getitimer>,
572C<gettimeofday>, C<setitimer>, C<sleep>, C<stat>, C<ualarm>.
573
574=head1 AUTHORS
575
576D. Wegscheid <wegscd@whirlpool.com>
577R. Schertler <roderick@argon.org>
578J. Hietaniemi <jhi@iki.fi>
579G. Aas <gisle@aas.no>
580
581=head1 COPYRIGHT AND LICENSE
582
583Copyright (c) 1996-2002 Douglas E. Wegscheid. All rights reserved.
584
585Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Jarkko Hietaniemi.
586All rights reserved.
587
588This program is free software; you can redistribute it and/or modify
589it under the same terms as Perl itself.
590
591=cut
# spent 3µs within Time::HiRes::CORE:subst which was called # once (3µs+0s) by Time::HiRes::AUTOLOAD at line 32 of Time/HiRes.pm
sub Time::HiRes::CORE:subst; # xsub
# spent 66µs within Time::HiRes::bootstrap which was called # once (66µs+0s) by DynaLoader::bootstrap at line 227 of DynaLoader.pm
sub Time::HiRes::bootstrap; # xsub
# spent 9µs within Time::HiRes::constant which was called # once (9µs+0s) by Time::HiRes::AUTOLOAD at line 35 of Time/HiRes.pm
sub Time::HiRes::constant; # xsub
# spent 40µs within Time::HiRes::time which was called # once (40µs+0s) by UUID::Tiny::_generate_clk_seq at line 725 of UUID/Tiny.pm
sub Time::HiRes::time; # xsub