source: rtems/c/src/tests/tmtests/tm09/task1.c @ b3ac6a8d

4.104.114.84.95
Last change on this file since b3ac6a8d was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/95 at 19:35:39

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/*
2 *
3 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
4 *  On-Line Applications Research Corporation (OAR).
5 *  All rights assigned to U.S. Government, 1994.
6 *
7 *  This material may be reproduced by or for the U.S. Government pursuant
8 *  to the copyright license under the clause at DFARS 252.227-7013.  This
9 *  notice must appear in all copies of this file and its derivatives.
10 *
11 *  $Id$
12 */
13
14#define TEST_INIT
15#include "system.h"
16
17rtems_id Queue_id;
18
19rtems_task Test_task(
20  rtems_task_argument argument
21);
22void queue_test();
23
24rtems_task Init(
25  rtems_task_argument argument
26)
27{
28  rtems_status_code status;
29
30  Print_Warning();
31
32  puts( "\n\n*** TIME TEST 9 ***" );
33
34  status = rtems_task_create(
35    1,
36    128,
37    4096,
38    RTEMS_DEFAULT_MODES,
39    RTEMS_DEFAULT_ATTRIBUTES,
40    &Task_id[ 1 ]
41  );
42  directive_failed( status, "rtems_task_create" );
43
44  status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
45  directive_failed( status, "rtems_task_start" );
46
47  status = rtems_task_delete( RTEMS_SELF );
48  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
49}
50
51rtems_task Test_task (
52  rtems_task_argument argument
53)
54{
55  Timer_initialize();
56    rtems_message_queue_create(
57      1,
58      OPERATION_COUNT,
59      16,
60      RTEMS_DEFAULT_ATTRIBUTES,
61      &Queue_id
62    );
63  end_time = Read_timer();
64
65  put_time(
66    "rtems_message_queue_create",
67    end_time,
68    1,
69    0,
70    CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE
71  );
72
73  queue_test();
74
75  Timer_initialize();
76    rtems_message_queue_delete( Queue_id );
77  end_time = Read_timer();
78
79  put_time(
80    "rtems_message_queue_delete",
81    end_time,
82    1,
83    0,
84    CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE
85  );
86
87  puts( "*** END OF TEST 9 ***" );
88  exit( 0 );
89}
90
91void queue_test()
92{
93  rtems_unsigned32  send_loop_time;
94  rtems_unsigned32  urgent_loop_time;
95  rtems_unsigned32  receive_loop_time;
96  rtems_unsigned32  send_time;
97  rtems_unsigned32  urgent_time;
98  rtems_unsigned32  receive_time;
99  rtems_unsigned32  empty_flush_time;
100  rtems_unsigned32  flush_time;
101  rtems_unsigned32  empty_flush_count;
102  rtems_unsigned32  flush_count;
103  rtems_unsigned32  index;
104  rtems_unsigned32  iterations;
105  long              buffer[4];
106  rtems_status_code status;
107  rtems_unsigned32  size;
108
109  send_loop_time    = 0;
110  urgent_loop_time  = 0;
111  receive_loop_time = 0;
112  send_time         = 0;
113  urgent_time       = 0;
114  receive_time      = 0;
115  empty_flush_time  = 0;
116  flush_time        = 0;
117  flush_count       = 0;
118  empty_flush_count = 0;
119
120  for ( iterations = 1 ; iterations <= OPERATION_COUNT ; iterations++ ) {
121
122    Timer_initialize();
123      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
124        (void) Empty_function();
125    send_loop_time += Read_timer();
126
127    Timer_initialize();
128      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
129        (void) Empty_function();
130    urgent_loop_time += Read_timer();
131
132    Timer_initialize();
133      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
134        (void) Empty_function();
135    receive_loop_time += Read_timer();
136
137    Timer_initialize();
138      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
139        (void) rtems_message_queue_send( Queue_id, (long (*)[4])buffer, 16 );
140    send_time += Read_timer();
141
142    Timer_initialize();
143      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
144        (void) rtems_message_queue_receive(
145                 Queue_id,
146                 (long (*)[4])buffer,
147                 &size,
148                 RTEMS_DEFAULT_OPTIONS,
149                 RTEMS_NO_TIMEOUT
150               );
151    receive_time += Read_timer();
152
153    Timer_initialize();
154      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
155        (void) rtems_message_queue_urgent( Queue_id, (long (*)[4])buffer, 16 );
156    urgent_time += Read_timer();
157
158    Timer_initialize();
159      for ( index=1 ; index <= OPERATION_COUNT ; index++ )
160        (void) rtems_message_queue_receive(
161                 Queue_id,
162                 (long (*)[4])buffer,
163                 &size,
164                 RTEMS_DEFAULT_OPTIONS,
165                 RTEMS_NO_TIMEOUT
166               );
167    receive_time += Read_timer();
168
169    Timer_initialize();
170      rtems_message_queue_flush( Queue_id, &empty_flush_count );
171    empty_flush_time += Read_timer();
172
173    /* send one message to flush */
174    status = rtems_message_queue_send(
175       Queue_id,
176       (long (*)[4])buffer,
177       16
178    );
179    directive_failed( status, "rtems_message_queue_send" );
180
181    Timer_initialize();
182      rtems_message_queue_flush( Queue_id, &flush_count );
183    flush_time += Read_timer();
184  }
185
186  put_time(
187    "rtems_message_queue_send (no tasks waiting)",
188    send_time,
189    OPERATION_COUNT * OPERATION_COUNT,
190    send_loop_time,
191    CALLING_OVERHEAD_MESSAGE_QUEUE_SEND
192  );
193
194  put_time(
195    "rtems_message_queue_urgent (no tasks waiting)",
196    urgent_time,
197    OPERATION_COUNT * OPERATION_COUNT,
198    urgent_loop_time,
199    CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT
200  );
201
202  put_time(
203    "rtems_message_queue_receive (messages available)",
204    receive_time,
205    OPERATION_COUNT * OPERATION_COUNT * 2,
206    receive_loop_time * 2,
207    CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
208  );
209
210  put_time(
211    "rtems_message_queue_flush (empty queue)",
212    empty_flush_time,
213    OPERATION_COUNT,
214    0,
215    CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH
216  );
217
218  put_time(
219    "rtems_message_queue_flush (messages flushed)",
220    flush_time,
221    OPERATION_COUNT,
222    0,
223    CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH
224  );
225
226}
Note: See TracBrowser for help on using the repository browser.