problems with Time::HiRes on some SLES systems

M

Mark Seger

I've been using this module for doing highly accurate sleeping. I would
essentially set an alarm for n-seconds and then so a sleep for time time
greater then n. When the signal is delivered and I act on it (or simply
just return), my app simply continues after the sleep.

I'm now trying this on several freshly installed sles10 systems and it
wakes up early when the time is 5 or greater and I have no clue why. It
runs just fine on every other system/architecture I've tried. Could
something be missing from the installation? Is there some easy way to
tell??

Here's what the script looks like:

#!/usr/bin/perl -w

use Time::HiRes;

$SIG{ALRM}=\&sigAlrm;

for ($i=1; $i<60; $i++)
{
$time0=time;
Time::HiRes::ualarm($i*1000000);
sleep 100;
printf "Alarm: $i Awake! %d secs\n", time-$time0;
}

# usleep wakeup
sub sigAlrm
{
}

and here's what it's producing on 3 systems:

linux:/mjs # /usr/bin/perl sht.pl
Alarm: 1 Awake! 1 secs
Alarm: 2 Awake! 2 secs
Alarm: 3 Awake! 3 secs
Alarm: 4 Awake! 4 secs
Alarm: 5 Awake! 0 secs
Alarm: 6 Awake! 2 secs
Alarm: 7 Awake! 3 secs
Alarm: 8 Awake! 3 secs
Alarm: 9 Awake! 1 secs
Alarm: 10 Awake! 1 secs
Alarm: 11 Awake! 3 secs
Alarm: 12 Awake! 3 secs
Alarm: 13 Awake! 0 secs
Alarm: 14 Awake! 1 secs
Alarm: 15 Awake! 2 secs

I'm stumped...
-mark
 
M

Mark Seger

Mark said:
I've been using this module for doing highly accurate sleeping. I would
essentially set an alarm for n-seconds and then so a sleep for time time
greater then n. When the signal is delivered and I act on it (or simply
just return), my app simply continues after the sleep.

I've been in touch with the developer Jarkko Hietaniemi and he's
confirmed this is indeed a problem and he will have a newer version
coming out some time in the future.
-mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top