source: rtems/testsuites/tmtests/tm24/task1.c @ 4442d21c

4.104.114.84.95
Last change on this file since 4442d21c was 3652ad35, checked in by Joel Sherrill <joel.sherrill@…>, on 09/19/95 at 14:53:29

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: 2.8 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_unsigned32 Task_count;
18
19rtems_task Tasks(
20  rtems_task_argument argument
21);
22
23rtems_task High_task(
24  rtems_task_argument argument
25);
26
27rtems_task Init(
28  rtems_task_argument argument
29)
30{
31  rtems_id          id;
32  rtems_unsigned32  index;
33  rtems_status_code status;
34
35  Print_Warning();
36
37  puts( "\n\n*** TIME TEST 24 ***" );
38
39  status = rtems_task_create(
40    rtems_build_name( 'H', 'I', 'G', 'H' ),
41    10,
42    RTEMS_MINIMUM_STACK_SIZE,
43    RTEMS_DEFAULT_MODES,
44    RTEMS_DEFAULT_ATTRIBUTES,
45    &id
46  );
47  directive_failed( status, "rtems_task_create HIGH" );
48
49  status = rtems_task_start( id, High_task, 0 );
50  directive_failed( status, "rtems_task_create HIGH" );
51
52  for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
53    status = rtems_task_create(
54      rtems_build_name( 'R', 'E', 'S', 'T' ),
55      128,
56      RTEMS_MINIMUM_STACK_SIZE,
57      RTEMS_DEFAULT_MODES,
58      RTEMS_DEFAULT_ATTRIBUTES,
59      &id
60    );
61    directive_failed( status, "rtems_task_create LOOP" );
62
63    status = rtems_task_start( id, Tasks, 0 );
64    directive_failed( status, "rtems_task_start LOOP" );
65  }
66  status = rtems_task_delete( RTEMS_SELF );
67  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
68}
69
70rtems_task High_task(
71  rtems_task_argument argument
72)
73{
74  rtems_status_code status;
75  rtems_unsigned32  index;
76
77  Timer_initialize();
78    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
79      (void) Empty_function();
80  overhead = Read_timer();
81
82  Timer_initialize();
83    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
84      (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
85  end_time = Read_timer();
86
87  put_time(
88    "rtems_task_wake_after (no context switch)",
89    end_time,
90    OPERATION_COUNT,
91    overhead,
92    CALLING_OVERHEAD_TASK_WAKE_AFTER
93  );
94
95  Task_count = 0;
96
97  status = rtems_task_delete( RTEMS_SELF );
98  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
99}
100
101rtems_task Tasks(
102  rtems_task_argument argument
103)
104{
105  Task_count++;
106
107  if ( Task_count == 1 )
108    Timer_initialize();
109  else if ( Task_count == OPERATION_COUNT ) {
110    end_time = Read_timer();
111
112    put_time(
113      "rtems_task_wake_after (context switch)",
114      end_time,
115      OPERATION_COUNT,
116      overhead,
117      CALLING_OVERHEAD_TASK_WAKE_AFTER
118    );
119
120  puts( "*** END OF TEST 24 ***" );
121    exit( 0 );
122  }
123  (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
124}
Note: See TracBrowser for help on using the repository browser.