[zeromq-dev] zmq_poll stops expiring timeout in virtualized Windows 7

Steven McCoy steven.mccoy at miru.hk
Tue Oct 15 20:53:09 CEST 2013


On 15 October 2013 13:48, Felipe Farinon <felipe.farinon at powersyslab.com>wrote:

> I have found that
> VirtualBox's QueryPerformanceCounter doesn't guarantee monotonicity
> https://www.virtualbox.org/ticket/11951. They argue that even Windows
> QueryPerformanceCounter doesn't guarantee it.
>

This is true, the performance counters are highly unreliable.  With OpenPGM
I followed the SQL Server teams approach and move towards Windows
multimedia timers they offer greater stability and lower cost.  Copy &
pasting:

/* Multi-media like timer API, returns 100-nanoseconds intervals.
 *
 * Faster than QueryPerformanceCounter and hence deployed for SQL Server.
 *
http://blogs.msdn.com/b/psssql/archive/2008/12/16/how-it-works-sql-server-no-longer-uses-rdtsc-for-timings-in-sql-2008-and-sql-2005-service-pack-3-sp3.aspx
 */
static
pgm_time_t
pgm_mmtime_update (void)
{
        FILETIME ft;
        int64_t aligned_ft;

        GetSystemTimeAsFileTime (&ft);
        memcpy (&aligned_ft, &ft, sizeof (int64_t));
        return (pgm_time_t)( aligned_ft / 10 );
}

The caveat being you are still affected by NTP adjustments, but this is
available on platform where *GetTickCount64* is not.

GHC Haskell had similar discussions:

http://ghc.haskell.org/trac/ghc/ticket/5865


Chromiums discussion on topic:

https://chromium.googlesource.com/chromium/src/+/acca91d2f89419fe27e275e55fac228713497da4/base/time_win.cc


-- 
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131015/841d6941/attachment.htm>


More information about the zeromq-dev mailing list