source: rtems/c/src/ada-tests/tmtests/tm09/tmtest.adb @ 35e4691

4.104.114.84.95
Last change on this file since 35e4691 was 35e4691, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:50:41

2003-09-04 Joel Sherrill <joel@…>

  • mptests/mp01/config.h, mptests/mp01/mp01.adb, mptests/mp01/mptest.adb, mptests/mp01/mptest.ads, mptests/mp02/mptest.adb, mptests/mp02/mptest.ads, mptests/mp03/mptest.adb, mptests/mp03/mptest.ads, mptests/mp04/mptest.adb, mptests/mp04/mptest.ads, mptests/mp05/mptest.adb, mptests/mp05/mptest.ads, mptests/mp06/mptest.adb, mptests/mp06/mptest.ads, mptests/mp07/mptest.adb, mptests/mp07/mptest.ads, mptests/mp08/mptest.adb, mptests/mp08/mptest.ads, mptests/mp09/mptest.adb, mptests/mp09/mptest.ads, mptests/mp10/mptest.adb, mptests/mp10/mptest.ads, mptests/mp11/mptest.adb, mptests/mp11/mptest.ads, mptests/mp12/mptest.adb, mptests/mp12/mptest.ads, mptests/mp13/mptest.adb, mptests/mp13/mptest.ads, mptests/mp14/mptest.adb, mptests/mp14/mptest.ads, samples/base_mp/config.h, samples/base_mp/mptest.adb, samples/base_mp/mptest.ads, samples/base_sp/base_sp.adb, samples/base_sp/config.h, samples/base_sp/sptest.adb, samples/base_sp/sptest.ads, samples/hello/config.h, samples/hello/hello.adb, samples/hello/sptest.adb, samples/hello/sptest.ads, samples/ticker/config.h, samples/ticker/sptest.adb, samples/ticker/sptest.ads, samples/ticker/ticker.adb, sptests/sp01/config.h, sptests/sp01/sp01.adb, sptests/sp01/sptest.adb, sptests/sp01/sptest.ads, sptests/sp02/config.h, sptests/sp02/sp02.adb, sptests/sp02/sptest.adb, sptests/sp02/sptest.ads, sptests/sp03/config.h, sptests/sp03/sp03.adb, sptests/sp03/sptest.adb, sptests/sp03/sptest.ads, sptests/sp04/config.h, sptests/sp04/sp04.adb, sptests/sp04/sptest.adb, sptests/sp04/sptest.ads, sptests/sp05/config.h, sptests/sp05/sp05.adb, sptests/sp05/sptest.adb, sptests/sp05/sptest.ads, sptests/sp06/config.h, sptests/sp06/sp06.adb, sptests/sp06/sptest.adb, sptests/sp06/sptest.ads, sptests/sp07/config.h, sptests/sp07/sp07.adb, sptests/sp07/sptest.adb, sptests/sp07/sptest.ads, sptests/sp08/config.h, sptests/sp08/sp08.adb, sptests/sp08/sptest.adb, sptests/sp08/sptest.ads, sptests/sp09/config.h, sptests/sp09/sp09.adb, sptests/sp09/sptest.adb, sptests/sp09/sptest.ads, sptests/sp11/config.h, sptests/sp11/sp11.adb, sptests/sp11/sptest.adb, sptests/sp11/sptest.ads, sptests/sp12/config.h, sptests/sp12/sp12.adb, sptests/sp12/sptest.adb, sptests/sp12/sptest.ads, sptests/sp13/config.h, sptests/sp13/sp13.adb, sptests/sp13/sptest.adb, sptests/sp13/sptest.ads, sptests/sp14/config.h, sptests/sp14/sp14.adb, sptests/sp14/sptest.adb, sptests/sp14/sptest.ads, sptests/sp15/config.h, sptests/sp15/sp15.adb, sptests/sp15/sptest.adb, sptests/sp15/sptest.ads, sptests/sp16/config.h, sptests/sp16/sp16.adb, sptests/sp16/sptest.adb, sptests/sp16/sptest.ads, sptests/sp17/config.h, sptests/sp17/sp17.adb, sptests/sp17/sptest.adb, sptests/sp17/sptest.ads, sptests/sp19/config.h, sptests/sp19/sp19.adb, sptests/sp19/sptest.ads, sptests/sp20/config.h, sptests/sp20/sp20.adb, sptests/sp20/sptest.adb, sptests/sp20/sptest.ads, sptests/sp21/config.h, sptests/sp21/sp21.adb, sptests/sp21/sptest.adb, sptests/sp21/sptest.ads, sptests/sp22/config.h, sptests/sp22/sp22.adb, sptests/sp22/sptest.adb, sptests/sp22/sptest.ads, sptests/sp23/config.h, sptests/sp23/sp23.adb, sptests/sp23/sptest.adb, sptests/sp23/sptest.ads, sptests/sp24/config.h, sptests/sp24/sp24.adb, sptests/sp24/sptest.adb, sptests/sp24/sptest.ads, sptests/sp25/config.h, sptests/sp25/sp25.adb, sptests/sp25/sptest.adb, sptests/sp25/sptest.ads, sptests/spsize/spsize.adb, sptests/spsize/sptest.adb, sptests/spsize/sptest.ads, support/address_io.adb, support/address_io.ads, support/float_io.ads, support/fp.inc, support/integer.inc, support/rtems_calling_overhead.ads, support/status_io.ads, support/test_support.adb, support/test_support.ads, support/time_test_support.adb, support/time_test_support.ads, support/timer_driver.adb, support/timer_driver.ads, support/unsigned32_io.ads, tmtests/tm01/config.h, tmtests/tm01/tm01.adb, tmtests/tm01/tmtest.adb, tmtests/tm01/tmtest.ads, tmtests/tm02/config.h, tmtests/tm02/tm02.adb, tmtests/tm02/tmtest.adb, tmtests/tm02/tmtest.ads, tmtests/tm03/config.h, tmtests/tm03/tm03.adb, tmtests/tm03/tmtest.adb, tmtests/tm03/tmtest.ads, tmtests/tm04/config.h, tmtests/tm04/tm04.adb, tmtests/tm04/tmtest.adb, tmtests/tm04/tmtest.ads, tmtests/tm05/config.h, tmtests/tm05/tm05.adb, tmtests/tm05/tmtest.adb, tmtests/tm05/tmtest.ads, tmtests/tm06/config.h, tmtests/tm06/tm06.adb, tmtests/tm06/tmtest.adb, tmtests/tm06/tmtest.ads, tmtests/tm07/config.h, tmtests/tm07/tm07.adb, tmtests/tm07/tmtest.adb, tmtests/tm07/tmtest.ads, tmtests/tm08/config.h, tmtests/tm08/tm08.adb, tmtests/tm08/tmtest.adb, tmtests/tm08/tmtest.ads, tmtests/tm09/config.h, tmtests/tm09/tm09.adb, tmtests/tm09/tmtest.adb, tmtests/tm09/tmtest.ads, tmtests/tm10/config.h, tmtests/tm10/tm10.adb, tmtests/tm10/tmtest.adb, tmtests/tm10/tmtest.ads, tmtests/tm11/config.h, tmtests/tm11/tm11.adb, tmtests/tm11/tmtest.adb, tmtests/tm11/tmtest.ads, tmtests/tm12/config.h, tmtests/tm12/tm12.adb, tmtests/tm12/tmtest.adb, tmtests/tm12/tmtest.ads, tmtests/tm13/config.h, tmtests/tm13/tm13.adb, tmtests/tm13/tmtest.adb, tmtests/tm13/tmtest.ads, tmtests/tm14/config.h, tmtests/tm14/tm14.adb, tmtests/tm14/tmtest.adb, tmtests/tm14/tmtest.ads, tmtests/tm15/config.h, tmtests/tm15/tm15.adb, tmtests/tm15/tmtest.adb, tmtests/tm15/tmtest.ads, tmtests/tm16/config.h, tmtests/tm16/tm16.adb, tmtests/tm16/tmtest.adb, tmtests/tm16/tmtest.ads, tmtests/tm17/config.h, tmtests/tm17/tm17.adb, tmtests/tm17/tmtest.adb, tmtests/tm17/tmtest.ads, tmtests/tm18/config.h, tmtests/tm18/tm18.adb, tmtests/tm18/tmtest.adb, tmtests/tm18/tmtest.ads, tmtests/tm19/config.h, tmtests/tm19/tm19.adb, tmtests/tm19/tmtest.adb, tmtests/tm19/tmtest.ads, tmtests/tm20/config.h, tmtests/tm20/tm20.adb, tmtests/tm20/tmtest.adb, tmtests/tm20/tmtest.ads, tmtests/tm21/config.h, tmtests/tm21/tm21.adb, tmtests/tm21/tmtest.adb, tmtests/tm21/tmtest.ads, tmtests/tm22/config.h, tmtests/tm22/tm22.adb, tmtests/tm22/tmtest.adb, tmtests/tm22/tmtest.ads, tmtests/tm23/config.h, tmtests/tm23/tm23.adb, tmtests/tm23/tmtest.adb, tmtests/tm23/tmtest.ads, tmtests/tm24/config.h, tmtests/tm24/tm24.adb, tmtests/tm24/tmtest.adb, tmtests/tm24/tmtest.ads, tmtests/tm25/config.h, tmtests/tm25/tm25.adb, tmtests/tm25/tmtest.adb, tmtests/tm25/tmtest.ads, tmtests/tm28/config.h, tmtests/tm28/tm28.adb, tmtests/tm28/tmtest.adb, tmtests/tm28/tmtest.ads, tmtests/tm29/config.h, tmtests/tm29/tm29.adb, tmtests/tm29/tmtest.adb, tmtests/tm29/tmtest.ads, tmtests/tmck/config.h, tmtests/tmck/tmck.adb, tmtests/tmck/tmtest.adb, tmtests/tmck/tmtest.ads, tmtests/tmoverhd/config.h, tmtests/tmoverhd/dummy_rtems.adb, tmtests/tmoverhd/dummy_rtems.ads, tmtests/tmoverhd/tmoverhd.adb, tmtests/tmoverhd/tmtest.adb, tmtests/tmoverhd/tmtest.ads: URL for license changed.
  • Property mode set to 100644
File size: 8.0 KB
Line 
1--
2--  TMTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation of Test 9 of the RTEMS
7--  Timing Test Suite.
8--
9--  DEPENDENCIES:
10--
11-- 
12--
13--  COPYRIGHT (c) 1989-1997.
14--  On-Line Applications Research Corporation (OAR).
15--
16--  The license and distribution terms for this file may in
17--  the file LICENSE in this distribution or at
18--  http://www.rtems.com/license/LICENSE.
19--
20--  $Id$
21--
22
23with INTERFACES; use INTERFACES;
24with RTEMS;
25with RTEMS_CALLING_OVERHEAD;
26with TEST_SUPPORT;
27with TEXT_IO;
28with TIME_TEST_SUPPORT;
29with UNSIGNED32_IO;
30
31package body TMTEST is
32
33--PAGE
34--
35--  INIT
36--
37
38   procedure INIT (
39      ARGUMENT : in     RTEMS.TASK_ARGUMENT
40   ) is
41      TASK_ID : RTEMS.ID;
42      STATUS  : RTEMS.STATUS_CODES;
43   begin
44
45      TEXT_IO.NEW_LINE( 2 );
46      TEXT_IO.PUT_LINE( "*** TIME TEST 9 ***" );
47
48      RTEMS.TASK_CREATE(
49         1,
50         128,
51         4096,
52         RTEMS.DEFAULT_OPTIONS,
53         RTEMS.DEFAULT_ATTRIBUTES,
54         TASK_ID,
55         STATUS
56      );
57      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" );
58
59      RTEMS.TASK_START( TASK_ID, TMTEST.TEST_TASK'ACCESS, 0, STATUS );
60      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" );
61
62      RTEMS.TASK_DELETE( RTEMS.SELF, STATUS );
63      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" );
64
65   end INIT;
66
67--PAGE
68--
69--  TEST_TASK
70--
71
72   procedure TEST_TASK (
73      ARGUMENT : in     RTEMS.TASK_ARGUMENT
74   ) is
75      STATUS       : RTEMS.STATUS_CODES;
76   begin
77
78      TIMER_DRIVER.INITIALIZE;
79         RTEMS.MESSAGE_QUEUE_CREATE(
80            1,
81            TIME_TEST_SUPPORT.OPERATION_COUNT,
82            16,
83            RTEMS.DEFAULT_OPTIONS,
84            TMTEST.QUEUE_ID,
85            STATUS
86         );
87      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
88      TIME_TEST_SUPPORT.PUT_TIME(
89         "MESSAGE_QUEUE_CREATE",
90         TMTEST.END_TIME,
91         1,
92         0,
93         RTEMS_CALLING_OVERHEAD.MESSAGE_QUEUE_CREATE
94      );
95
96      TMTEST.QUEUE_TEST;
97
98      TIMER_DRIVER.INITIALIZE;
99         RTEMS.MESSAGE_QUEUE_DELETE(
100            TMTEST.QUEUE_ID,
101            STATUS
102         );
103      TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER;
104      TIME_TEST_SUPPORT.PUT_TIME(
105         "MESSAGE_QUEUE_DELETE",
106         TMTEST.END_TIME,
107         1,
108         0,
109         RTEMS_CALLING_OVERHEAD.MESSAGE_QUEUE_DELETE
110      );
111
112      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
113
114   end TEST_TASK;
115
116--PAGE
117--
118--  QUEUE_TEST
119--
120
121   procedure QUEUE_TEST
122   is
123      SEND_LOOP_TIME    : RTEMS.UNSIGNED32;
124      URGENT_LOOP_TIME  : RTEMS.UNSIGNED32;
125      RECEIVE_LOOP_TIME : RTEMS.UNSIGNED32;
126      SEND_TIME         : RTEMS.UNSIGNED32;
127      URGENT_TIME       : RTEMS.UNSIGNED32;
128      RECEIVE_TIME      : RTEMS.UNSIGNED32;
129      EMPTY_FLUSH_TIME  : RTEMS.UNSIGNED32;
130      FLUSH_TIME        : RTEMS.UNSIGNED32;
131      FLUSH_COUNT       : RTEMS.UNSIGNED32;
132      EMPTY_FLUSH_COUNT : RTEMS.UNSIGNED32;
133      INDEX             : RTEMS.UNSIGNED32;
134      ITERATIONS        : RTEMS.UNSIGNED32;
135      LOOP_COUNT        : RTEMS.UNSIGNED32;
136      BUFFER            : TMTEST.BUFFER;
137      BUFFER_POINTER    : RTEMS.ADDRESS;
138      MESSAGE_SIZE      : RTEMS.UNSIGNED32;
139      STATUS            : RTEMS.STATUS_CODES;
140   begin
141
142      SEND_LOOP_TIME    := 0;
143      URGENT_LOOP_TIME  := 0;
144      RECEIVE_LOOP_TIME := 0;
145      SEND_TIME         := 0;
146      URGENT_TIME       := 0;
147      RECEIVE_TIME      := 0;
148      EMPTY_FLUSH_TIME  := 0;
149      FLUSH_TIME        := 0;
150      FLUSH_COUNT       := 0;
151      EMPTY_FLUSH_COUNT := 0;
152
153      BUFFER_POINTER := BUFFER'ADDRESS;
154
155      for ITERATIONS in 1 .. TIME_TEST_SUPPORT.ITERATION_COUNT
156      loop
157
158         TIMER_DRIVER.INITIALIZE;
159            for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
160            loop
161               TIMER_DRIVER.EMPTY_FUNCTION;
162            end loop;
163         SEND_LOOP_TIME := SEND_LOOP_TIME + TIMER_DRIVER.READ_TIMER;
164
165         TIMER_DRIVER.INITIALIZE;
166            for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
167            loop
168               TIMER_DRIVER.EMPTY_FUNCTION;
169            end loop;
170         URGENT_LOOP_TIME := URGENT_LOOP_TIME + TIMER_DRIVER.READ_TIMER;
171
172         TIMER_DRIVER.INITIALIZE;
173            for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
174            loop
175               TIMER_DRIVER.EMPTY_FUNCTION;
176            end loop;
177         RECEIVE_LOOP_TIME := RECEIVE_LOOP_TIME + TIMER_DRIVER.READ_TIMER;
178
179         TIMER_DRIVER.INITIALIZE;
180            for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
181            loop
182               RTEMS.MESSAGE_QUEUE_SEND(
183                  TMTEST.QUEUE_ID,
184                  BUFFER_POINTER,
185                  16,
186                  STATUS
187               );
188            end loop;
189         SEND_TIME := SEND_TIME + TIMER_DRIVER.READ_TIMER;
190
191         TIMER_DRIVER.INITIALIZE;
192            for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
193            loop
194               RTEMS.MESSAGE_QUEUE_RECEIVE(
195                  TMTEST.QUEUE_ID,
196                  BUFFER_POINTER,
197                  RTEMS.DEFAULT_OPTIONS,
198                  RTEMS.NO_TIMEOUT,
199                  MESSAGE_SIZE,
200                  STATUS
201               );
202            end loop;
203         RECEIVE_TIME := RECEIVE_TIME + TIMER_DRIVER.READ_TIMER;
204
205         TIMER_DRIVER.INITIALIZE;
206            for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
207            loop
208               RTEMS.MESSAGE_QUEUE_URGENT(
209                  TMTEST.QUEUE_ID,
210                  BUFFER_POINTER,
211                  16,
212                  STATUS
213               );
214            end loop;
215         URGENT_TIME := URGENT_TIME + TIMER_DRIVER.READ_TIMER;
216
217         TIMER_DRIVER.INITIALIZE;
218            for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT
219            loop
220               RTEMS.MESSAGE_QUEUE_RECEIVE(
221                  TMTEST.QUEUE_ID,
222                  BUFFER_POINTER,
223                  RTEMS.DEFAULT_OPTIONS,
224                  RTEMS.NO_TIMEOUT,
225                  MESSAGE_SIZE,
226                  STATUS
227               );
228            end loop;
229         RECEIVE_TIME := RECEIVE_TIME + TIMER_DRIVER.READ_TIMER;
230
231         TIMER_DRIVER.INITIALIZE;
232            RTEMS.MESSAGE_QUEUE_FLUSH(
233               TMTEST.QUEUE_ID,
234               EMPTY_FLUSH_COUNT,
235               STATUS
236            );
237         EMPTY_FLUSH_TIME := EMPTY_FLUSH_TIME + TIMER_DRIVER.READ_TIMER;
238
239         -- send one message to flush
240         RTEMS.MESSAGE_QUEUE_SEND(
241            TMTEST.QUEUE_ID,
242            BUFFER_POINTER,
243            16,
244            STATUS
245         );
246         TIMER_DRIVER.INITIALIZE;
247            RTEMS.MESSAGE_QUEUE_FLUSH(
248               TMTEST.QUEUE_ID,
249               FLUSH_COUNT,
250               STATUS
251            );
252         FLUSH_TIME := FLUSH_TIME + TIMER_DRIVER.READ_TIMER;
253
254      end loop;
255
256      TIME_TEST_SUPPORT.PUT_TIME(
257         "MESSAGE_QUEUE_SEND (no tasks waiting)",
258         SEND_TIME,
259         TIME_TEST_SUPPORT.OPERATION_COUNT *
260            TIME_TEST_SUPPORT.ITERATION_COUNT,
261         SEND_LOOP_TIME,
262         RTEMS_CALLING_OVERHEAD.MESSAGE_QUEUE_SEND
263      );
264
265      TIME_TEST_SUPPORT.PUT_TIME(
266         "MESSAGE_QUEUE_URGENT (no tasks waiting)",
267         URGENT_TIME,
268         TIME_TEST_SUPPORT.OPERATION_COUNT *
269            TIME_TEST_SUPPORT.ITERATION_COUNT,
270         URGENT_LOOP_TIME,
271         RTEMS_CALLING_OVERHEAD.MESSAGE_QUEUE_URGENT
272      );
273
274      TIME_TEST_SUPPORT.PUT_TIME(
275         "MESSAGE_QUEUE_RECEIVE (messages available)",
276         RECEIVE_TIME,
277         TIME_TEST_SUPPORT.OPERATION_COUNT *
278            TIME_TEST_SUPPORT.ITERATION_COUNT * 2,
279         RECEIVE_LOOP_TIME * 2,
280         RTEMS_CALLING_OVERHEAD.MESSAGE_QUEUE_RECEIVE
281      );
282
283      TIME_TEST_SUPPORT.PUT_TIME(
284         "MESSAGE_QUEUE_FLUSH (empty queue)",
285         EMPTY_FLUSH_TIME,
286         TIME_TEST_SUPPORT.ITERATION_COUNT,
287         0,
288         RTEMS_CALLING_OVERHEAD.MESSAGE_QUEUE_FLUSH
289      );
290
291      TIME_TEST_SUPPORT.PUT_TIME(
292         "MESSAGE_QUEUE_FLUSH (messages flushed)",
293         FLUSH_TIME,
294         TIME_TEST_SUPPORT.ITERATION_COUNT,
295         0,
296         RTEMS_CALLING_OVERHEAD.MESSAGE_QUEUE_FLUSH
297      );
298
299   end QUEUE_TEST;
300
301end TMTEST;
Note: See TracBrowser for help on using the repository browser.