pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John A Meinel <john@arbash-meinel.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dave Held <dave.held@arrayservicesgrp.com>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-hackers-win32@postgresql.org
Subject: Re: [PERFORM] Help with tuning this query (with
Date: Mon, 07 Mar 2005 22:35:09 -0600
Message-ID: <422D2B7D.5080702@arbash-meinel.com> (raw)
In-Reply-To: <15994.1110236199@sss.pgh.pa.us>
References: <49E94D0CFCD4DB43AFBA928DDD20C8F90261846B@asg002.asg.local>
	<422CDA2A.1000105@arbash-meinel.com>
	<15994.1110236199@sss.pgh.pa.us>

Tom Lane wrote:

>John A Meinel <john@arbash-meinel.com> writes:
>  
>
>>Dave Held wrote:
>>    
>>
>>>There is always clock().
>>>      
>>>
>
>  
>
>>My experience with clock() on win32 is that CLOCKS_PER_SEC was 1000, and 
>>it had a resolution of 55clocks / s. When I just did this:
>>    
>>
>
>The other problem is it measures process CPU time, not elapsed time
>which is probably more significant for our purposes.
>
>Which brings up a question: just what does QueryPerformanceCounter
>measure?
>
>			regards, tom lane
>  
>
clock() according to the Visual Studio Help measures wall clock time. 
But you're right, POSIX says it is approximation of processor time.

The docs don't say specifically what QueryPerformanceCounter() measures, 
but states

> The *QueryPerformanceCounter* function retrieves the current value of 
> the high-resolution performance counter.
>
It also states:

>
>         Remarks
>
> On a multiprocessor machine, it should not matter which processor is 
> called. However, you can get different results on different processors 
> due to bugs in the BIOS or the HAL. To specify processor affinity for 
> a thread, use the *SetThreadAffinityMask* function.
>

So it sounds like it is actually querying some counter independent of 
processing.

In fact, there is also this statement:

> *QueryPerformanceFrequency*
>
> The QueryPerformanceFrequency function retrieves the frequency of the 
> high-resolution performance counter, if one exists. The frequency 
> cannot change while the system is running.
>
If that is accurate, it would make QueryPerformanceCounter independent 
of things like speed stepping, etc. So again, it sounds independent of 
processing.

John
=:->

Attachments:

  signature.asc (application/pgp-signature, 252B) download

view thread (16+ messages)  latest in thread

Message-ID: <422D2B7D.5080702@arbash-meinel.com>
Permalink:  ../422D2B7D.5080702@arbash-meinel.com/
Also on:    postgresql.org/message-id/422D2B7D.5080702@arbash-meinel.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: john@arbash-meinel.com, tgl@sss.pgh.pa.us, dave.held@arrayservicesgrp.com, pgsql-hackers-win32@postgresql.org
  Subject: Re: [PERFORM] Help with tuning this query (with
  In-Reply-To: <422D2B7D.5080702@arbash-meinel.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox