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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,36a9f38dd6514fc8 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!aioe.org!nospam From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: gnat: Execution_Time is not supported in this configuration Date: Fri, 04 Dec 2009 16:50:01 -0500 Organization: The Wasteland Message-ID: References: <5e5d6fb5-e719-4195-925c-d1286699393d@f16g2000yqm.googlegroups.com> <1wjhklygzok25.t79koxbbtlcj$.dlg@40tude.net> NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.0 Cancel-Lock: sha1:vqVuISt48TXLU/OtHtAJaTQ/M5o= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news1.google.com comp.lang.ada:8310 Date: 2009-12-04T16:50:01-05:00 List-Id: In article <1wjhklygzok25.t79koxbbtlcj$.dlg@40tude.net>, "Dmitry A. Kazakov" wrote: > On Fri, 04 Dec 2009 13:28:24 -0500, John B. Matthews wrote: > > > In article > > <5e5d6fb5-e719-4195-925c-d1286699393d@f16g2000yqm.googlegroups.com>, > > singo wrote: > > [...] > > I defer to Dmitry A. Kazakov about Windows, but this variation > > produces similar results on MacOS 10.5 & Ubuntu 9.10 using GNAT > > 4.3.4: > > > > > > with Ada.Text_IO; use Ada.Text_IO; > > with Ada.Real_Time; use Ada.Real_Time; > > > > procedure ExecutionTime is > > task T; > > > > task body T is > > Start : Time := Clock; > > Interval : Time_Span := Milliseconds(100); > > begin > > loop > > Put_Line(Duration'Image(To_Duration(Clock - Start))); > > delay To_Duration(Interval); > > end loop; > > end T; > > begin > > null; > > end ExecutionTime; > > > > > > > > $ ./executiontime > > 0.000008000 > > 0.100168000 > > 0.200289000 > > 0.300409000 > > 0.400527000 > > 0.500575000 > > ... > > > > Your code counts the wall clock time. On the contrary > Ada.Execution_Time should do the task time, i.e. the time the task > actually owned the processor or, maybe, the time the system did > something on the task's behalf. Ah, thank you for clarifying this. Indeed, one sees the secular growth in the output as overhead accumulates. I meant to suggest that other parts of Annex D may be supported on a particular platform, even if Ada.Execution_Time is not. > This package heavily depends on the OS services at least when the > tasks are mapped onto the OS scheduling items (like threads). > > As far as I know it is impossible to implement it reasonably under > Windows, because the corresponding service (used by the Task Manager > too) counts time quants instead of the time. This causes a massive > systematic error if tasks are switched before they consume their > quants. I.e. *always* when you do I/O or communicate to other tasks. > The bottom line, under Windows Ada.Execution_Time can be used only > for tasks that do lengthy computations interrupted by only by the > scheduler, so that all counted quants were consumed and no time were > spent in uncounted quants. > > I don't know, if or how, this works under Linux or Max OS. I should have mentioned that both systems specify "pragma Unimplemented_Unit" in Ada.Execution_Time. On Mac OS X 10.5, Ada.Real_Time.Time_Span_Unit is 0.000000001, but I'm unaware of a Mac clock having better that microsecond resolution, as suggested in the output above. I'm running Linux in VirtualBox, so I suspect any results reflect the host OS more than anything else. -- John B. Matthews trashgod at gmail dot com