From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e81fd3a32a1cacd2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.germany.com!news.teledata-fn.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: accuracy Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1170071840.010200.85210@s48g2000cws.googlegroups.com> <1173089302.125025.31370@t69g2000cwt.googlegroups.com> <0dmdnZIAd76ZpXPYnZ2dnUVZ_uCinZ2d@comcast.com> <1lq9zxgrnvfjx$.17ip3w3ei4xdb.dlg@40tude.net> <1lo7kf2cw2mog$.94hkrwmeyhqy.dlg@40tude.net> <45F40AE4.1070409@obry.net> <14hwwwwjy8mo$.nmkehs8w9zms$.dlg@40tude.net> <45F4140F.5000405@obry.net> <45F43EB2.2000008@obry.net> Date: Sun, 11 Mar 2007 19:48:47 +0100 Message-ID: <13jii9xnaiqlo$.19jaujlvtume6$.dlg@40tude.net> NNTP-Posting-Date: 11 Mar 2007 19:48:47 CET NNTP-Posting-Host: 40cde5b2.newsspool4.arcor-online.net X-Trace: DXC=MD[VTMcoFkog`45cDR8l?o4IUKoDNcfSJ;bb[eIRnRBaCd On Sun, 11 Mar 2007 18:38:58 +0100, Pascal Obry wrote: >> I.e. it does this only once. The potential problems with this is that: > > No it is not does once but each time a clock is requested for adjustment > if needed. You mean each time Clock is called? That would be a very expensive implementation. A periodic task would be less demanding. But ideally it should be something sitting close to the PCI bus. >> 1. The accuracy of GetSystemTimeAsFileTime is very low. > > Yes but it is not used for final clock returned value. How so? Ada.Calendar has Split and Time_Of. Any error in GetSystemTimeAsFileTime will show itself there, if not compensated using some digital filtering technique. >> 2. All system calls have non-zero latencies. >> >> 3. There is a chance that the thread will be preempted between querying the >> counter and calling to a system time query, which would additionally >> increase the experienced latency up to milliseconds. > > During initialization of the runtime the performance counter and the > system time are read until this is done during a minimal amount of time. > This gives the base reference for the performance counter and the os time. I am lost you here. My interpretation of what you wrote above is that the factor and offset between the readings of performance counter and GetSystemTimeAsFileTime is readjusted each time Clock is called. Anyway there are so many issues when reading from any clock sources, which could prevent you from getting good measurements at once, like bus load, interrupts, preempting etc. Also when the source of GetSystemTimeAsFileTime is ticks, it could have systematic digitization error (1-2ms), which cannot be compensated quickly. > If this is still unclear have a look at the corresponding implementation > in the GNAT sources. That is what I am trying to avoid... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de