comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: accuracy
Date: Sat, 10 Mar 2007 10:11:19 +0100
Date: 2007-03-10T10:11:03+01:00	[thread overview]
Message-ID: <r5rrsmngabou$.nc73hmyyugax.dlg@40tude.net> (raw)
In-Reply-To: est25a$ul7$1@jacob-sparre.dk

On Fri, 9 Mar 2007 19:39:30 -0600, Randy Brukardt wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:p87mtsns4of0.hhld0y03415s.dlg@40tude.net...
> ...
>> As for GetThreadTimes, its absolute precision is 1ms.
> 
> No, it is 10ms. The interface offers more precision than is actually
> provided.

You can force it to 1ms using

   timeBeginPeriod (1);

This what any tasking Ada program should not forget do, when it starts
under Windows. I hope that GNAT RTL does this...

(I am too lazy to check it, but probably XP already has 1ms as the default)

>> Its suggested
>> absolute accuracy should be one time quant (which duration depends on the
>> system settings). The later does not hold, because the error is in fact not
>> bounded.
> 
> I believe that the function was intended for profiling and performance
> monitoring, and it surely is not different than any other technique I've
> ever seen used for that. All such techniques give you a statistical
> approximation to the real behavior. You just have to run them long enough to
> make the results statistically significant.

(under the condition that the error mean is 0, which unfortunately is not
the case)

> It's theoretically possible for a thread to run in sync so that it never
> gets a tick, but I've never seen (or heard of) an instance of that happening
> in a real program being profiled. On a real DOS or Windows system, there is
> too much asynchronous going on for any "lock-step" to continue for long.

Which theoretical case hit me. We performed a QoS studio of our distributed
middleware and wished to measure the time its services require for
publishing and subscribing, separately from delivery times. To our
amazement times of some services were solid 0, no matter how long and how
many cycles we run the test! I started to investigate and discovered that
mess.

> In any case, it is statistical analysis that has to be applied here; it's
> clear that the error can be reduced by lengthening the runtime (presuming
> that you are willing to assume, as I am, that behavior is essentially random
> if looked at over a long enough time period).

(plus some assumption about the error mean. Otherwise the averaged result
can be any.)

> OTOH, I don't want to use Ada.Execution_Times to control a program's
> behavior. (I think that's a bit dubious, given that a hardware change would
> invalidate the assumptions, and typically the important thing is the
> response time: which depends on the wall-time, not the CPU time. But a
> self-contained embedded system has more control than a program running on
> Windows, so it might make sense somewhere.)

I believe there are logical/philosophical reasons why a program shall not
change its behavior depending on its ... behaviour. (:-))

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2007-03-10  9:11 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 11:57 Does Ada tasking profit from multi-core cpus? Gerd
2007-01-29 12:04 ` Georg Bauhaus
2007-01-30 13:55   ` Gerd
2007-02-09 10:18     ` karl
2007-02-09 11:03       ` Stefan Lucks
2007-02-09 11:35         ` Ludovic Brenta
2007-03-04 17:54 `   jpluto
2007-03-05 10:08   ` Ludovic Brenta
2007-03-05 13:12     ` Dmitry A. Kazakov
2007-03-06  5:33       ` tmoran
2007-03-06  8:44         ` Dmitry A. Kazakov
2007-03-07  7:52           ` tmoran
2007-03-07  9:31           ` tmoran
2007-03-06  9:40         ` Colin Paul Gloster
2007-03-06 12:47           ` Jeffrey Creem
2007-03-06 14:44           ` Georg Bauhaus
2007-03-06 16:53         ` Dr. Adrian Wrigley
2007-03-06 18:58           ` tmoran
2007-03-07 10:11             ` Colin Paul Gloster
2007-03-07 18:47               ` tmoran
2007-03-06 18:51         ` Jeffrey R. Carter
2007-03-16 14:29           ` Arguments for single-mutex-exclusion on protected types (Was: Does Ada tasking profit from multi-core cpus?) Jacob Sparre Andersen
2007-03-17  5:26             ` Jeffrey R. Carter
2007-03-17 17:22               ` Robert A Duff
2007-03-17 17:52                 ` Jeffrey R. Carter
2007-03-17 23:06                 ` Randy Brukardt
2007-03-18 17:57                   ` Robert A Duff
2007-03-19 21:49                     ` Randy Brukardt
2007-03-20  0:55                       ` Jeffrey R. Carter
2007-03-20  1:36                         ` Randy Brukardt
2007-03-20 16:32                           ` Jeffrey R. Carter
2007-03-20 17:51                             ` Randy Brukardt
2007-03-21  0:10                               ` Jeffrey R. Carter
2007-03-26 23:38                               ` Robert A Duff
2007-03-26 23:24                           ` Robert A Duff
2007-03-17 10:25             ` Dmitry A. Kazakov
2007-03-18 17:15               ` Arguments for single-mutex-exclusion on protected types Jacob Sparre Andersen
2007-03-18 18:50                 ` Dmitry A. Kazakov
2007-03-20 12:38                 ` Florian Weimer
2007-03-07  3:58       ` Does Ada tasking profit from multi-core cpus? Steve
2007-03-07  8:39         ` Dmitry A. Kazakov
2007-03-08  5:21           ` Randy Brukardt
2007-03-08 10:15             ` Dmitry A. Kazakov
2007-03-08 21:18               ` accuracy (was: Does Ada tasking profit from multi-core cpus?) Björn Persson
2007-03-09  8:33                 ` accuracy Dmitry A. Kazakov
2007-03-10  1:39                   ` accuracy Randy Brukardt
2007-03-10  9:11                     ` Dmitry A. Kazakov [this message]
2007-03-11  3:03                       ` accuracy Randy Brukardt
2007-03-11  5:21                         ` accuracy tmoran
2007-03-11  8:52                         ` accuracy Dmitry A. Kazakov
2007-03-11 13:57                           ` accuracy Pascal Obry
2007-03-11 14:16                             ` accuracy Dmitry A. Kazakov
2007-03-11 14:37                               ` accuracy Pascal Obry
2007-03-11 15:50                                 ` accuracy Dmitry A. Kazakov
2007-03-11 17:38                                   ` accuracy Pascal Obry
2007-03-11 18:48                                     ` accuracy Dmitry A. Kazakov
2007-03-12 20:20                           ` accuracy Randy Brukardt
2007-03-13  9:33                             ` accuracy Dmitry A. Kazakov
2007-03-10 14:53                     ` accuracy Stephen Leake
2007-03-10 18:36                       ` accuracy Cesar Rabak
2007-03-05 18:46   ` Does Ada tasking profit from multi-core cpus? Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox