Use clock_gettime() in ETA calculation to cope with VM suspend/resume
From Matějů Miroslav, Ing. in 2016 - correspondence summarised below
I'd be pleased if you referred me. I have a website at http://mirekm.wz.cz/ but I've not updated it for ages. I must put relevant information there and create English version soon.
Best regards,
Miroslav
-----Original Message-----
From: Andrew Wood
Sent: Monday, May 16, 2016 12:57 AM
To: Matějů Miroslav, Ing.
Subject: Re: ETA calculation in PVThank you for your email. I will look into using clock_gettime(), as
it sounds like it will work much better.Do you have a web site I can link to in the contributors section of the
documentation?On Mon, May 09, 2016 at 08:16:45AM +0000, Matějů Miroslav, Ing. wrote:
Thank you for making PV, a great tool to monitor a long-lasting pipe
process. I have one instance being run for 97 hours already!However, I experienced a problem in the calculation of ETA. The above
mentioned process happens in a virtual machine that I suspend regularly.
The ETA calculation seems to include the time when the machine was
suspended into the elapsed time and the reported ETA always increases
abruptly after waking the machine.I looked into the PV source and discovered that you use the function
gettimeofday() for getting elapsed time. Its manual page says that it is
affected by discontinuous jumps in the system time like time-zone change.
Moreover, it is marked as obsolete in POSIX.1-2008. It would be probably
better to use clock_gettime() with CLOCK_MONOTONIC or CLOCK_MONOTONIC_RAW
which would provide correct results.
From Matějů Miroslav, Ing. in 2016 - correspondence summarised below I'd be pleased if you referred me. I have a website at http://mirekm.wz.cz/ but I've not updated it for ages. I must put relevant information there and create English version soon. Best regards, Miroslav > -----Original Message----- > From: Andrew Wood > Sent: Monday, May 16, 2016 12:57 AM > To: Matějů Miroslav, Ing. > Subject: Re: ETA calculation in PV > > Thank you for your email. I will look into using clock_gettime(), as > it sounds like it will work much better. > > Do you have a web site I can link to in the contributors section of the > documentation? > > > On Mon, May 09, 2016 at 08:16:45AM +0000, Matějů Miroslav, Ing. wrote: > > Thank you for making PV, a great tool to monitor a long-lasting pipe > > process. I have one instance being run for 97 hours already! > > > > However, I experienced a problem in the calculation of ETA. The above > > mentioned process happens in a virtual machine that I suspend regularly. > > The ETA calculation seems to include the time when the machine was > > suspended into the elapsed time and the reported ETA always increases > > abruptly after waking the machine. > > > > I looked into the PV source and discovered that you use the function > > gettimeofday() for getting elapsed time. Its manual page says that it is > > affected by discontinuous jumps in the system time like time-zone change. > > Moreover, it is marked as obsolete in POSIX.1-2008. It would be probably > > better to use clock_gettime() with CLOCK_MONOTONIC or CLOCK_MONOTONIC_RAW > > which would provide correct results.