gethrvtime() overflow on netbsd
From the Pike developers mailinglist/LysLysKOM 26092611:
26092611 2023-11-24 04:29 /35 rader/ <william@welliver.org>
Sänt av: SRS0=LsSK=HF=lists.lysator.liu.se=pike-devel-bounces@lysator.liu.se
Importerad: 2023-11-24 04:29 av Brevbäraren
Extern mottagare: pike-devel@lists.lysator.liu.se
Mottagare: Pike (-) developers forum <21444>
Ärende: gethrvtime() overflow on netbsd
------------------------------------------------------------
Hello all,
I've been working on a new stable release and in the course of the usual checks, I noticed that pike farm builds are failing on netbsd (9.3). A little investigation shows that the benchmark is effectively timing out. I think this failure is caused by the code that limits a test to a given amount of time.
Basically, the elapsed time is calculated as final_time - start_time as
returned by gethrvtime()
, and it appears that on netbsd, there's (I'm
assuming) an overflow that causes the elapsed time to become negative.
It happens often enough that the total amount of time spent on a given
set of test runs becomes increasingly negative, essentially running any
test forever.
I"m sure that there's a better solution but I'd like to suggest that in the interim, a simple check be added to ignore any negative times:
In Tools.Shoot.run_sub()
:
From:
tg += (hrt - start_cpu) / 1000000.0;
To:
int te = hrt - start_cpu;
if(te < 0 ) te = 0;
tg += te / 1000000.0;
Does anyone have any objection to me making this change in 9.0 and 8.0?
Bill
(26092611) /<william@welliver.org>/-----------------