source: rtems/c/src/tests/tmtests/tm24/task1.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

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