According to the 'getitimer()' man page: "The element it_value is set to the amount of time remaining on the timer, or zero if the timer is disabled. Similarly, it_interval is set to the reset value."
As such the following Perl program should never exit:
use Time::HiRes;
$SIG{VTALRM} = sub { };
Time::HiRes::setitimer(&Time::HiRes::ITIMER_VIRTUAL, 0.5, 0.4);
while (1) {
my @t = Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL);
exit 0 if $t[0] == 0;
}
and on linux-image 3.11.0-18-generic (and all other systems tested) it loops forever but 3.13.0-32-generic it exits. Have not bisected between those kernels, nor am I likely to be able to do so soon.
This Perl program shows the timer countdown:
use Time::HiRes;
my $r = [Time::HiRes::gettimeofday()];
sub display {
my ($desc) = @_;
my @t = Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL);
my $i = Time::HiRes::tv_interval($r);
printf "%s: elasped=%.8f; time left=%.6f reset time=%.6f\n", $desc,
$i,@t;
}
$SIG{VTALRM} = sub {
display('VTALRM');
exit;
};
Time::HiRes::setitimer(&Time::HiRes::ITIMER_VIRTUAL, 0.5, 0.4);
while (1) {
display('inloop');
}
on other (working) systems it gives:
inloop: elasped=1.65178400; time left=0.001000 reset time=0.401000
inloop: elasped=1.65184200; time left=0.001000 reset time=0.401000
inloop: elasped=1.65186800; time left=0.001000 reset time=0.401000
inloop: elasped=1.65192300; time left=0.001000 reset time=0.401000
inloop: elasped=1.65198100; time left=0.001000 reset time=0.401000
VTALRM: elasped=1.65209800; time left=0.400000 reset time=0.401000
(end of file)
but on the 3.13.0-32-generic or later kernel I get:
inloop: elasped=0.54692100; time left=0.000033 reset time=0.400000
inloop: elasped=0.54692800; time left=0.000026 reset time=0.400000
inloop: elasped=0.54693500; time left=0.000020 reset time=0.400000
inloop: elasped=0.54694100; time left=0.000013 reset time=0.400000
inloop: elasped=0.54694800; time left=0.000007 reset time=0.400000
inloop: elasped=0.54695500; time left=0.000000 reset time=0.400000
inloop: elasped=0.54696200; time left=0.004000 reset time=0.400000
[...]
VTALRM: elasped=0.55013600; time left=0.397062 reset time=0.400000
(end of file)
The reset time also looks dodgy.
Hardware is an Intel Core i7-920 on Asus P6T Deluxe v2 (X58) motherboard and hasn't changed.
According to the 'getitimer()' man page: "The element it_value is set to the amount of time remaining on the timer, or zero if the timer is disabled. Similarly, it_interval is set to the reset value."
As such the following Perl program should never exit:
use Time::HiRes; :HiRes: :setitimer( &Time:: HiRes:: ITIMER_ VIRTUAL, 0.5, 0.4); :getitimer( &Time:: HiRes:: ITIMER_ VIRTUAL) ;
$SIG{VTALRM} = sub { };
Time:
while (1) {
my @t = Time::HiRes:
exit 0 if $t[0] == 0;
}
and on linux-image 3.11.0-18-generic (and all other systems tested) it loops forever but 3.13.0-32-generic it exits. Have not bisected between those kernels, nor am I likely to be able to do so soon.
This Perl program shows the timer countdown:
use Time::HiRes; HiRes:: gettimeofday( )]; :getitimer( &Time:: HiRes:: ITIMER_ VIRTUAL) ; :tv_interval( $r); 'VTALRM' ); :setitimer( &Time:: HiRes:: ITIMER_ VIRTUAL, 0.5, 0.4); 'inloop' );
my $r = [Time::
sub display {
my ($desc) = @_;
my @t = Time::HiRes:
my $i = Time::HiRes:
printf "%s: elasped=%.8f; time left=%.6f reset time=%.6f\n", $desc,
$i,@t;
}
$SIG{VTALRM} = sub {
display(
exit;
};
Time::HiRes:
while (1) {
display(
}
on other (working) systems it gives:
inloop: elasped=1.65178400; time left=0.001000 reset time=0.401000
inloop: elasped=1.65184200; time left=0.001000 reset time=0.401000
inloop: elasped=1.65186800; time left=0.001000 reset time=0.401000
inloop: elasped=1.65192300; time left=0.001000 reset time=0.401000
inloop: elasped=1.65198100; time left=0.001000 reset time=0.401000
VTALRM: elasped=1.65209800; time left=0.400000 reset time=0.401000
(end of file)
but on the 3.13.0-32-generic or later kernel I get:
inloop: elasped=0.54692100; time left=0.000033 reset time=0.400000
inloop: elasped=0.54692800; time left=0.000026 reset time=0.400000
inloop: elasped=0.54693500; time left=0.000020 reset time=0.400000
inloop: elasped=0.54694100; time left=0.000013 reset time=0.400000
inloop: elasped=0.54694800; time left=0.000007 reset time=0.400000
inloop: elasped=0.54695500; time left=0.000000 reset time=0.400000
inloop: elasped=0.54696200; time left=0.004000 reset time=0.400000
[...]
VTALRM: elasped=0.55013600; time left=0.397062 reset time=0.400000
(end of file)
The reset time also looks dodgy.
Hardware is an Intel Core i7-920 on Asus P6T Deluxe v2 (X58) motherboard and hasn't changed.
Requested information:
Ubuntu 3.13.0- 32.57-generic 3.13.11.4
Description: Ubuntu 14.04.1 LTS
Release: 14.04
# apt-cache policy linux-image-generic generic: us.archive. ubuntu. com/ubuntu/ trusty-updates/main amd64 Packages us.archive. ubuntu. com/ubuntu/ trusty- security/ main amd64 Packages us.archive. ubuntu. com/ubuntu/ trusty- proposed/ main amd64 Packages ppa.launchpad. net/canonical- kernel- team/ppa/ ubuntu/ trusty/main amd64 Packages dpkg/status us.archive. ubuntu. com/ubuntu/ trusty/main amd64 Packages
linux-image-
Installed: 3.13.0.32.38
Candidate: 3.13.0.32.38
Version table:
*** 3.13.0.32.38 0
500 http://
500 http://
500 http://
500 http://
100 /var/lib/
3.13.0.24.28 0
500 http://