source: rtems/testsuites/tmtests/tm09/task1.c @ 7f6a24ab

4.104.114.84.95
Last change on this file since 7f6a24ab was 3235ad9, checked in by Joel Sherrill <joel.sherrill@…>, on 08/23/95 at 19:30:23

Support for variable length names added to Object Handler. This supports
both fixed length "raw" names and strings from the API's point of view.

Both inline and macro implementations were tested.

  • 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#include "system.h"
15#undef EXTERN
16#define EXTERN
17#include "conftbl.h"
18#include "gvar.h"
19
20rtems_id Queue_id;
21
22rtems_task Test_task(
23  rtems_task_argument argument
24);
25void queue_test();
26
27rtems_task Init(
28  rtems_task_argument argument
29)
30{
31  rtems_status_code status;
32
33  puts( "\n\n*** TIME TEST 9 ***" );
34
35  status = rtems_task_create(
36    1,
37    128,
38    4096,
39    RTEMS_DEFAULT_MODES,
40    RTEMS_DEFAULT_ATTRIBUTES,
41    &Task_id[ 1 ]
42  );
43  directive_failed( status, "rtems_task_create" );
44
45  status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
46  directive_failed( status, "rtems_task_start" );
47
48  status = rtems_task_delete( RTEMS_SELF );
49  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
50}
51
52rtems_task Test_task (
53  rtems_task_argument argument
54)
55{
56  Timer_initialize();
57    rtems_message_queue_create(
58      1,
59      OPERATION_COUNT,
60      16,
61      RTEMS_DEFAULT_ATTRIBUTES,
62      &Queue_id
63    );
64  end_time = Read_timer();
65
66  put_time(
67    "rtems_message_queue_create",
68    end_time,
69    1,
70    0,
71    CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE
72  );
73
74  queue_test();
75
76  Timer_initialize();
77    rtems_message_queue_delete( Queue_id );
78  end_time = Read_timer();
79
80  put_time(
81    "rtems_message_queue_delete",
82    end_time,
83    1,
84    0,
85    CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE
86  );
87
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.