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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,cae92f92d6a1d4b1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: BrianG Newsgroups: comp.lang.ada Subject: Re: Ada.Execution_Time Date: Thu, 16 Dec 2010 11:49:13 -0500 Organization: A noiseless patient Spider Message-ID: References: <4d05e737$0$6980$9b4e6d93@newsspool4.arcor-online.net> <1wmsukf0wglz3$.odnzonrpayly.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 16 Dec 2010 16:49:18 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="BssHc7ONlcOOcC5Vapr56Q"; logging-data="31393"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197gPJFfFyVWXyZ4vrgrMnh" User-Agent: Thunderbird 2.0.0.24 (X11/20100623) In-Reply-To: <1wmsukf0wglz3$.odnzonrpayly.dlg@40tude.net> Cancel-Lock: sha1:qB2LYXVaGIzGQ4nVfQILvQG2mHY= Xref: g2news1.google.com comp.lang.ada:15983 Date: 2010-12-16T11:49:13-05:00 List-Id: Dmitry A. Kazakov wrote: > On Wed, 15 Dec 2010 16:05:16 -0600, Randy Brukardt wrote: > >> I think you are missing the point of CPU_Time. It is an abstract >> representation of some underlying counter. There is no requirement that this >> counter have any particular value -- in particular it is not necessarily >> zero when a task is created. So the only operations that are meaningful on a >> value of type CPU_Time are comparisons and differences. Arguably, CPU_Time >> is misnamed, because it is *not* some sort of time type. > > Any computer time is a representation of some counter. I think the point is > CPU_Time is not a real time, i.e. a time (actually the process driving the > corresponding counter) related to what people used to call "time" in the > external world. CPU_Time is what is usually called "simulation time." One > could use Duration or Time_Span in place of CPU_Time, but the concern is > that on some architectures, with multiple time sources, this would > introduce an additional inaccuracy. Another argument against it is that > there could be no fair translation from the CPU usage counter to > Duration/Time_Span (which is the case for Windows). > Isn't any "time" related to a computer nothing but a "simulation time"? Yes, some times may be intended to emulate clock-on-the-wall-time, but that doesn't mean they're a very good emulation (ever measure the accuracy of a PC that's not synched to something? You can get a watch free in a box of cereal that's orders of magnitude better.). That's why we have Calendar, Real_Time, and CPU_Time - they're meant to be different things, but they are all "time" in some sense. CPU_Time is obviously an approximation, dependent on the RTS, OS, task scheduler, etc. What's so particularly bad about Windows (aside from the normal Windows things)? Granted, I'm only doing simple prototyping (for non-Windows eventual use), but it seems a "fair" approximation. When I added a 1-second loop doing nonsense work (to get any measured value), it reads about 1 second, within about 5% (which is at least as good as I would have expected, given the 'normal' jitter on Delay). --BrianG