source: rtems/testsuites/tmtests/tm06/task1.c @ 3652ad35

4.104.114.84.95
Last change on this file since 3652ad35 was 3652ad35, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 19, 1995 at 2:53:29 PM

Minor bug fixes to get all targets compilable and running. The
single biggest changes were the expansion of the workspace size
macro to include other types of objects and the increase in the
minimum stack size for most CPUs.

  • Property mode set to 100644
File size: 3.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 Task_id[ OPERATION_COUNT + 1 ];
18
19rtems_unsigned32 Task_restarted;
20
21rtems_task null_task(
22  rtems_task_argument argument
23);
24
25rtems_task Task_1(
26  rtems_task_argument argument
27);
28
29void test_init( void );
30
31rtems_task Init(
32  rtems_task_argument argument
33)
34{
35  rtems_status_code status;
36
37  Print_Warning();
38
39  puts( "\n\n*** TIME TEST 6 ***" );
40
41  test_init();
42
43  status = rtems_task_delete( RTEMS_SELF );
44  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
45}
46
47void test_init( void )
48{
49  rtems_status_code status;
50  rtems_id id;
51
52  Task_restarted = OPERATION_COUNT;
53
54  status = rtems_task_create(
55    rtems_build_name( 'T', 'I', 'M', 'E' ),
56    128,
57    RTEMS_MINIMUM_STACK_SIZE,
58    RTEMS_DEFAULT_MODES,
59    RTEMS_DEFAULT_ATTRIBUTES,
60    &id
61  );
62  directive_failed( status, "rtems_task_create" );
63
64  status = rtems_task_start( id, Task_1, 0 );
65  directive_failed( status, "rtems_task_start" );
66}
67
68rtems_task Task_1(
69  rtems_task_argument argument
70)
71{
72  rtems_status_code status;
73  rtems_unsigned32  index;
74
75  if ( Task_restarted == OPERATION_COUNT )
76     Timer_initialize();
77
78  Task_restarted--;
79
80  if ( Task_restarted != 0 )
81    (void) rtems_task_restart( RTEMS_SELF, 0 );
82
83  end_time = Read_timer();
84
85  Timer_initialize();
86    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
87      (void) Empty_function();
88  overhead = Read_timer();
89
90  put_time(
91    "rtems_task_restart self",
92    end_time,
93    OPERATION_COUNT,
94    overhead,
95    CALLING_OVERHEAD_TASK_RESTART
96  );
97
98  for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
99    status = rtems_task_create(
100      rtems_build_name( 'T', 'I', 'M', 'E' ),
101      254,
102      RTEMS_MINIMUM_STACK_SIZE,
103      RTEMS_DEFAULT_MODES,
104      RTEMS_DEFAULT_ATTRIBUTES,
105      &Task_id[ index ]
106    );
107    directive_failed( status, "rtems_task_create loop" );
108
109    status = rtems_task_start( Task_id[ index ], null_task, 0 );
110    directive_failed( status, "rtems_task_start loop" );
111  }
112
113  Timer_initialize();
114    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
115      (void) rtems_task_suspend( Task_id[ index ] );
116  end_time = Read_timer();
117
118  put_time(
119    "rtems_task_suspend (no preempt)",
120    end_time,
121    OPERATION_COUNT,
122    0,
123    CALLING_OVERHEAD_TASK_SUSPEND
124  );
125
126  Timer_initialize();
127    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
128      (void) rtems_task_resume( Task_id[ index ] );
129  end_time = Read_timer();
130
131  put_time(
132    "rtems_task_resume (no preempt)",
133    end_time,
134    OPERATION_COUNT,
135    0,
136    CALLING_OVERHEAD_TASK_RESUME
137  );
138
139  Timer_initialize();
140    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
141      (void) rtems_task_delete( Task_id[ index ] );
142  end_time = Read_timer();
143
144  put_time(
145    "rtems_task_delete (others)",
146    end_time,
147    OPERATION_COUNT,
148    0,
149    CALLING_OVERHEAD_TASK_RESUME
150  );
151
152  puts( "*** END OF TEST 6 ***" );
153  exit( 0 );
154}
155
156rtems_task null_task(
157  rtems_task_argument argument
158)
159{
160  while ( FOREVER )
161    ;
162}
Note: See TracBrowser for help on using the repository browser.