source: rtems/doc/common/timing.t @ 6449498

4.104.114.84.95
Last change on this file since 6449498 was 6449498, checked in by Joel Sherrill <joel.sherrill@…>, on 01/17/02 at 21:47:47

2001-01-17 Joel Sherrill <joel@…>

  • SUPPORT, LICENSE: New files.
  • Numerous files touched as part of merging the 4.5 branch onto the mainline development trunk and ensuring that the script that cuts snapshots and releases works on the documentation.
  • Property mode set to 100644
File size: 14.6 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-2002.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter Timing Specification
10
11@section Introduction
12
13This chapter provides information pertaining to the
14measurement of the performance of RTEMS, the methods of
15gathering the timing data, and the usefulness of the data.  Also
16discussed are other time critical aspects of RTEMS that affect
17an applications design and ultimate throughput.  These aspects
18include determinancy, interrupt latency and context switch times.
19
20@section Philosophy
21
22Benchmarks are commonly used to evaluate the
23performance of software and hardware.  Benchmarks can be an
24effective tool when comparing systems.  Unfortunately,
25benchmarks can also be manipulated to justify virtually any
26claim.  Benchmarks of real-time executives are difficult to
27evaluate for a variety of reasons.  Executives vary in the
28robustness of features and options provided.  Even when
29executives compare favorably in functionality, it is quite
30likely that different methodologies were used to obtain the
31timing data.  Another problem is that some executives provide
32times for only a small subset of directives,  This is typically
33justified by claiming that these are the only time-critical
34directives.  The performance of some executives is also very
35sensitive to the number of objects in the system.  To obtain any
36measure of usefulness, the performance information provided for
37an executive should address each of these issues.
38
39When evaluating the performance of a real-time
40executive, one typically considers the following areas:
41determinancy, directive times, worst case interrupt latency, and
42context switch time.  Unfortunately, these areas do not have
43standard measurement methodologies.  This allows vendors to
44manipulate the results such that their product is favorably
45represented.  We have attempted to provide useful and meaningful
46timing information for RTEMS.  To insure the usefulness of our
47data, the methodology and definitions used to obtain and
48describe the data are also documented.
49
50@subsection Determinancy
51
52The correctness of data in a real-time system must
53always be judged by its timeliness.  In many real-time systems,
54obtaining the correct answer does not necessarily solve the
55problem.  For example, in a nuclear reactor it is not enough to
56determine that the core is overheating.  This situation must be
57detected and acknowledged early enough that corrective action
58can be taken and a meltdown avoided.
59
60Consequently, a system designer must be able to
61predict the worst-case behavior of the application running under
62the selected executive.  In this light, it is important that a
63real-time system perform consistently regardless of the number
64of tasks, semaphores, or other resources allocated.  An
65important design goal of a real-time executive is that all
66internal algorithms be fixed-cost.  Unfortunately, this goal is
67difficult to completely meet without sacrificing the robustness
68of the executive's feature set.
69
70Many executives use the term deterministic to mean
71that the execution times of their services can be predicted.
72However, they often provide formulas to modify execution times
73based upon the number of objects in the system.  This usage is
74in sharp contrast to the notion of deterministic meaning fixed
75cost.
76
77Almost all RTEMS directives execute in a fixed amount
78of time regardless of the number of objects present in the
79system.  The primary exception occurs when a task blocks while
80acquiring a resource and specifies a non-zero timeout interval.
81
82Other exceptions are message queue broadcast,
83obtaining a variable length memory block, object name to ID
84translation, and deleting a resource upon which tasks are
85waiting.  In addition, the time required to service a clock tick
86interrupt is based upon the number of timeouts and other
87"events" which must be processed at that tick.  This second
88group is composed primarily of capabilities which are inherently
89non-deterministic but are infrequently used in time critical
90situations.  The major exception is that of servicing a clock
91tick.  However, most applications have a very small number of
92timeouts which expire at exactly the same millisecond (usually
93none, but occasionally two or three).
94
95@subsection Interrupt Latency
96
97Interrupt latency is the delay between the CPU's
98receipt of an interrupt request and the execution of the first
99application-specific instruction in an interrupt service
100routine.  Interrupts are a critical component of most real-time
101applications and it is critical that they be acted upon as
102quickly as possible.
103
104Knowledge of the worst case interrupt latency of an
105executive aids the application designer in determining the
106maximum period of time between the generation of an interrupt
107and an interrupt handler responding to that interrupt.  The
108interrupt latency of an system is the greater of the executive's
109and the applications's interrupt latency.  If the application
110disables interrupts longer than the executive, then the
111application's interrupt latency is the system's worst case
112interrupt disable period.
113
114The worst case interrupt latency for a real-time
115executive is based upon the following components:
116
117@itemize @bullet
118@item the longest period of time interrupts are disabled
119by the executive,
120
121@item the overhead required by the executive at the
122beginning of each ISR,
123
124@item the time required for the CPU to vector the
125interrupt, and
126
127@item for some microprocessors, the length of the longest
128instruction.
129@end itemize
130
131The first component is irrelevant if an interrupt
132occurs when interrupts are enabled, although it must be included
133in a worst case analysis.  The third and fourth components are
134particular to a CPU implementation and are not dependent on the
135executive.  The fourth component is ignored by this document
136because most applications use only a subset of a
137microprocessor's instruction set.  Because of this the longest
138instruction actually executed is application dependent.  The
139worst case interrupt latency of an executive is typically
140defined as the sum of components (1) and (2).  The second
141component includes the time necessry for RTEMS to save registers
142and vector to the user-defined handler.  RTEMS includes the
143third component, the time required for the CPU to vector the
144interrupt, because it is a required part of any interrupt.
145
146Many executives report the maximum interrupt disable
147period as their interrupt latency and ignore the other
148components.  This results in very low worst-case interrupt
149latency times which are not indicative of actual application
150performance.  The definition used by RTEMS results in a higher
151interrupt latency being reported, but accurately reflects the
152longest delay between the CPU's receipt of an interrupt request
153and the execution of the first application-specific instruction
154in an interrupt service routine.
155
156The actual interrupt latency times are reported in
157the Timing Data chapter of this supplement.
158
159@subsection Context Switch Time
160
161An RTEMS context switch is defined as the act of
162taking the CPU from the currently executing task and giving it
163to another task.  This process involves the following components:
164
165@itemize @bullet
166@item Saving the hardware state of the current task.
167
168@item Optionally, invoking the TASK_SWITCH user extension.
169
170@item Restoring the hardware state of the new task.
171@end itemize
172
173RTEMS defines the hardware state of a task to include
174the CPU's data registers, address registers, and, optionally,
175floating point registers.
176
177Context switch time is often touted as a performance
178measure of real-time executives.  However, a context switch is
179performed as part of a directive's actions and should be viewed
180as such when designing an application.  For example, if a task
181is unable to acquire a semaphore and blocks, a context switch is
182required to transfer control from the blocking task to a new
183task.  From the application's perspective, the context switch is
184a direct result of not acquiring the semaphore.  In this light,
185the context switch time is no more relevant than the performance
186of any other of the executive's subroutines which are not
187directly accessible by the application.
188
189In spite of the inappropriateness of using the
190context switch time as a performance metric, RTEMS context
191switch times for floating point and non-floating points tasks
192are provided for comparison purposes.  Of the executives which
193actually support floating point operations, many do not report
194context switch times for floating point context switch time.
195This results in a reported context switch time which is
196meaningless for an application with floating point tasks.
197
198The actual context switch times are reported in the
199Timing Data chapter of this supplement.
200
201@subsection Directive Times
202
203Directives are the application's interface to the
204executive, and as such their execution times are critical in
205determining the performance of the application.  For example, an
206application using a semaphore to protect a critical data
207structure should be aware of the time required to acquire and
208release a semaphore.  In addition, the application designer can
209utilize the directive execution times to evaluate the
210performance of different synchronization and communication
211mechanisms.
212
213The actual directive execution times are reported in
214the Timing Data chapter of this supplement.
215
216@section Methodology
217
218@subsection Software Platform
219
220The RTEMS timing suite is written in C.  The overhead
221of passing arguments to RTEMS by C is not timed.  The times
222reported represent the amount of time from entering to exiting
223RTEMS.
224
225The tests are based upon one of two execution models:
226(1) single invocation times, and (2) average times of repeated
227invocations.  Single invocation times are provided for
228directives which cannot easily be invoked multiple times in the
229same scenario.  For example, the times reported for entering and
230exiting an interrupt service routine are single invocation
231times.  The second model is used for directives which can easily
232be invoked multiple times in the same scenario.  For example,
233the times reported for semaphore obtain and semaphore release
234are averages of multiple invocations.  At least 100 invocations
235are used to obtain the average.
236
237@subsection Hardware Platform
238
239Since RTEMS supports a variety of processors, the
240hardware platform used to gather the benchmark times must also
241vary.  Therefore, for each processor supported the hardware
242platform must be defined.  Each definition will include a brief
243description of the target hardware platform including the clock
244speed, memory wait states encountered, and any other pertinent
245information.  This definition may be found in the processor
246dependent timing data chapter within this supplement.
247
248@subsection What is measured?
249
250An effort was made to provide execution times for a
251large portion of RTEMS.  Times were provided for most directives
252regardless of whether or not they are typically used in time
253critical code.  For example, execution times are provided for
254all object create and delete directives, even though these are
255typically part of application initialization.
256
257The times include all RTEMS actions necessary in a
258particular scenario.  For example, all times for blocking
259directives include the context switch necessary to transfer
260control to a new task.  Under no circumstances is it necessary
261to add context switch time to the reported times.
262
263The following list describes the objects created by
264the timing suite:
265
266@itemize @bullet
267@item All tasks are non-floating point.
268
269@item All tasks are created as local objects.
270
271@item No timeouts are used on blocking directives.
272
273@item All tasks wait for objects in FIFO order.
274
275@end itemize
276
277In addition, no user extensions are configured.
278
279@subsection What is not measured?
280
281The times presented in this document are not intended
282to represent best or worst case times, nor are all directives
283included.  For example, no times are provided for the initialize
284executive and fatal_error_occurred directives.  Other than the
285exceptions detailed in the Determinancy section, all directives
286will execute in the fixed length of time given.
287
288Other than entering and exiting an interrupt service
289routine, all directives were executed from tasks and not from
290interrupt service routines.  Directives invoked from ISRs, when
291allowable, will execute in slightly less time than when invoked
292from a task because rescheduling is delayed until the interrupt
293exits.
294
295@subsection Terminology
296
297The following is a list of phrases which are used to
298distinguish individual execution paths of the directives taken
299during the RTEMS performance analysis:
300
301@table @b
302@item another task
303The directive was performed
304on a task other than the calling task.
305
306@item available
307A task attempted to obtain a resource and
308immediately acquired it.
309
310@item blocked task
311The task operated upon by the
312directive was blocked waiting for a resource.
313
314@item caller blocks
315The requested resoure was not
316immediately available and the calling task chose to wait.
317
318@item calling task
319The task invoking the directive.
320
321@item messages flushed
322One or more messages was flushed
323from the message queue.
324
325@item no messages flushed
326No messages were flushed from
327the message queue.
328
329@item not available
330A task attempted to obtain a resource
331and could not immediately acquire it.
332
333@item no reschedule
334The directive did not require a
335rescheduling operation.
336
337@item NO_WAIT
338A resource was not available and the
339calling task chose to return immediately via the NO_WAIT option
340with an error.
341
342@item obtain current
343The current value of something was
344requested by the calling task.
345
346@item preempts caller
347The release of a resource caused a
348task of higher priority than the calling to be readied and it
349became the executing task.
350
351@item ready task
352The task operated upon by the directive
353was in the ready state.
354
355@item reschedule
356The actions of the directive
357necessitated a rescheduling operation.
358
359@item returns to caller
360The directive succeeded and
361immediately returned to the calling task.
362
363@item returns to interrupted task
364The instructions
365executed immediately following this interrupt will be in the
366interrupted task.
367
368@item returns to nested interrupt
369The instructions
370executed immediately following this interrupt will be in a
371previously interrupted ISR.
372
373@item returns to preempting task
374The instructions
375executed immediately following this interrupt or signal handler
376will be in a task other than the interrupted task.
377
378@item signal to self
379The signal set was sent to the
380calling task and signal processing was enabled.
381
382@item suspended task
383The task operated upon by the
384directive was in the suspended state.
385
386@item task readied
387The release of a resource caused a
388task of lower or equal priority to be readied and the calling
389task remained the executing task.
390
391@item yield
392The act of attempting to voluntarily release
393the CPU.
394
395@end table
396
Note: See TracBrowser for help on using the repository browser.