source: rtems/testsuites/libtests/cpuuse/init.c @ 1fbf17b

4.104.11
Last change on this file since 1fbf17b was 5a8e7503, checked in by Joel Sherrill <joel.sherrill@…>, on Feb 1, 2008 at 12:45:04 AM

2008-01-31 Joel Sherrill <joel.sherrill@…>

  • cpuuse/init.c, malloctest/init.c, monitor/init.c, monitor02/init.c, putenvtest/init.c, rtems++/Init.cc, rtmonuse/init.c, stackchk/init.c: Change TEST_INIT to CONFIGURE_INIT. Make tmacros.h available to all POSIX tests. Add a clock_settime case for < 1988.
  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 *  This is a clone of sp04 which has been modified to use the cpu monitoring
3 *  library.
4 *
5 *  Input parameters:
6 *    argument - task argument
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20#define CONFIGURE_INIT
21#include "system.h"
22
23rtems_extensions_table Extensions = {
24  NULL,                      /* task create user extension */
25  NULL,                      /* task start user extension */
26  NULL,                      /* task restart user extension */
27  NULL,                      /* task delete user extension */
28  Task_switch,               /* task switch user extension */
29  NULL,                      /* task begin user extension */
30  NULL,                      /* task exitted user extension */
31  NULL                       /* fatal error user extension */
32};
33
34rtems_task Init(
35  rtems_task_argument argument
36)
37{
38  rtems_status_code status;
39  rtems_time_of_day time;
40
41  puts( "\n\n*** CPU USAGE LIBRARY TEST ***" );
42  build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
43
44  status = rtems_clock_set( &time );
45  directive_failed( status, "rtems_clock_set" );
46
47  Extension_name[ 1 ] =  rtems_build_name( 'E', 'X', 'T', ' ' );
48
49  status = rtems_extension_create(
50    Extension_name[ 1 ],
51    &Extensions,
52    &Extension_id[ 1 ]
53  );
54  directive_failed( status, "rtems_extension_create" );
55
56  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
57  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
58  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
59
60  Run_count[ 1 ] = 0;
61  Run_count[ 2 ] = 0;
62  Run_count[ 3 ] = 0;
63
64  status = rtems_task_create(
65     Task_name[ 1 ],
66     1,
67     RTEMS_MINIMUM_STACK_SIZE * 2,
68     RTEMS_TIMESLICE,
69     RTEMS_FLOATING_POINT,
70     &Task_id[ 1 ]
71  );
72  directive_failed( status, "rtems_task_create of TA1" );
73
74  status = rtems_task_create(
75     Task_name[ 2 ],
76     1,
77     RTEMS_MINIMUM_STACK_SIZE * 2,
78     RTEMS_TIMESLICE,
79     RTEMS_FLOATING_POINT,
80     &Task_id[ 2 ]
81  );
82  directive_failed( status, "rtems_task_create of TA2" );
83
84  status = rtems_task_create(
85     Task_name[ 3 ],
86     1,
87     RTEMS_MINIMUM_STACK_SIZE * 2,
88     RTEMS_TIMESLICE,
89     RTEMS_FLOATING_POINT,
90     &Task_id[ 3 ]
91  );
92  directive_failed( status, "rtems_task_create of TA3" );
93
94  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
95  directive_failed( status, "rtems_task_start of TA1" );
96
97  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
98  directive_failed( status, "rtems_task_start of TA2" );
99
100  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
101  directive_failed( status, "rtems_task_start of TA3" );
102
103  /*
104   * We suspend the Init task rather than delete it so it still
105   * shows up in CPU Usage Report.  If we don't, the CPU Usage
106   * times will not add up to the time since last CPU Usage Reset.
107   */
108  status = rtems_task_suspend( RTEMS_SELF );
109  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
110}
Note: See TracBrowser for help on using the repository browser.