comp.lang.ada
 help / color / mirror / Atom feed
* gnat: Execution_Time is not supported in this configuration
@ 2009-12-04 11:09 singo
  2009-12-04 11:26 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: singo @ 2009-12-04 11:09 UTC (permalink / raw)


Dear Ada community,

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

How can I configure gnat to support the Ada.Execution_Time package?

Hopefully somebody can help me!

Thanks in advance!

Ingo

Below follows an example program that generates the error messge.

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Real_Time; use Ada.Real_Time;
with Ada.Execution_Time;

procedure ExecutionTime is
   task T;

   task body T is
      Start : CPU_Time;
      Interval : Time_Span := Milliseconds(100);
   begin
      Start := Ada.Execution_Time.Clock;
      loop
         Put_Line(Duration'Image(Ada.Execution_Time.Clock - Start));
         delay To_Duration(Interval);
      end loop;
   end T;
begin
   null;
end ExecutionTime;




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat: Execution_Time is not supported in this configuration
  2009-12-04 11:09 gnat: Execution_Time is not supported in this configuration singo
@ 2009-12-04 11:26 ` Dmitry A. Kazakov
  2009-12-04 12:10 ` Georg Bauhaus
  2009-12-04 18:28 ` John B. Matthews
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry A. Kazakov @ 2009-12-04 11:26 UTC (permalink / raw)


On Fri, 4 Dec 2009 03:09:35 -0800 (PST), 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
> 
> How can I configure gnat to support the Ada.Execution_Time package?
> 
> Hopefully somebody can help me!
> 
> Thanks in advance!
> 
> Ingo
> 
> Below follows an example program that generates the error messge.
> 
> with Ada.Text_IO; use Ada.Text_IO;
> with Ada.Real_Time; use Ada.Real_Time;
> with Ada.Execution_Time;
> 
> procedure ExecutionTime is
>    task T;
> 
>    task body T is
>       Start : CPU_Time;
>       Interval : Time_Span := Milliseconds(100);
>    begin
>       Start := Ada.Execution_Time.Clock;
>       loop
>          Put_Line(Duration'Image(Ada.Execution_Time.Clock - Start));
>          delay To_Duration(Interval);
>       end loop;
>    end T;
> begin
>    null;
> end ExecutionTime;

I cannot tell anything about Ubuntu, but the program you provided contains
language errors.

It also has the problem that "delay" is non busy in Ada, i.e. the program
will count 0 CPU time for a very long time, at least under Windows, where
the system services, which I presume, Ada.Execution_Time relies on, are
broken.

Anyway, here is the code which works to me:

with Ada.Text_IO;         use Ada.Text_IO;
with Ada.Real_Time;       use Ada.Real_Time;
with Ada.Execution_Time;  use Ada.Execution_Time;

procedure ExecutionTime is
   task T;
   task body T is
      Start : CPU_Time := Clock;
   begin
      loop
         Put_Line (Duration'Image (To_Duration (Clock - Start)));
         for I in 1..40 loop
            Put ("."); -- This does something!
         end loop;
      end loop;
   end T;
begin
   null;
end ExecutionTime;

Under Windows this shows rather poor performance, which again is not
surprising, because as I said there is no way to implement
Ada.Execution_Time under Windows.

Maybe Linux counts CPU time better, I never investigated this issue.

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat: Execution_Time is not supported in this configuration
  2009-12-04 11:09 gnat: Execution_Time is not supported in this configuration singo
  2009-12-04 11:26 ` Dmitry A. Kazakov
@ 2009-12-04 12:10 ` Georg Bauhaus
  2009-12-07  8:08   ` singo
  2009-12-04 18:28 ` John B. Matthews
  2 siblings, 1 reply; 9+ messages in thread
From: Georg Bauhaus @ 2009-12-04 12:10 UTC (permalink / raw)


singo schrieb:

> 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 reason are explained in the GNAT source files.  The ones I have show
a note, after the � box:
------------------------------------------------------------------------------
--                                                                          --
--                         GNAT RUN-TIME COMPONENTS                         --
--                                                                          --
--                   A D A . E X E C U T I O N _ T I M E                    --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT.  In accordance with the copyright of that document, you can freely --
-- copy and modify this specification,  provided that if you redistribute a --
-- modified version,  any changes that you have made are clearly indicated. --
--                                                                          --
------------------------------------------------------------------------------

--  This unit is not implemented in typical GNAT implementations that lie on
--  top of operating systems, because it is infeasible to implement in such
--  environments.

--  If a target environment provides appropriate support for this package
--  then the Unimplemented_Unit pragma should be removed from this spec and
--  an appropriate body provided.

with Ada.Task_Identification;
with Ada.Real_Time;

package Ada.Execution_Time is
   pragma Preelaborate;

   pragma Unimplemented_Unit;





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat: Execution_Time is not supported in this configuration
  2009-12-04 11:09 gnat: Execution_Time is not supported in this configuration singo
  2009-12-04 11:26 ` Dmitry A. Kazakov
  2009-12-04 12:10 ` Georg Bauhaus
@ 2009-12-04 18:28 ` John B. Matthews
  2009-12-04 19:01   ` Dmitry A. Kazakov
  2 siblings, 1 reply; 9+ messages in thread
From: John B. Matthews @ 2009-12-04 18:28 UTC (permalink / raw)


In article 
<5e5d6fb5-e719-4195-925c-d1286699393d@f16g2000yqm.googlegroups.com>,
 singo <sander.ingo@gmail.com> 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:

<code>
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;
</code>

<console>
$ ./executiontime 
 0.000008000
 0.100168000
 0.200289000
 0.300409000
 0.400527000
 0.500575000
...
</console>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat: Execution_Time is not supported in this configuration
  2009-12-04 18:28 ` John B. Matthews
@ 2009-12-04 19:01   ` Dmitry A. Kazakov
  2009-12-04 21:50     ` John B. Matthews
  2009-12-05  2:59     ` Randy Brukardt
  0 siblings, 2 replies; 9+ messages in thread
From: Dmitry A. Kazakov @ 2009-12-04 19:01 UTC (permalink / raw)


On Fri, 04 Dec 2009 13:28:24 -0500, John B. Matthews wrote:

> In article 
> <5e5d6fb5-e719-4195-925c-d1286699393d@f16g2000yqm.googlegroups.com>,
>  singo <sander.ingo@gmail.com> 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:
> 
> <code>
> 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;
> </code>
> 
> <console>
> $ ./executiontime 
>  0.000008000
>  0.100168000
>  0.200289000
>  0.300409000
>  0.400527000
>  0.500575000
> ...
> </console>

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat: Execution_Time is not supported in this configuration
  2009-12-04 19:01   ` Dmitry A. Kazakov
@ 2009-12-04 21:50     ` John B. Matthews
  2009-12-05  2:59     ` Randy Brukardt
  1 sibling, 0 replies; 9+ messages in thread
From: John B. Matthews @ 2009-12-04 21:50 UTC (permalink / raw)


In article <1wjhklygzok25.t79koxbbtlcj$.dlg@40tude.net>,
 "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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 <sander.ingo@gmail.com> 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:
> > 
> > <code>
> > 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;
> > </code>
> > 
> > <console>
> > $ ./executiontime 
> >  0.000008000
> >  0.100168000
> >  0.200289000
> >  0.300409000
> >  0.400527000
> >  0.500575000
> > ...
> > </console>
> 
> 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
<http://sites.google.com/site/drjohnbmatthews>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat: Execution_Time is not supported in this configuration
  2009-12-04 19:01   ` Dmitry A. Kazakov
  2009-12-04 21:50     ` John B. Matthews
@ 2009-12-05  2:59     ` Randy Brukardt
  1 sibling, 0 replies; 9+ messages in thread
From: Randy Brukardt @ 2009-12-05  2:59 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:1wjhklygzok25.t79koxbbtlcj$.dlg@40tude.net...
...
> 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.

Obviously this depends on the purpose. For many profiling tasks, the Windows 
implementation is just fine. The quants seem to be short enough that most 
tasks run long enough to be counted. (And I/O has probably already be 
reduced to the minimum before even applying a profiler, if not, you're 
probably profiling the I/O first, not the CPU.) But I would have to agree 
that it isn't all that real-time.

In any case, thanks for the clear explanation of the limitations of the 
Windows services. I'm sure that I'll run into them sooner or later and I'll 
hopefully remember your explanation.

                                   Randy.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat: Execution_Time is not supported in this configuration
  2009-12-04 12:10 ` Georg Bauhaus
@ 2009-12-07  8:08   ` singo
  2009-12-07 17:13     ` John B. Matthews
  0 siblings, 1 reply; 9+ messages in thread
From: singo @ 2009-12-07  8:08 UTC (permalink / raw)


On Dec 4, 1:10 pm, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:

> The reason are explained in the GNAT source files.  The ones I have show
> a note, after the © box:
> ------------------------------------------------------------------------------
> --                                                                          --
> --                         GNAT RUN-TIME COMPONENTS                         --
> --                                                                          --
> --                   A D A . E X E C U T I O N _ T I M E                    --
> --                                                                          --
> --                                 S p e c                                  --
> --                                                                          --
> -- This specification is derived from the Ada Reference Manual for use with --
> -- GNAT.  In accordance with the copyright of that document, you can freely --
> -- copy and modify this specification,  provided that if you redistribute a --
> -- modified version,  any changes that you have made are clearly indicated. --
> --                                                                          --
> ------------------------------------------------------------------------------
>
> --  This unit is not implemented in typical GNAT implementations that lie on
> --  top of operating systems, because it is infeasible to implement in such
> --  environments.
>
> --  If a target environment provides appropriate support for this package
> --  then the Unimplemented_Unit pragma should be removed from this spec and
> --  an appropriate body provided.
>
> with Ada.Task_Identification;
> with Ada.Real_Time;
>
> package Ada.Execution_Time is
>    pragma Preelaborate;
>
>    pragma Unimplemented_Unit;

Thanks to all of you for your help!

Still I wonder why it is written in the GNAT reference specification
that the real time annex is fully implemented [1].

"Real-Time Systems (Annex D) The Real-Time Systems Annex is fully
implemented."

According to the ARM 'Execution Time' is part of the real-time annex
[2], so it should be implemented.

So, does "fully implemented" mean that it only in principle is fully
implemented, but that the underlying OS/hardware (in my case 64-bit
Ubuntu-Linux (9.10) on an Intel QuadCore) has to support this features
as well?

Or how do I have to read "fully implemented"?

Best regards

Ingo

[1] http://gcc.gnu.org/onlinedocs/gnat_rm/Specialized-Needs-Annexes.html#Specialized-Needs-Annexes
[2] http://www.adaic.org/standards/05rm/html/RM-D-14.html




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat: Execution_Time is not supported in this configuration
  2009-12-07  8:08   ` singo
@ 2009-12-07 17:13     ` John B. Matthews
  0 siblings, 0 replies; 9+ messages in thread
From: John B. Matthews @ 2009-12-07 17:13 UTC (permalink / raw)


In article 
<213be370-c1da-4d5b-89c4-cd30ad6aef18@e20g2000vbb.googlegroups.com>,
 singo <sander.ingo@gmail.com> wrote:

> On Dec 4, 1:10 pm, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
> wrote:
> 
> > The reason are explained in the GNAT source files...
> > --  This unit is not implemented in typical GNAT implementations 
> > --  that lie on top of operating systems, because it is infeasible 
> > --  to implement in such environments.
> >
> > --  If a target environment provides appropriate support for this 
> > --  package then the Unimplemented_Unit pragma should be removed
> > --  from this spec and an appropriate body provided.
[...]
> Or how do I have to read "fully implemented"?

I'm guessing "fully implemented" on supported platforms and "not 
required in all implementations [1]." GNAT actually meets the 
implementation and documentation requirements [2]. My OS simply doesn't 
have the required facilities; it's designed for a GUI user, not 
real-time. If I were cross-developing, I'd perhaps create a fake body. 
On Linux, it might be possible to get something relatively informative 
out of /proc/<PID>/task/<TID>/stat.
 
[1]<http://gcc.gnu.org/onlinedocs/gnat_rm/Specialized-Needs-Annexes.html#
Specialized-Needs-Annexes>
[2]<http://www.adaic.org/standards/05rm/html/RM-D-14.html>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-12-07 17:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-04 11:09 gnat: Execution_Time is not supported in this configuration singo
2009-12-04 11:26 ` Dmitry A. Kazakov
2009-12-04 12:10 ` Georg Bauhaus
2009-12-07  8:08   ` singo
2009-12-07 17:13     ` John B. Matthews
2009-12-04 18:28 ` John B. Matthews
2009-12-04 19:01   ` Dmitry A. Kazakov
2009-12-04 21:50     ` John B. Matthews
2009-12-05  2:59     ` Randy Brukardt

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