source: rtems/testsuites/tmitrontests/tmitronsem01/init.c @ 8f71a36

4.104.114.84.9
Last change on this file since 8f71a36 was 8f71a36, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 20, 2004 at 7:09:31 AM

Remove stray white spaces.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*  Init
2 *
3 *  This routine is the initialization task for this test program.
4 *  It is called from init_exec and has the responsibility for creating
5 *  and starting the tasks that make up the test.  If the time of day
6 *  clock is required for the test, it should also be set to a known
7 *  value by this function.
8 *
9 *  Input parameters:  NONE
10 *
11 *  Output parameters:  NONE
12 *
13 *  COPYRIGHT (c) 1989-1999.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.com/license/LICENSE.
19 *
20 *  $Id$
21 */
22
23#define TEST_INIT
24#include "system.h"
25#include <timesys.h>
26#include <stdio.h>
27
28void ITRON_Init( void )
29{
30  T_CSEM  pk_csem;
31  T_RSEM  pk_rsem;
32  int     index;
33
34  pk_csem.isemcnt = 2;
35  pk_csem.maxsem  = 3;
36  pk_csem.sematr  = TA_TFIFO;
37
38  printf( "\n\n*** TMITRON01 -- ITRON TIMING TEST ***\n" );
39
40  /*
41   *  time one invocation of cre_sem
42   */
43
44  Timer_initialize();
45    (void) cre_sem( 1, &pk_csem );
46  end_time = Read_timer();
47  put_time(
48    "cre_sem",
49    end_time,
50    1,
51    0,  /* no loop overhead to take out */
52    0   /* no calling overhead */
53  );
54
55  /*
56   *  time one invocation of del_sem
57   */
58
59  Timer_initialize();
60    (void) del_sem( 1 );
61  end_time = Read_timer();
62  put_time(
63    "del_sem",
64    end_time,
65    1,
66    0,  /* no loop overhead to take out */
67    0   /* no calling overhead */
68  );
69
70  pk_csem.isemcnt = 100;
71  pk_csem.maxsem  = 100;
72  pk_csem.sematr  = TA_TFIFO;
73  (void) cre_sem( 1, &pk_csem );
74
75  /*
76   *  time preq_sem (available)
77   */
78
79  Timer_initialize();
80    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
81      (void) preq_sem( 1 );
82  end_time = Read_timer();
83  put_time(
84    "preq_sem (available)",
85    end_time,
86    OPERATION_COUNT,
87    0,  /* don't take the loop overhead out */
88    0   /* no calling overhead */
89  );
90
91  /*
92   *  time preq_sem (not available)
93   */
94
95  Timer_initialize();
96    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
97      (void) preq_sem( 1 );
98  end_time = Read_timer();
99  put_time(
100    "preq_sem (not available)",
101    end_time,
102    OPERATION_COUNT,
103    0,  /* don't take the loop overhead out */
104    0   /* no calling overhead */
105  );
106
107  /*
108   *  time sig_sem (no waiting tasks)
109   */
110
111  Timer_initialize();
112    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
113      (void) sig_sem( 1 );
114  end_time = Read_timer();
115  put_time(
116    "sig_sem (no waiting tasks)",
117    end_time,
118    OPERATION_COUNT,
119    0,  /* don't take the loop overhead out */
120    0   /* no calling overhead */
121  );
122
123  /*
124   *  time ref_sem
125   */
126
127  Timer_initialize();
128    for ( index = 1 ; index<=OPERATION_COUNT ; index++ )
129      (void) ref_sem( 1, &pk_rsem );
130  end_time = Read_timer();
131  put_time(
132    "ref_sem",
133    end_time,
134    OPERATION_COUNT,
135    0,  /* don't take the loop overhead out */
136    0   /* no calling overhead */
137  );
138
139  printf( "\n\nXXX ADD BLOCKING AND PREEMPTING TIME TESTS\n\n" );
140
141
142  printf( "*** END OF TMITRON01 -- ITRON TIMING TEST ***\n" );
143  rtems_test_exit( 0 );
144}
Note: See TracBrowser for help on using the repository browser.