comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada.Execution_Time
Date: Sat, 01 Jan 2011 15:52:45 +0200
Date: 2011-01-01T15:52:45+02:00	[thread overview]
Message-ID: <8o8ptdF35oU1@mid.individual.net> (raw)
In-Reply-To: <iflpa6$pp0$1@munin.nbi.dk>

Randy Brukardt wrote:
> I think we're actually in agreement on most points.

Good, and I agree. Nevertheless I again make a lot of comments, below, 
because I think your view, if true, means that Ada.Execution_Time is 
useless for real-time systems.

> The main difference is 
> that I contend that the theoretical "execution time" is, in actual practice, 
> unmeasurable. ("Unmeasurable" is a bit strong, but I mean that you can only 
> get a gross estimation of it.)

You are right, we disagree on this.

> You have argued that there exist cases where it is possible to do better (a 
> hardware clock, a single processor, a kernel that doesn't get in the way of 
> using the hardware clock,

Yes.

> no contention with other devices on the bus, etc.),

I may have been fuzzy on that. Such real but variable or unpredictable 
delays or speed-ups are, in my view, just normal parts of the execution 
time of the affected task, and do not harm the ideal concept of "the 
execution time of a task" nor the usefulness of Ada.Execution_Time and 
its child packages. They only mean that the measured execution time of 
one particular execution of a task is less predictive of the execution 
times of future executions of that task. More on this below.

> and I wouldn't disagree. The problem is that those cases aren't 
> realistic, particularly if you are talking about a language-defined package. 

I am not proposing new general requirements on timing accuracy for the RM.

> (Even if there is a hardware clock available on a particular target, an 
> off-the-shelf compiler isn't going to be able to use it. It can only use the 
> facilities of the kernel or OS.)

For critical, embedded, hard-real-time systems I think it is not 
uncommon to use dedicated real-time computers with kernels such as 
VxWorks or RTEMS or bare-board Ada run-time systems. I have worked on 
such computers in the past, and I see such computers being advertised 
and used today.

In such systems, the kernel or Ada RTS is usually customised by a "board 
support package" (BSP) that, among other things, handles the interfaces 
to clocks and timers on the target computer (the "board"). Such systems 
can provide high-accuracy timers and mechanisms for execution-time 
monitoring without having to change the compiler; it should be enough to 
change the implementation of Ada.Execution_Time. In effect, 
Ada.Execution_Time would be a part of the BSP, or depend on types and 
services defined in the BSP.

The question is then if the compiler/system vendors will take the 
trouble and cost to customise Ada.Execution_Time for a particular 
board/computer, or if they will just use the general, lowest-denominator 
but portable service provided by the kernel. Dmitry indicates that GNAT 
on VxWorks takes the latter, easy way out. That's a matter of cost vs 
demand; if the users want it, the vendors can provide it.

For example, the "CPU Usage Statistics" section of the "RTEMS C User's 
Guide" says: "RTEMS versions newer than the 4.7 release series, support 
the ability to obtain timestamps with nanosecond granularity if the BSP 
provides support. It is a desirable enhancement to change the way the 
usage data is gathered to take advantage of this recently added 
capability. Please consider sponsoring the core RTEMS development team 
to add this capability." Thus, in March 2010 the RTEMS developers wanted 
and could implement accurate execution-time measurement, but no customer 
had yet paid for its implementation.

> This shows up when you talk about the inability to reproduce the results. In 
> practice, I think you'll find that the values vary a lot from run to run; 
> the net effect is that the error is a large percentage of the results for 
> many values.

Again, I may have not have been clear on my view of the reproducibility 
and variability of execution-time measurements. The variability in the 
measured execution time of a task has three components or sources:

1. Variable execution paths due to data-dependent conditional 
control-flow (if-then-else, case, loop). In other words, on different 
executions of the task, different sequences of instructions are 
executed, leading to different execution times.

2. Variable execution times of indivual instructions, for example due to 
variable cache contents and variable bus contention.

3. Variable measurement errors, for example truncations or roundings in 
the count of CPU_Time clock cycles, variable amount of interrupt 
handling included in the task execution time, etc.

Components 1 and 2 are big problems for worst-case analysis but in my 
view are not problems for Ada.Execution_Time. In fact, I think that one 
of the intended uses of Ada.Execution_Time is to help systems make good 
use of this execution-time variability by letting the system do other 
useful things when some task happens to execute quicker than its 
worst-case execution time and leaves some slack in the schedule.

Only component 3 is an "error" in the measured value. This component, 
and also constant measurement errors if any, are problems for users of 
Ada.Execution_Time.

> Your discussion of real-time scheduling using this still seems to me to be 
> more in the realm of academic exercise than something practical. I'm sure 
> that it works in very limited circumstances,

I think these circumstances have some correlation with the domain for 
which Ada is or was intended: reliable, embedded, possibly real-time 
systems. Well, this is a limited niche.

> but those circumstances are 
> getting less and less likely by the year. Techniques that assume a strong 
> correspondence between these values and real-time are simply fantasy -- I 
> would hope no one depend on these for anything of importance.

If this is true, Ada.Execution_Time is useless for real-time systems. 
Since it was added to the RM for 2005, and is still in the draft for RM 
2012, I suppose the ARG majority does not share your view.

Thanks for a frank discussion, and best wishes for 2011!

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  reply	other threads:[~2011-01-01 13:52 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-12  4:19 Ada.Execution_Time BrianG
2010-12-12  5:27 ` Ada.Execution_Time Jeffrey Carter
2010-12-12 16:56 ` Ada.Execution_Time Jeffrey Carter
2010-12-12 21:59   ` Ada.Execution_Time BrianG
2010-12-12 22:08     ` Ada.Execution_Time BrianG
2010-12-13  9:28     ` Ada.Execution_Time Georg Bauhaus
2010-12-13 22:25       ` Ada.Execution_Time Randy Brukardt
2010-12-13 22:42         ` Ada.Execution_Time J-P. Rosen
2010-12-14  3:31         ` Ada.Execution_Time Jeffrey Carter
2010-12-14 15:42           ` Ada.Execution_Time Robert A Duff
2010-12-14 16:17             ` Ada.Execution_Time Jeffrey Carter
2010-12-14 19:10             ` Ada.Execution_Time Warren
2010-12-14 20:36               ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-14 20:48                 ` Ada.Execution_Time Jeffrey Carter
2010-12-14  8:17         ` Ada.Execution_Time Vinzent Hoefler
2010-12-14 15:51           ` Ada.Execution_Time Adam Beneschan
2010-12-14 15:53           ` Ada.Execution_Time Robert A Duff
2010-12-14 17:17             ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-14 17:45               ` Ada.Execution_Time Robert A Duff
2010-12-14 18:23                 ` Ada.Execution_Time Adam Beneschan
2010-12-14 21:02                   ` Ada.Execution_Time Randy Brukardt
2010-12-15 22:52             ` Ada.Execution_Time Keith Thompson
2010-12-15 23:14               ` Ada.Execution_Time Adam Beneschan
2010-12-17  0:44                 ` Ada.Execution_Time Randy Brukardt
2010-12-17 17:54                   ` Ada.Execution_Time Warren
2010-12-20 21:28                   ` Ada.Execution_Time Keith Thompson
2010-12-21  3:23                     ` Ada.Execution_Time Robert A Duff
2010-12-21  8:04                       ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-21 17:19                         ` Ada.Execution_Time Robert A Duff
2010-12-21 17:43                           ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-14 19:43           ` Ada.Execution_Time anon
2010-12-14 20:09             ` Ada.Execution_Time Adam Beneschan
2010-12-15  0:16       ` Ada.Execution_Time BrianG
2010-12-15 19:17         ` Ada.Execution_Time jpwoodruff
2010-12-15 21:42           ` Ada.Execution_Time Pascal Obry
2010-12-16  3:54             ` Ada.Execution_Time jpwoodruff
2010-12-17  7:11               ` Ada.Execution_Time Stephen Leake
2010-12-15 21:40         ` Ada.Execution_Time Simon Wright
2010-12-15 23:40           ` Ada.Execution_Time BrianG
2010-12-15 22:05         ` Ada.Execution_Time Randy Brukardt
2010-12-16  1:14           ` Ada.Execution_Time BrianG
2010-12-16  5:46             ` Ada.Execution_Time Jeffrey Carter
2010-12-16 16:13               ` Ada.Execution_Time BrianG
2010-12-16 11:37             ` Ada.Execution_Time Simon Wright
2010-12-16 17:24               ` Ada.Execution_Time BrianG
2010-12-16 17:45                 ` Ada.Execution_Time Adam Beneschan
2010-12-16 21:13                   ` Ada.Execution_Time Jeffrey Carter
2010-12-17  0:35               ` New AdaIC site (was: Ada.Execution_Time) Randy Brukardt
2010-12-16 13:08             ` Ada.Execution_Time Peter C. Chapin
2010-12-16 17:32               ` Ada.Execution_Time BrianG
2010-12-16 18:17             ` Ada.Execution_Time Jeffrey Carter
2010-12-16  8:45           ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-16 16:49             ` Ada.Execution_Time BrianG
2010-12-16 17:52               ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-17  8:49                 ` Ada.Execution_Time Niklas Holsti
2010-12-17  9:32                   ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-17 11:50                     ` Ada.Execution_Time Niklas Holsti
2010-12-17 13:10                       ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-18 21:20                         ` Ada.Execution_Time Niklas Holsti
2010-12-19  9:57                           ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-25 11:31                             ` Ada.Execution_Time Niklas Holsti
2010-12-26 10:25                               ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-27 12:44                                 ` Ada.Execution_Time Niklas Holsti
2010-12-27 15:28                                   ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-27 20:11                                     ` Ada.Execution_Time Niklas Holsti
2010-12-27 21:34                                       ` Ada.Execution_Time Simon Wright
2010-12-28 10:01                                         ` Ada.Execution_Time Niklas Holsti
2010-12-28 14:17                                           ` Ada.Execution_Time Simon Wright
2010-12-27 21:53                                       ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-28 14:14                                         ` Ada.Execution_Time Simon Wright
2010-12-28 15:08                                           ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-28 16:18                                             ` Ada.Execution_Time Simon Wright
2010-12-28 16:34                                               ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-31  0:40                                             ` Ada.Execution_Time BrianG
2010-12-31  9:09                                               ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-28 14:46                                         ` Ada.Execution_Time Niklas Holsti
2010-12-28 15:42                                           ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-28 16:27                                             ` Ada.Execution_Time (see below)
2010-12-28 16:55                                               ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-28 19:41                                                 ` Ada.Execution_Time (see below)
2010-12-28 20:03                                                   ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-28 22:39                                                     ` Ada.Execution_Time Simon Wright
2010-12-29  9:07                                                       ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-27 17:24                                 ` Ada.Execution_Time Robert A Duff
2010-12-27 22:02                                   ` Ada.Execution_Time Randy Brukardt
2010-12-27 22:43                                     ` Ada.Execution_Time Robert A Duff
2010-12-27 22:11                               ` Ada.Execution_Time Randy Brukardt
2010-12-29 12:48                                 ` Ada.Execution_Time Niklas Holsti
2010-12-29 14:30                                   ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-29 16:19                                     ` Ada.Execution_Time (see below)
2010-12-29 16:51                                       ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-29 19:57                                         ` Ada.Execution_Time (see below)
2010-12-29 21:20                                           ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-30  5:13                                             ` Ada.Execution_Time Randy Brukardt
2010-12-30 13:37                                             ` Ada.Execution_Time Niklas Holsti
2010-12-29 20:32                                     ` Ada.Execution_Time Niklas Holsti
2010-12-29 21:21                                       ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-30 13:34                                         ` Ada.Execution_Time Niklas Holsti
2010-12-30 19:23                                     ` Ada.Execution_Time Niklas Holsti
2010-12-30  5:06                                   ` Ada.Execution_Time Randy Brukardt
2010-12-30 23:49                                     ` Ada.Execution_Time Niklas Holsti
2010-12-31 23:34                                       ` Ada.Execution_Time Randy Brukardt
2011-01-01 13:52                                         ` Niklas Holsti [this message]
2011-01-01 14:42                                           ` Ada.Execution_Time Simon Wright
2011-01-01 16:01                                             ` Ada.Execution_Time Simon Wright
2011-01-01 19:18                                               ` Ada.Execution_Time Niklas Holsti
2011-01-03 21:27                                           ` Ada.Execution_Time Randy Brukardt
2011-01-06 22:55                                             ` Ada.Execution_Time Niklas Holsti
2011-01-07  6:25                                               ` Ada.Execution_Time Randy Brukardt
2011-01-01 15:54                                         ` Ada.Execution_Time Simon Wright
2011-01-03 21:33                                           ` Ada.Execution_Time Randy Brukardt
2011-01-05 15:55                                             ` Ada.Execution_Time Brad Moore
2010-12-17  8:59         ` Ada.Execution_Time anon
2010-12-19  3:07           ` Ada.Execution_Time BrianG
2010-12-19  4:01             ` Ada.Execution_Time Vinzent Hoefler
2010-12-19 11:00               ` Ada.Execution_Time Niklas Holsti
2010-12-21  0:37                 ` Ada.Execution_Time Randy Brukardt
2010-12-21  1:20                   ` Ada.Execution_Time Jeffrey Carter
2010-12-19 12:27               ` Ada.Execution_Time Dmitry A. Kazakov
2010-12-21  0:32               ` Ada.Execution_Time Randy Brukardt
2010-12-19 22:54             ` Ada.Execution_Time anon
2010-12-20  3:14               ` Ada.Execution_Time BrianG
2010-12-22 14:30                 ` Ada.Execution_Time anon
2010-12-22 20:09                   ` Ada.Execution_Time BrianG
replies disabled

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