source: rtems/testsuites/tmtests/tm29/task1.c @ 5c491aef

4.104.114.84.95
Last change on this file since 5c491aef was 5c491aef, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 20, 1995 at 3:39:19 PM

changes remerged after lost in disk crash -- recovered from snapshot, partially recovered working tree, etc

  • Property mode set to 100644
File size: 4.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 *  $Id$
12 */
13
14#define TEST_INIT
15#include "system.h"
16
17rtems_name Period_name;
18
19rtems_task Tasks(
20  rtems_task_argument argument
21);
22
23rtems_task Low_task(
24  rtems_task_argument argument
25);
26
27rtems_unsigned32 Task_count;
28
29rtems_task Init(
30  rtems_task_argument argument
31)
32{
33  rtems_id          id;
34  rtems_unsigned32  index;
35  rtems_status_code status;
36
37  Print_Warning();
38
39  puts( "\n\n*** TIME TEST 29 ***" );
40
41  Period_name = rtems_build_name( 'P', 'R', 'D', ' ' );
42
43  Timer_initialize();
44    (void) rtems_rate_monotonic_create( Period_name, &id );
45  end_time = Read_timer();
46
47  put_time(
48    "rtems_rate_monotonic_create",
49    end_time,
50    1,
51    0,
52    CALLING_OVERHEAD_RATE_MONOTONIC_CREATE
53  );
54
55  Timer_initialize();
56    (void) rtems_rate_monotonic_period( id, 10 );
57  end_time = Read_timer();
58
59  put_time(
60    "rtems_rate_monotonic_period: initiate period -- returns to caller",
61    end_time,
62    1,
63    0,
64    CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
65  );
66
67  Timer_initialize();
68    (void) rtems_rate_monotonic_period( id, RTEMS_PERIOD_STATUS );
69  end_time = Read_timer();
70
71  put_time(
72    "rtems_rate_monotonic_period: obtain status",
73    end_time,
74    1,
75    0,
76    CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
77  );
78
79  Timer_initialize();
80    (void) rtems_rate_monotonic_cancel( id );
81  end_time = Read_timer();
82
83  put_time(
84    "rtems_rate_monotonic_cancel",
85    end_time,
86    1,
87    0,
88    CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL
89  );
90
91  Timer_initialize();
92    (void) rtems_rate_monotonic_delete( id );
93  end_time = Read_timer();
94
95  put_time(
96    "rtems_rate_monotonic_delete: inactive",
97    end_time,
98    1,
99    0,
100    CALLING_OVERHEAD_RATE_MONOTONIC_DELETE
101  );
102
103  status = rtems_rate_monotonic_create( Period_name, &id );
104  directive_failed( status, "rtems_rate_monotonic_create" );
105
106  status = rtems_rate_monotonic_period( id, 10 );
107  directive_failed( status, "rtems_rate_monotonic_period" );
108
109  Timer_initialize();
110    rtems_rate_monotonic_delete( id );
111  end_time = Read_timer();
112
113  put_time(
114    "rtems_rate_monotonic_delete: active",
115    end_time,
116    1,
117    0,
118    CALLING_OVERHEAD_RATE_MONOTONIC_DELETE
119  );
120
121  for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
122    status = rtems_task_create(
123      rtems_build_name( 'T', 'E', 'S', 'T' ),
124      128,
125      RTEMS_MINIMUM_STACK_SIZE,
126      RTEMS_DEFAULT_MODES,
127      RTEMS_DEFAULT_ATTRIBUTES,
128      &id
129    );
130    directive_failed( status, "rtems_task_create LOOP" );
131
132    status = rtems_task_start( id, Tasks, 0 );
133    directive_failed( status, "rtems_task_start LOOP" );
134  }
135
136  status = rtems_task_create(
137    rtems_build_name( 'L', 'O', 'W', ' ' ),
138    200,
139    RTEMS_MINIMUM_STACK_SIZE,
140    RTEMS_DEFAULT_MODES,
141    RTEMS_DEFAULT_ATTRIBUTES,
142    &id
143  );
144  directive_failed( status, "rtems_task_create LOW" );
145
146  status = rtems_task_start( id, Low_task, 0 );
147  directive_failed( status, "rtems_task_start LOW" );
148
149  Task_count = 0;
150
151  status = rtems_task_delete( RTEMS_SELF );
152  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
153}
154
155rtems_task Tasks(
156  rtems_task_argument argument
157)
158{
159  rtems_id          id;
160  rtems_status_code status;
161
162  status = rtems_rate_monotonic_create( 1, &id );
163  directive_failed( status, "rtems_rate_monotonic_create" );
164
165  status = rtems_rate_monotonic_period( id, 100 );
166  directive_failed( status, "rtems_rate_monotonic_period" );
167
168  /*
169   *  Give up the processor to allow all tasks to actually
170   *  create and start their period timer before the benchmark
171   *  timer is initialized.
172   */
173
174  (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
175
176  Task_count++;
177
178  if ( Task_count == 1 )
179    Timer_initialize();
180
181  (void) rtems_rate_monotonic_period( id, 100 );
182}
183
184rtems_task Low_task(
185  rtems_task_argument argument
186)
187{
188  rtems_unsigned32 index;
189
190  end_time = Read_timer();
191
192  Timer_initialize();
193    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
194      (void) Empty_function();
195  overhead = Read_timer();
196
197  put_time(
198    "rtems_rate_monotonic_period: conclude periods -- caller blocks",
199    end_time,
200    OPERATION_COUNT,
201    overhead,
202    CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD
203  );
204
205  puts( "*** END OF TEST 29 ***" );
206  exit( 0 );
207}
Note: See TracBrowser for help on using the repository browser.