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: a07f3367d7,36a9f38dd6514fc8 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!feeder.ecngs.de!ecngs!feeder2.ecngs.de!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: gnat: Execution_Time is not supported in this configuration 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: <5e5d6fb5-e719-4195-925c-d1286699393d@f16g2000yqm.googlegroups.com> Date: Fri, 4 Dec 2009 20:01:57 +0100 Message-ID: <1wjhklygzok25.t79koxbbtlcj$.dlg@40tude.net> NNTP-Posting-Date: 04 Dec 2009 20:01:58 CET NNTP-Posting-Host: 81622907.newsspool1.arcor-online.net X-Trace: DXC=gjaA;@mg63[\PS5Xo=M[RVic==]BZ:af^4Fo<]lROoRQ<`=YMgDjhgR3?5O9i]8UA_[6LHn;2LCV^[XinDQ=5;jOVX X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:8309 Date: 2009-12-04T20:01:58+01:00 List-Id: 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 have recently become very interested of Ada 2005, and it's >> real-time annex. However, as a new user of Ada I face some problems >> with the software. >> >> I cannot get the package Ada.Execution_Time to work with gnat, >> although the gnat documentation says that the real-time annex is >> fully supported... I use the gnat version 4.4 on a Ubuntu 9.10 >> distribution. >> >> The typical error message I get is >> >> gcc -c executiontime.adb >> Execution_Time is not supported in this configuration >> compilation abandoned > > Georg Bauhaus has helpfully referred you to comments in > Ada.Execution_Time. > >> How can I configure gnat to support the Ada.Execution_Time package? > > 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. 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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de