Re: timing a method

From: Jim P (Jim_P_at_mad.scientist.com)
Date: 12/12/04


Date: Sun, 12 Dec 2004 12:01:27 -0800

Dr John Stockton wrote:

> JRS: In article <1Yex61CpoxuBFwZk@merlyn.demon.co.uk>, dated Sat, 11
> Dec 2004 16:02:49, seen in news:alt.comp.lang.borland-delphi, Dr John
> Stockton <spam@merlyn.demon.co.uk> posted :
>
>>If the speed of the OP's method (i.e. what he wants to measure) is
>>governed by CPU operations, then he should if possible use the
>>Performance Counter. That's stated to be a count of CPU clock cycles,
>>though I don't know how the API gets hold of that. Results should then
>>be independent of CPU clock rate and drift, within a given CPU
>>technology. But memory access time may also matter.
>>
>
>
> Correction - MH's article reminds me that in the above I was thinking
> about not the performance counter but the RDTSC instruction.
>
>
> TZ_CHECK (c) www.merlyn.demon.co.uk >= 2003-09-12 See Win32 Help
> Test and demonstration of some Win32 Date/Time system routines.
>
> Delphi : Now = 38332.862089 Date = 38332 Time = 0.862089
> It is 2004-12-11 20:41:24 Local MJD (CMJD) = 53350
>
> GetSystemTime : 2004-12-11, Sat @ 20:41:24.460 GMT
> => UNIX seconds count = 1102797684
>
> According to Windows : GTZI = 1 => TIME_ZONE_ID_STANDARD
> Bias = 0 StandardBias = 0 DaylightBias = -60 (minutes)
> At midday GMT, local time is : Winter 12:00 : Summer 13:00
>
> GMT Daylight Time after Month 03, Sun #5 @ 02:00:00.000 civil
> GMT Standard Time after Month 10, Sun #5 @ 03:00:00.000 civil
>
> GMT = 2004-12-11 20:41:24 True (GMT) MJD = 53350 JD = 2453351.362
> UNIX time_t = 1102797684 sec, from 1970-01-01 00:00:00 GMT.
>
> GetTickCount : Since Windows boot = 189081386 ms, 2.188 days.
>
> QueryPerformanceFrequency : 1193180 Hz
> QueryPerformanceCounter = 225574102140 189052.869 s, 2.188 days.
>
> RDTSC : Approximate CPU speed = 301493476 Hz
> CPU cycles 56745525877951, so about 188214.772 s, 2.178 days.
>
>
>
> The result of QueryPerformanceFrequency is, for me, ~14.3 MHz divided by
> 12, and a further division by 65536 gives the 18.2 Hz of the DOS software
> clock.
>
> See also in <URL:http://www.merlyn.demon.co.uk/pas-time.htm> .
>
> Note : my OS has incorrect Summer Time change times.
>
and Dr John, this is all said and good. But is the resolution of the get
tickcount based upon a 1 msec counter or the old 18.2 Hz clock from DOS.

and if this is so. - - - then all of the timing resolutions are based
upon this old DOS timer.

Note Windows is not designed as a real time system. But a desktop OS.

Any call to any Windows resource has un-expected response time - do to
any other messages, processes that are going on.

So no reasonably accurate (Sub mSec timing) is going to be reasonably
accurate. Direct calls to hardware are the only way to be reasonably
accurate - - -

By reasonably accurate, I am talking getting reasonably close to the
crystal accuracy. - - typically 0.1% and thus achive 1% measurement
resolution that has some meaning for many measurements under .1 second -
such as a method or procedure would take.

Now for measurements in the 10 seconds area, windows timing issues are
decreased to the point that they are not a major impact upon final
result. (again Dr John. for timing a procedure or method)

Jim P.



Relevant Pages

  • Re: ASUS Crosshair help
    ... start cranking the CPU clock from 200 to something higher. ... To experiment in Windows, you are in luck. ... The upper slider should control the CPU clock. ... Orthos will run two copies of the Prime95 Torture Test. ...
    (alt.comp.periphs.mainboard.asus)
  • Re: About Power Manager
    ... Depends on the capability of the cpu. ... Power states that affect other devices would be managed by the higher level ... If I move the CPU into idle mode, I will reduce the CPU clock for power s ... Is it OK for reducing CPU clock in the OEMIdle? ...
    (microsoft.public.windowsce.platbuilder)
  • Re: How to tell DP35DP BIOS version before buying CPU?
    ... John Doe;945130 Wrote: ... Jack D Jack.D.277cae1@xxxxxxxxxxxxxxxxxx wrote: ... Did your board have this issue with not supporting your CPU? ... Are you talking about replacing the hardware chip? ...
    (comp.sys.intel)
  • Re: Stolen and degraded time and schedulers
    ... I presume you mean monotonic real time.) ... but I don't think that's terribly useful. ... work_time is probably most naturally measured in cpu clock cycles rather ... In the same way that clock modulation gates the cpu clock, ...
    (Linux-Kernel)
  • Re: Pentium 4 630 Tempatures
    ... John wrote: ... >Curious as to what tempatures I should expect to see for an Intel P4 630 ... >ASUS Probe is reporting what I think is rather high CPU temps ranging ... Zalman 9500 and eight out of ten customers 'claim' that temperatures ...
    (alt.comp.periphs.mainboard.asus)