comp.lang.ada
 help / color / mirror / Atom feed
From: anon@att.net
Subject: Re: An Example for Ada.Execution_Time
Date: Tue, 28 Dec 2010 13:43:57 +0000 (UTC)
Date: 2010-12-28T13:43:57+00:00	[thread overview]
Message-ID: <ifcpir$1eoq$1@news.ett.com.ua> (raw)
In-Reply-To: ifbi5c$rqt$1@news.eternal-september.org

In <ifbi5c$rqt$1@news.eternal-september.org>, BrianG <briang000@gmail.com> writes:
>anon@att.net wrote:
>> You ask for an example.
>I'll assume I am the "you".  (Since you don't specify and didn't relate 
>it to the original thread.)
>
>I asked for:
>    >> An algorithm comparison program might look like:
>    >>
>    >> with Ada.Execution_Time ;
>    >> with Ada.Execution_Time.Timers ;
>    >Given the below program, please add some of the missing details to
>    >show how this can be useful without also "with Ada.Real_Time".
>    >Neither Execution_Time or Execution_Time.Timers provides any value
>    >that can be used directly.
>    >
>    >>
>    >> procedure Compare_Algorithm is
>    >...]
>
>You provided:
>> 
>> Here is an example for packages (Tested using MaRTE):
>....
>> with Ada.Execution_Time ;
>> with Ada.Real_Time ;
>....
>> with Ada.Execution_Time ;
>> with Ada.Execution_Time.Timers ;
>> with Ada.Real_Time ;
>....
>
>As the extracts show, you could not do what I asked for.  You said in 
>the original post you could do it with only the 2 Execution_Time 
>'with's.  My entire point in this thread is that Execution_Time, as 
>defined, is useless by itself.
>
>--BrianG

I changed the title so there was no need for reference lines

Since 2006, a number of people have ask about Ada.Execution_Time package 
and no one has given a true example that uses that package for what it was 
created for. Until now! I gave you a simple example that can be easily 
modified to a more complex program. Problem: may be whats the maximum 
number of timers that can be allocated.


and for your info (changes in work.adb)

  Task_0 : Work_Task ;
  Task_1 : Work_Task ;
  Task_2 : Work_Task ;
  Task_3 : Work_Task ;

begin
  Initialize ( Work_Algorithm'Access ) ;
  Task_0.Start ( False ) ;
  Task_1.Start ( False ) ;
  Task_2.Start ( True ) ;  -- just for a change
  Task_3.Start ( True ) ;
  ...

will gives four tasks with four different timers. 

     2 timers that have the same interval 
     2 timers that changes the interval

All that is needed is protect the Counter variable for each task and change the 
Counter print routine. And I will let others do that modification.





  reply	other threads:[~2010-12-28 13:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-27 18:26 An Example for Ada.Execution_Time anon
2010-12-28  2:31 ` BrianG
2010-12-28 13:43   ` anon [this message]
2010-12-29  3:10   ` Randy Brukardt
2010-12-30 23:51     ` BrianG
2010-12-31  9:11       ` Dmitry A. Kazakov
2010-12-31 12:42         ` Niklas Holsti
2010-12-31 14:15           ` Dmitry A. Kazakov
2010-12-31 18:57             ` Niklas Holsti
2011-01-01 13:39               ` Dmitry A. Kazakov
2011-01-01 20:25                 ` Niklas Holsti
2011-01-03  8:50                   ` Dmitry A. Kazakov
2010-12-31 13:05         ` Simon Wright
2010-12-31 14:14           ` Dmitry A. Kazakov
2010-12-31 14:24           ` Robert A Duff
2010-12-31 22:40           ` Simon Wright
2011-01-01  0:07       ` Randy Brukardt
replies disabled

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