X-Original-To: pgsql-hackers-win32-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 28EE756594; Mon, 7 Mar 2005 16:30:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19279-07; Mon, 7 Mar 2005 16:30:06 +0000 (GMT) Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu [129.255.60.186]) by svr1.postgresql.org (Postfix) with ESMTP id A87B85659A; Mon, 7 Mar 2005 16:29:59 +0000 (GMT) Received: from [129.255.60.32] (natu.i-clic.uihc.uiowa.edu [129.255.60.32]) by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id j27GTk309693; Mon, 7 Mar 2005 10:29:46 -0600 Message-ID: <422C817A.8050009@arbash-meinel.com> Date: Mon, 07 Mar 2005 10:29:46 -0600 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Magnus Hagander , Ken Egervari , pgsql-performance@postgresql.org, pgsql-hackers-win32@postgresql.org Subject: Re: [PERFORM] Help with tuning this query (with References: <6BCB9D8A16AC4241919521715F4D8BCE476A60@algol.sollentuna.se> <23086.1110206737@sss.pgh.pa.us> In-Reply-To: <23086.1110206737@sss.pgh.pa.us> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig66A13755854B5C23F3A788DF" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200503/53 X-Sequence-Number: 3011 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig66A13755854B5C23F3A788DF Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Tom Lane wrote: >"Magnus Hagander" writes: > > >>There is. I beleive QueryPerformanceCounter has sub-mirosecond >>resolution. >> >> >>Can we just replace gettimeofday() with a version that's basically: >> >> > >No, because it's also used for actual time-of-day calls. It'd be >necessary to hack executor/instrument.c in particular. > > regards, tom lane > > It seems that there are 2 possibilities. Leave gettimeofday as it is, and then change code that calls it for deltas with a "pg_get_high_res_delta_time()", which on most platforms is just gettimeofday, but on win32 is a wrapper for QueryPerformanceCounter(). Or we modify the win32 gettimeofday call to something like: gettimeofday(struct timeval *tv, struct timezone *tz) { static int initialized = 0; static LARGE_INTEGER freq = {0}; static LARGE_INTEGER base = {0}; static struct time_t base_tm = {0}; LARGE_INTEGER now = {0}; int64_t delta_secs = 0; if(!initialized) { QueryPerformanceFrequency(&freq); base_tm = time(NULL); // This can be any moderately accurate time function, maybe getlocaltime if it exists QueryPerformanceCounter(&base); } QueryPerformanceCounter(&now); delta_secs = now.QuadPart - base.QuadPart; tv->tv_sec = delta_secs / freq.QuadPart; delta_secs -= *tv.tv_sec * freq.QuadPart; tv->tv_usec = delta_secs * 1000000 / freq.QuadPart tv->tv_sec += base_tm; return 0; } --------------enig66A13755854B5C23F3A788DF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCLIF6JdeBCYSNAAMRAgvEAJ4rg9GJNkX0j+ViiQ6nGE8MIS1GVwCdFKQ3 iOPu9Lp51/cPaHoZ4TJ7LoQ= =RE9x -----END PGP SIGNATURE----- --------------enig66A13755854B5C23F3A788DF--