Re: [Windows,PATCH] Use faster, higher precision timer API

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Fabris Giovanni Consulente <cons(dot)FabrisGiovanni(at)sia(dot)eu>
Subject: Re: [Windows,PATCH] Use faster, higher precision timer API
Date: 2014-09-17 16:58:40
Message-ID: 5419BDC0.2060001@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 09/17/2014 12:51 PM, Andres Freund wrote:
> On 2014-09-17 11:19:36 -0400, Andrew Dunstan wrote:
>> On 09/17/2014 08:27 AM, Craig Ringer wrote:
>>> Hi all
>>>
>>> Attached is a patch to switch 9.5 over to using the
>>> GetSystemTimeAsFileTime call instead of separate GetSystemTime and
>>> SystemTimeToFileTime calls.
>>>
>>> This patch the first step in improving PostgreSQL's support for Windows
>>> high(er) resolution time.
>>>
>>> In addition to requiring one less call into the platform libraries, this
>>> change permits capture of timestamps at up to 100ns precision, instead
>>> of the current 1ms limit. Unfortunately due to platform timer resolution
>>> limitations it will in practice only report with 1ms resolution and
>>> 0.1ms precision - or sometimes even as much as 15ms resolution. (If you
>>> want to know more, see the README for
>>> https://github.com/2ndQuadrant/pg_sysdatetime).
>>>
>>> On Windows 2012 and Windows 8 I'd like to use the new
>>> GetSystemTimePreciseAsFileTime call instead. As this requires some extra
>>> hoop-jumping to safely and efficiently use it without breaking support
>>> for older platforms I suggest that we start with just switching over to
>>> GetSystemTimeAsFileTime, which has been supported since Windows 2000.
>>> Then more precise time capture can be added in a later patch.
>>>
>>>
>>
>> That will presumably breaK XP.
> The proposed patch? I don't really see why? GetSystemTimeAsFileTime() is
> documented to be available since win2k?

Oh, hmm, yes, you're right. For some reason I was thinking W2K was later
than XP. I get more random memory errors as I get older ...

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-09-17 17:30:49 Re: printing table in asciidoc with psql
Previous Message Andres Freund 2014-09-17 16:51:50 Re: [Windows,PATCH] Use faster, higher precision timer API