source: rtems/testsuites/tmtests/tm10/task1.c @ 4b374f36

4.104.114.84.95
Last change on this file since 4b374f36 was 4b374f36, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 17, 1995 at 7:36:43 PM

maximum number of messages removed and include statement cleanup

  • Property mode set to 100644
File size: 3.4 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 *  task1.c,v 1.2 1995/05/31 17:15:39 joel Exp
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;
21long Buffer[4];
22
23rtems_task High_task(
24  rtems_task_argument argument
25);
26
27rtems_task Middle_tasks(
28  rtems_task_argument argument
29);
30
31rtems_task Low_task(
32  rtems_task_argument argument
33);
34
35void test_init();
36
37rtems_task Init(
38  rtems_task_argument argument
39)
40{
41  rtems_status_code status;
42
43  puts( "\n\n*** TIME TEST 10 ***" );
44
45  test_init();
46
47  status = rtems_task_delete( RTEMS_SELF );
48  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
49}
50
51void test_init()
52{
53  rtems_unsigned32    index;
54  rtems_unsigned32    size;
55  rtems_task_entry    task_entry;
56  rtems_status_code   status;
57  rtems_task_priority priority;
58  rtems_id            task_id;
59
60  priority = 5;
61
62  for( index = 0; index <= OPERATION_COUNT ; index++ ) {
63    status = rtems_task_create(
64      rtems_build_name( 'T', 'I', 'M', 'E' ),
65      priority,
66      1024,
67      RTEMS_DEFAULT_MODES,
68      RTEMS_DEFAULT_ATTRIBUTES,
69      &task_id
70    );
71    directive_failed( status, "rtems_task_create LOOP" );
72
73    priority++;
74
75    if ( index==0 )                    task_entry = High_task;
76    else if ( index==OPERATION_COUNT ) task_entry = Low_task;
77    else                               task_entry = Middle_tasks;
78
79    status = rtems_task_start( task_id, task_entry, 0 );
80    directive_failed( status, "rtems_task_start LOOP" );
81  }
82
83  status = rtems_message_queue_create(
84    1,
85    OPERATION_COUNT,
86    16,
87    RTEMS_DEFAULT_ATTRIBUTES,
88    &Queue_id
89  );
90  directive_failed( status, "rtems_message_queue_create" );
91
92  Timer_initialize();
93    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
94      (void) Empty_function();
95  overhead = Read_timer();
96
97  Timer_initialize();
98    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
99      (void) rtems_message_queue_receive(
100               Queue_id,
101               (long (*)[4]) Buffer,
102               &size,
103               RTEMS_NO_WAIT,
104               RTEMS_NO_TIMEOUT
105             );
106  end_time = Read_timer();
107
108  put_time(
109    "rtems_message_queue_receive (RTEMS_NO_WAIT)",
110    end_time,
111    OPERATION_COUNT,
112    overhead,
113    CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
114  );
115
116}
117
118rtems_task High_task(
119  rtems_task_argument argument
120)
121{
122  rtems_unsigned32 size;
123 
124  Timer_initialize();
125     (void) rtems_message_queue_receive(
126              Queue_id,
127              (long (*)[4]) Buffer,
128              &size,
129              RTEMS_DEFAULT_OPTIONS,
130              RTEMS_NO_TIMEOUT
131            );
132}
133
134rtems_task Middle_tasks(
135  rtems_task_argument argument
136)
137{
138  rtems_unsigned32 size;
139 
140  (void) rtems_message_queue_receive(
141           Queue_id,
142           (long (*)[4]) Buffer,
143           &size,
144           RTEMS_DEFAULT_OPTIONS,
145           RTEMS_NO_TIMEOUT
146         );
147}
148
149
150rtems_task Low_task(
151  rtems_task_argument argument
152)
153{
154  end_time = Read_timer();
155
156  put_time(
157    "rtems_message_queue_receive (blocking)",
158    end_time,
159    OPERATION_COUNT,
160    0,
161    CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE
162  );
163
164  exit( 0 );
165}
Note: See TracBrowser for help on using the repository browser.