Mercurial > flash_v2
annotate packages/kernel/current/tests/tm_basic.cxx @ 394:7ca632b46393
* tests/tm_basic.cxx: Include infra/diag.h and removed the
incorrect prototype for diag_printf
| author | asl |
|---|---|
| date | Mon, 28 Oct 2002 16:34:21 +0000 |
| parents | d2c90368aeef |
| children | 4bfb0d444b05 |
| rev | line source |
|---|---|
| 0 | 1 //========================================================================== |
| 2 // | |
| 3 // tm_basic.cxx | |
| 4 // | |
| 5 // Basic timing test / scaffolding | |
| 6 // | |
| 7 //========================================================================== | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
8 //####ECOSGPLCOPYRIGHTBEGIN#### |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
9 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
10 // This file is part of eCos, the Embedded Configurable Operating System. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
12 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
13 // eCos is free software; you can redistribute it and/or modify it under |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
14 // the terms of the GNU General Public License as published by the Free |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
15 // Software Foundation; either version 2 or (at your option) any later version. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
16 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
20 // for more details. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
21 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
22 // You should have received a copy of the GNU General Public License along |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
23 // with eCos; if not, write to the Free Software Foundation, Inc., |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
25 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
26 // As a special exception, if other files instantiate templates or use macros |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
27 // or inline functions from this file, or you compile this file and link it |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
28 // with other works to produce a work based on this file, this file does not |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
29 // by itself cause the resulting work to be covered by the GNU General Public |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
30 // License. However the source code for this file must still be made available |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
31 // in accordance with section (3) of the GNU General Public License. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
32 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
33 // This exception does not invalidate any other reasons why a work based on |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
34 // this file might be covered by the GNU General Public License. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
35 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
37 // at http://sources.redhat.com/ecos/ecos-license/ |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
38 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
39 //####ECOSGPLCOPYRIGHTEND#### |
| 0 | 40 //========================================================================== |
| 41 //#####DESCRIPTIONBEGIN#### | |
| 42 // | |
| 43 // Author(s): gthomas | |
| 44 // Contributors: gthomas | |
| 45 // Date: 1998-10-19 | |
| 2 | 46 // Description: Very simple kernel timing test |
| 0 | 47 //####DESCRIPTIONEND#### |
| 48 | |
| 49 #include <pkgconf/kernel.h> | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
50 #include <pkgconf/hal.h> |
| 0 | 51 |
| 52 #include <cyg/kernel/sched.hxx> | |
| 53 #include <cyg/kernel/thread.hxx> | |
| 54 #include <cyg/kernel/thread.inl> | |
| 55 #include <cyg/kernel/mutex.hxx> | |
| 56 #include <cyg/kernel/sema.hxx> | |
| 57 #include <cyg/kernel/sched.inl> | |
| 58 #include <cyg/kernel/clock.hxx> | |
| 59 #include <cyg/kernel/clock.inl> | |
| 60 #include <cyg/kernel/kapi.h> | |
| 61 | |
| 62 #include <cyg/infra/testcase.h> | |
|
394
7ca632b46393
* tests/tm_basic.cxx: Include infra/diag.h and removed the
asl
parents:
210
diff
changeset
|
63 #include <cyg/infra/diag.h> |
| 2 | 64 |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
65 #include <cyg/kernel/test/stackmon.h> |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
66 #include CYGHWR_MEMORY_LAYOUT_H |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
67 |
| 2 | 68 // Define this to see the statistics with the first sample datum removed. |
| 69 // This can expose the effects of caches on the speed of operations. | |
| 70 #undef STATS_WITHOUT_FIRST_SAMPLE | |
| 71 | |
| 72 #if defined(CYGFUN_KERNEL_API_C) && \ | |
| 73 defined(CYGSEM_KERNEL_SCHED_MLQUEUE) && \ | |
| 74 defined(CYGVAR_KERNEL_COUNTERS_CLOCK) && \ | |
|
76
435cced73e2f
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents:
66
diff
changeset
|
75 !defined(CYGDBG_INFRA_DIAG_USE_DEVICE) && \ |
| 2 | 76 (CYGNUM_KERNEL_SCHED_PRIORITIES > 12) |
| 77 | |
| 0 | 78 #define NTHREADS 1 |
| 79 #include "testaux.hxx" | |
| 80 | |
| 81 // Structure used to keep track of times | |
| 82 typedef struct fun_times { | |
| 83 cyg_uint32 start; | |
| 84 cyg_uint32 end; | |
| 85 } fun_times; | |
| 86 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
87 #define STACK_SIZE CYGNUM_HAL_STACK_SIZE_MINIMUM |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
88 |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
89 #ifdef CYGMEM_REGION_ram_SIZE |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
90 #define CYG_THREAD_OVERHEAD (STACK_SIZE+sizeof(cyg_thread)+(sizeof(fun_times)*2)) |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
91 #define NTEST_THREADS ((CYGMEM_REGION_ram_SIZE/16)/CYG_THREAD_OVERHEAD) |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
92 #define CYG_MUTEX_OVERHEAD (sizeof(cyg_mutex_t)+sizeof(fun_times)) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
93 #define NMUTEXES ((CYGMEM_REGION_ram_SIZE/16)/CYG_MUTEX_OVERHEAD) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
94 #define CYG_MBOX_OVERHEAD (sizeof(cyg_mbox)+sizeof(fun_times)) |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
95 #define NMBOXES ((CYGMEM_REGION_ram_SIZE/24)/CYG_MBOX_OVERHEAD) |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
96 #define CYG_SEMAPHORE_OVERHEAD (sizeof(cyg_sem_t)+sizeof(fun_times)) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
97 #define NSEMAPHORES ((CYGMEM_REGION_ram_SIZE/16)/CYG_SEMAPHORE_OVERHEAD) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
98 #define CYG_COUNTER_OVERHEAD (sizeof(cyg_counter)+sizeof(fun_times)) |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
99 #define NCOUNTERS ((CYGMEM_REGION_ram_SIZE/24)/CYG_COUNTER_OVERHEAD) |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
100 #define CYG_ALARM_OVERHEAD (sizeof(cyg_alarm)+sizeof(fun_times)) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
101 #define NALARMS ((CYGMEM_REGION_ram_SIZE/16)/CYG_ALARM_OVERHEAD) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
102 #else |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
103 // Defaults |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
104 #define NTEST_THREADS 16 |
| 0 | 105 #define NMUTEXES 32 |
| 106 #define NMBOXES 32 | |
| 107 #define NSEMAPHORES 32 | |
| 108 #define NCOUNTERS 32 | |
| 109 #define NALARMS 32 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
110 #endif |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
111 |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
112 #define NSAMPLES 32 |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
113 #define NTHREAD_SWITCHES 128 |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
114 #define NSCHEDS 128 |
| 0 | 115 |
| 2 | 116 #define NSAMPLES_SIM 2 |
| 117 #define NTEST_THREADS_SIM 2 | |
| 118 #define NTHREAD_SWITCHES_SIM 4 | |
| 119 #define NMUTEXES_SIM 2 | |
| 120 #define NMBOXES_SIM 2 | |
| 121 #define NSEMAPHORES_SIM 2 | |
| 122 #define NSCHEDS_SIM 4 | |
| 123 #define NCOUNTERS_SIM 2 | |
| 124 #define NALARMS_SIM 2 | |
| 125 | |
| 126 static int nsamples; | |
| 127 static int ntest_threads; | |
| 128 static int nthread_switches; | |
| 129 static int nmutexes; | |
| 130 static int nmboxes; | |
| 131 static int nsemaphores; | |
| 132 static int nscheds; | |
| 133 static int ncounters; | |
| 134 static int nalarms; | |
| 135 | |
| 0 | 136 static char stacks[NTEST_THREADS][STACK_SIZE]; |
| 137 static cyg_thread test_threads[NTEST_THREADS]; | |
| 138 static cyg_handle_t threads[NTEST_THREADS]; | |
| 139 static int overhead; | |
| 140 static cyg_sem_t synchro; | |
| 141 static fun_times thread_ft[NTEST_THREADS]; | |
| 142 | |
| 143 static fun_times test2_ft[NTHREAD_SWITCHES]; | |
| 144 | |
| 145 static cyg_mutex_t test_mutexes[NMUTEXES]; | |
| 146 static fun_times mutex_ft[NMUTEXES]; | |
| 147 static cyg_thread mutex_test_thread; | |
| 148 static cyg_handle_t mutex_test_thread_handle; | |
| 149 | |
| 150 static cyg_mbox test_mboxes[NMBOXES]; | |
| 151 static cyg_handle_t test_mbox_handles[NMBOXES]; | |
| 152 static fun_times mbox_ft[NMBOXES]; | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
153 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT |
| 0 | 154 static cyg_thread mbox_test_thread; |
| 155 static cyg_handle_t mbox_test_thread_handle; | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
156 #endif |
| 0 | 157 |
| 158 static cyg_sem_t test_semaphores[NSEMAPHORES]; | |
| 159 static fun_times semaphore_ft[NSEMAPHORES]; | |
| 160 static cyg_thread semaphore_test_thread; | |
| 161 static cyg_handle_t semaphore_test_thread_handle; | |
| 162 | |
| 163 static fun_times sched_ft[NSCHEDS]; | |
| 164 | |
| 165 static cyg_counter test_counters[NCOUNTERS]; | |
| 166 static cyg_handle_t counters[NCOUNTERS]; | |
| 167 static fun_times counter_ft[NCOUNTERS]; | |
| 168 | |
| 169 static cyg_alarm test_alarms[NALARMS]; | |
| 170 static cyg_handle_t alarms[NALARMS]; | |
| 171 static fun_times alarm_ft[NALARMS]; | |
| 172 | |
| 2 | 173 static long rtc_resolution[] = CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION; |
| 174 static long ns_per_system_clock; | |
| 175 | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
176 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 2 | 177 // Data kept by kernel real time clock measuring clock interrupt latency |
| 178 extern cyg_tick_count total_clock_latency, total_clock_interrupts; | |
| 179 extern cyg_int32 min_clock_latency, max_clock_latency; | |
| 180 extern bool measure_clock_latency; | |
| 181 #endif | |
| 182 | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
183 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY) |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
184 extern cyg_tick_count total_clock_dsr_latency, total_clock_dsr_calls; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
185 extern cyg_int32 min_clock_dsr_latency, max_clock_dsr_latency; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
186 extern bool measure_clock_latency; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
187 #endif |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
188 |
| 0 | 189 void run_sched_tests(void); |
| 190 void run_thread_tests(void); | |
| 191 void run_thread_switch_test(void); | |
| 192 void run_mutex_tests(void); | |
| 193 void run_mutex_circuit_test(void); | |
| 194 void run_mbox_tests(void); | |
| 195 void run_mbox_circuit_test(void); | |
| 196 void run_semaphore_tests(void); | |
| 197 void run_semaphore_circuit_test(void); | |
| 198 void run_counter_tests(void); | |
| 199 void run_alarm_tests(void); | |
| 200 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
201 #ifndef max |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
202 #define max(n,m) (m > n ? n : m) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
203 #endif |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
204 |
| 0 | 205 // Wait until a clock tick [real time clock] has passed. This should keep it |
| 206 // from happening again during a measurement, thus minimizing any fluctuations | |
| 207 void | |
| 208 wait_for_tick(void) | |
| 209 { | |
| 2 | 210 cyg_tick_count_t tv0, tv1; |
| 211 tv0 = cyg_current_time(); | |
| 0 | 212 while (true) { |
| 2 | 213 tv1 = cyg_current_time(); |
| 214 if (tv1 != tv0) break; | |
| 215 } | |
| 216 } | |
| 217 | |
| 218 // Display a number of ticks as microseconds | |
| 219 // Note: for improved calculation significance, values are kept in ticks*1000 | |
| 220 void | |
| 221 show_ticks_in_us(cyg_uint32 ticks) | |
| 222 { | |
| 223 long long ns; | |
| 224 ns = (ns_per_system_clock * (long long)ticks) / CYGNUM_KERNEL_COUNTERS_RTC_PERIOD; | |
| 225 ns += 5; // for rounding to .01us | |
| 226 diag_printf("%5d.%02d", (int)(ns/1000), (int)((ns%1000)/10)); | |
| 227 } | |
| 228 | |
| 229 // | |
| 230 // If the kernel is instrumented to measure clock interrupt latency, these | |
| 231 // measurements can be drastically perturbed by printing via "diag_printf()" | |
| 232 // since that code may run with interrupts disabled for long periods. | |
| 233 // | |
| 234 // In order to get accurate/reasonable latency figures _for the kernel | |
| 235 // primitive functions beint tested_, the kernel's latency measurements | |
| 236 // are suspended while the printing actually takes place. | |
| 237 // | |
| 238 // The measurements are reenabled after the printing, thus allowing for | |
| 239 // fair measurements of the kernel primitives, which are not distorted | |
| 240 // by the printing mechanisms. | |
| 241 | |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
242 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 2 | 243 void |
| 244 disable_clock_latency_measurement(void) | |
| 245 { | |
| 246 wait_for_tick(); | |
| 247 measure_clock_latency = false; | |
| 248 } | |
| 249 | |
| 250 void | |
| 251 enable_clock_latency_measurement(void) | |
| 252 { | |
| 253 wait_for_tick(); | |
| 254 measure_clock_latency = true; | |
| 255 } | |
| 256 | |
| 257 // Ensure that the measurements are reasonable (no startup anomalies) | |
| 258 void | |
| 259 reset_clock_latency_measurement(void) | |
| 260 { | |
| 261 disable_clock_latency_measurement(); | |
| 262 total_clock_latency = 0; | |
| 263 total_clock_interrupts = 0; | |
| 264 min_clock_latency = 0x7FFFFFFF; | |
| 265 max_clock_latency = 0; | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
266 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY) |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
267 total_clock_dsr_latency = 0; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
268 total_clock_dsr_calls = 0; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
269 min_clock_dsr_latency = 0x7FFFFFFF; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
270 max_clock_dsr_latency = 0; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
271 #endif |
| 2 | 272 enable_clock_latency_measurement(); |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
273 |
| 2 | 274 } |
| 275 #else | |
| 276 #define disable_clock_latency_measurement() | |
| 277 #define enable_clock_latency_measurement() | |
| 278 #define reset_clock_latency_measurement() | |
| 279 #endif | |
| 280 | |
| 281 void | |
| 282 show_times_hdr(void) | |
| 283 { | |
| 284 disable_clock_latency_measurement(); | |
| 285 diag_printf("\n"); | |
| 286 diag_printf(" Confidence\n"); | |
| 287 diag_printf(" Ave Min Max Var Ave Min Function\n"); | |
| 288 diag_printf(" ====== ====== ====== ====== ========== ========\n"); | |
| 289 enable_clock_latency_measurement(); | |
| 290 } | |
| 291 | |
| 292 void | |
| 293 show_times_detail(fun_times ft[], int nsamples, char *title, bool ignore_first) | |
| 294 { | |
| 295 int i, delta, min, max, con_ave, con_min, ave_dev; | |
| 296 int start_sample, total_samples; | |
| 297 cyg_int32 total, ave; | |
| 298 | |
| 299 if (ignore_first) { | |
| 300 start_sample = 1; | |
| 301 total_samples = nsamples-1; | |
| 302 } else { | |
| 303 start_sample = 0; | |
| 304 total_samples = nsamples; | |
| 0 | 305 } |
| 2 | 306 total = 0; |
| 307 min = 0x7FFFFFFF; | |
| 308 max = 0; | |
| 309 for (i = start_sample; i < nsamples; i++) { | |
| 310 if (ft[i].end < ft[i].start) { | |
| 311 // Clock wrapped around (timer tick) | |
| 312 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start; | |
| 313 } else { | |
| 314 delta = ft[i].end - ft[i].start; | |
| 315 } | |
| 316 delta -= overhead; | |
| 317 if (delta < 0) delta = 0; | |
| 318 delta *= 1000; | |
| 319 total += delta; | |
| 320 if (delta < min) min = delta; | |
| 321 if (delta > max) max = delta; | |
| 322 } | |
| 323 ave = total / total_samples; | |
| 324 total = 0; | |
| 325 ave_dev = 0; | |
| 326 for (i = start_sample; i < nsamples; i++) { | |
| 327 if (ft[i].end < ft[i].start) { | |
| 328 // Clock wrapped around (timer tick) | |
| 329 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start; | |
| 330 } else { | |
| 331 delta = ft[i].end - ft[i].start; | |
| 332 } | |
| 333 delta -= overhead; | |
| 334 if (delta < 0) delta = 0; | |
| 335 delta *= 1000; | |
| 336 delta = delta - ave; | |
| 337 if (delta < 0) delta = -delta; | |
| 338 ave_dev += delta; | |
| 339 } | |
| 340 ave_dev /= total_samples; | |
| 341 con_ave = 0; | |
| 342 con_min = 0; | |
| 343 for (i = start_sample; i < nsamples; i++) { | |
| 344 if (ft[i].end < ft[i].start) { | |
| 345 // Clock wrapped around (timer tick) | |
| 346 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start; | |
| 347 } else { | |
| 348 delta = ft[i].end - ft[i].start; | |
| 349 } | |
| 350 delta -= overhead; | |
| 351 if (delta < 0) delta = 0; | |
| 352 delta *= 1000; | |
| 353 if ((delta <= (ave+ave_dev)) && (delta >= (ave-ave_dev))) con_ave++; | |
| 354 if ((delta <= (min+ave_dev)) && (delta >= (min-ave_dev))) con_min++; | |
| 355 } | |
| 356 con_ave = (con_ave * 100) / total_samples; | |
| 357 con_min = (con_min * 100) / total_samples; | |
| 358 show_ticks_in_us(ave); | |
| 359 show_ticks_in_us(min); | |
| 360 show_ticks_in_us(max); | |
| 361 show_ticks_in_us(ave_dev); | |
| 362 disable_clock_latency_measurement(); | |
| 363 diag_printf(" %3d%% %3d%%", con_ave, con_min); | |
| 364 diag_printf(" %s\n", title); | |
| 365 enable_clock_latency_measurement(); | |
| 366 } | |
| 367 | |
| 368 void | |
| 369 show_times(fun_times ft[], int nsamples, char *title) | |
| 370 { | |
| 371 show_times_detail(ft, nsamples, title, false); | |
| 372 #ifdef STATS_WITHOUT_FIRST_SAMPLE | |
| 373 show_times_detail(ft, nsamples, "", true); | |
| 374 #endif | |
| 375 } | |
| 376 | |
| 377 void | |
| 378 show_test_parameters(void) | |
| 379 { | |
| 380 disable_clock_latency_measurement(); | |
| 381 diag_printf("\nTesting parameters:\n"); | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
382 diag_printf(" Clock samples: %5d\n", nsamples); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
383 diag_printf(" Threads: %5d\n", ntest_threads); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
384 diag_printf(" Thread switches: %5d\n", nthread_switches); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
385 diag_printf(" Mutexes: %5d\n", nmutexes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
386 diag_printf(" Mailboxes: %5d\n", nmboxes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
387 diag_printf(" Semaphores: %5d\n", nsemaphores); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
388 diag_printf(" Scheduler operations: %5d\n", nscheds); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
389 diag_printf(" Counters: %5d\n", ncounters); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
390 diag_printf(" Alarms: %5d\n", nalarms); |
| 2 | 391 diag_printf("\n"); |
| 392 enable_clock_latency_measurement(); | |
| 393 } | |
| 394 | |
| 395 void | |
| 396 end_of_test_group(void) | |
| 397 { | |
| 398 disable_clock_latency_measurement(); | |
| 399 diag_printf("\n"); | |
| 400 enable_clock_latency_measurement(); | |
| 0 | 401 } |
| 402 | |
| 403 // Compute a name for a thread | |
| 404 char * | |
| 405 thread_name(char *basename, int indx) { | |
| 406 return "<<NULL>>"; // Not currently used | |
| 407 } | |
| 408 | |
| 409 // test0 - null test, never executed | |
| 410 void | |
| 411 test0(cyg_uint32 indx) | |
| 412 { | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
413 #ifndef CYGPKG_KERNEL_SMP_SUPPORT |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
414 // In SMP, somw of these threads will execute |
| 0 | 415 diag_printf("test0.%d executed?\n", indx); |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
416 #endif |
| 0 | 417 cyg_thread_exit(); |
| 418 } | |
| 419 | |
| 420 // test1 - empty test, simply exit. Last thread signals parent. | |
| 421 void | |
| 422 test1(cyg_uint32 indx) | |
| 423 { | |
| 2 | 424 if (indx == (cyg_uint32)(ntest_threads-1)) { |
| 0 | 425 cyg_semaphore_post(&synchro); // Signal that last thread is dying |
| 426 } | |
| 427 cyg_thread_exit(); | |
| 428 } | |
| 429 | |
| 430 // test2 - measure thread switch times | |
| 431 void | |
| 432 test2(cyg_uint32 indx) | |
| 433 { | |
| 434 int i; | |
| 2 | 435 for (i = 0; i < nthread_switches; i++) { |
| 0 | 436 if (indx == 0) { |
| 437 HAL_CLOCK_READ(&test2_ft[i].start); | |
| 438 } else { | |
| 439 HAL_CLOCK_READ(&test2_ft[i].end); | |
| 440 } | |
| 441 cyg_thread_yield(); | |
| 442 } | |
| 443 if (indx == 1) { | |
| 444 cyg_semaphore_post(&synchro); | |
| 445 } | |
| 446 cyg_thread_exit(); | |
| 447 } | |
| 448 | |
| 449 // Full-circuit mutex unlock/lock test | |
| 450 void | |
| 451 mutex_test(cyg_uint32 indx) | |
| 452 { | |
| 453 int i; | |
| 454 cyg_mutex_lock(&test_mutexes[0]); | |
| 2 | 455 for (i = 0; i < nmutexes; i++) { |
| 0 | 456 cyg_semaphore_wait(&synchro); |
| 457 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 458 HAL_CLOCK_READ(&mutex_ft[i].start); | |
| 459 cyg_mutex_unlock(&test_mutexes[0]); | |
| 460 cyg_mutex_lock(&test_mutexes[0]); | |
| 461 cyg_semaphore_post(&synchro); | |
| 462 } | |
| 463 cyg_thread_exit(); | |
| 464 } | |
| 465 | |
| 466 // Full-circuit mbox put/get test | |
| 467 void | |
| 468 mbox_test(cyg_uint32 indx) | |
| 469 { | |
| 470 void *item; | |
| 471 do { | |
| 472 item = cyg_mbox_get(test_mbox_handles[0]); | |
| 473 HAL_CLOCK_READ(&mbox_ft[(int)item].end); | |
| 474 cyg_semaphore_post(&synchro); | |
| 2 | 475 } while ((int)item != (nmboxes-1)); |
| 0 | 476 cyg_thread_exit(); |
| 477 } | |
| 478 | |
| 479 // Full-circuit semaphore post/wait test | |
| 480 void | |
| 481 semaphore_test(cyg_uint32 indx) | |
| 482 { | |
| 483 int i; | |
| 2 | 484 for (i = 0; i < nsemaphores; i++) { |
| 0 | 485 cyg_semaphore_wait(&test_semaphores[0]); |
| 486 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 487 cyg_semaphore_post(&synchro); | |
| 488 } | |
| 489 cyg_thread_exit(); | |
| 490 } | |
| 491 | |
| 2 | 492 // |
| 493 // This set of tests is used to measure kernel primitives that deal with threads | |
| 494 // | |
| 0 | 495 void |
| 496 run_thread_tests(void) | |
| 497 { | |
| 498 int i; | |
| 499 cyg_priority_t prio; | |
| 500 | |
| 501 // Set my priority higher than any I plan to create | |
| 502 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 503 | |
| 504 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 505 for (i = 0; i < ntest_threads; i++) { |
| 0 | 506 HAL_CLOCK_READ(&thread_ft[i].start); |
| 507 cyg_thread_create(10, // Priority - just a number | |
| 508 test0, // entry | |
| 509 i, // index | |
| 510 thread_name("thread", i), // Name | |
| 511 &stacks[i][0], // Stack | |
| 512 STACK_SIZE, // Size | |
| 513 &threads[i], // Handle | |
| 514 &test_threads[i] // Thread data structure | |
| 515 ); | |
| 516 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 517 } | |
| 2 | 518 show_times(thread_ft, ntest_threads, "Create thread"); |
| 0 | 519 |
| 520 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 521 for (i = 0; i < ntest_threads; i++) { |
| 0 | 522 HAL_CLOCK_READ(&thread_ft[i].start); |
| 523 cyg_thread_yield(); | |
| 524 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 525 } | |
| 2 | 526 show_times(thread_ft, ntest_threads, "Yield thread [all suspended]"); |
| 0 | 527 |
| 528 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 529 for (i = 0; i < ntest_threads; i++) { |
| 0 | 530 HAL_CLOCK_READ(&thread_ft[i].start); |
| 531 cyg_thread_suspend(threads[i]); | |
| 532 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 533 } | |
| 2 | 534 show_times(thread_ft, ntest_threads, "Suspend [suspended] thread"); |
| 0 | 535 |
| 536 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 537 for (i = 0; i < ntest_threads; i++) { |
| 0 | 538 HAL_CLOCK_READ(&thread_ft[i].start); |
| 539 cyg_thread_resume(threads[i]); | |
| 540 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 541 } | |
| 2 | 542 show_times(thread_ft, ntest_threads, "Resume thread"); |
| 0 | 543 |
| 544 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 545 for (i = 0; i < ntest_threads; i++) { |
| 0 | 546 HAL_CLOCK_READ(&thread_ft[i].start); |
| 547 cyg_thread_set_priority(threads[i], 11); | |
| 548 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 549 } | |
| 2 | 550 show_times(thread_ft, ntest_threads, "Set priority"); |
| 0 | 551 |
| 552 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 553 for (i = 0; i < ntest_threads; i++) { |
| 0 | 554 HAL_CLOCK_READ(&thread_ft[i].start); |
| 555 prio = cyg_thread_get_priority(threads[i]); | |
| 556 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 557 } | |
| 2 | 558 show_times(thread_ft, ntest_threads, "Get priority"); |
| 0 | 559 |
| 560 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 561 for (i = 0; i < ntest_threads; i++) { |
| 0 | 562 HAL_CLOCK_READ(&thread_ft[i].start); |
| 563 cyg_thread_kill(threads[i]); | |
| 564 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 565 } | |
| 2 | 566 show_times(thread_ft, ntest_threads, "Kill [suspended] thread"); |
| 0 | 567 |
| 568 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 569 for (i = 0; i < ntest_threads; i++) { |
| 0 | 570 HAL_CLOCK_READ(&thread_ft[i].start); |
| 571 cyg_thread_yield(); | |
| 572 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 573 } | |
| 2 | 574 show_times(thread_ft, ntest_threads, "Yield [no other] thread"); |
| 0 | 575 |
| 576 // Set my priority higher than any I plan to create | |
| 577 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 578 | |
| 579 // Recreate the test set | |
| 2 | 580 for (i = 0; i < ntest_threads; i++) { |
| 0 | 581 cyg_thread_create(10, // Priority - just a number |
| 582 test0, // entry | |
| 583 i, // index | |
| 584 thread_name("thread", i), // Name | |
| 585 &stacks[i][0], // Stack | |
| 586 STACK_SIZE, // Size | |
| 587 &threads[i], // Handle | |
| 588 &test_threads[i] // Thread data structure | |
| 589 ); | |
| 590 } | |
| 591 | |
| 592 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 593 for (i = 0; i < ntest_threads; i++) { |
| 594 HAL_CLOCK_READ(&thread_ft[i].start); | |
| 595 cyg_thread_resume(threads[i]); | |
| 596 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 597 } | |
| 598 show_times(thread_ft, ntest_threads, "Resume [suspended low prio] thread"); | |
| 599 | |
| 600 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 601 for (i = 0; i < ntest_threads; i++) { | |
| 0 | 602 HAL_CLOCK_READ(&thread_ft[i].start); |
| 603 cyg_thread_resume(threads[i]); | |
| 604 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 605 } | |
| 2 | 606 show_times(thread_ft, ntest_threads, "Resume [runnable low prio] thread"); |
| 0 | 607 |
| 608 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 609 for (i = 0; i < ntest_threads; i++) { |
| 0 | 610 HAL_CLOCK_READ(&thread_ft[i].start); |
| 2 | 611 cyg_thread_suspend(threads[i]); |
| 0 | 612 HAL_CLOCK_READ(&thread_ft[i].end); |
| 613 } | |
| 2 | 614 show_times(thread_ft, ntest_threads, "Suspend [runnable] thread"); |
| 615 | |
| 0 | 616 |
| 617 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 618 for (i = 0; i < ntest_threads; i++) { |
| 619 HAL_CLOCK_READ(&thread_ft[i].start); | |
| 620 cyg_thread_yield(); | |
| 621 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 622 } | |
| 623 show_times(thread_ft, ntest_threads, "Yield [only low prio] thread"); | |
| 624 | |
| 625 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 626 for (i = 0; i < ntest_threads; i++) { | |
| 0 | 627 HAL_CLOCK_READ(&thread_ft[i].start); |
| 628 cyg_thread_suspend(threads[i]); | |
| 629 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 630 } | |
| 2 | 631 show_times(thread_ft, ntest_threads, "Suspend [runnable->not runnable]"); |
| 632 for (i = 0; i < ntest_threads; i++) { | |
| 0 | 633 cyg_thread_resume(threads[i]); |
| 634 } | |
| 635 | |
| 636 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 637 for (i = 0; i < ntest_threads; i++) { |
| 0 | 638 HAL_CLOCK_READ(&thread_ft[i].start); |
| 639 cyg_thread_kill(threads[i]); | |
| 640 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 641 } | |
| 2 | 642 show_times(thread_ft, ntest_threads, "Kill [runnable] thread"); |
| 643 | |
| 644 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 645 for (i = 0; i < ntest_threads; i++) { | |
| 646 HAL_CLOCK_READ(&thread_ft[i].start); | |
| 647 cyg_thread_delete(threads[i]); | |
| 648 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 649 } | |
| 650 show_times(thread_ft, ntest_threads, "Destroy [dead] thread"); | |
| 651 | |
| 652 // Recreate the test set | |
| 653 for (i = 0; i < ntest_threads; i++) { | |
| 654 cyg_thread_create(10, // Priority - just a number | |
| 655 test0, // entry | |
| 656 i, // index | |
| 657 thread_name("thread", i), // Name | |
| 658 &stacks[i][0], // Stack | |
| 659 STACK_SIZE, // Size | |
| 660 &threads[i], // Handle | |
| 661 &test_threads[i] // Thread data structure | |
| 662 ); | |
| 663 cyg_thread_resume(threads[i]); | |
| 664 } | |
| 665 | |
| 666 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 667 for (i = 0; i < ntest_threads; i++) { | |
| 668 HAL_CLOCK_READ(&thread_ft[i].start); | |
| 669 cyg_thread_delete(threads[i]); | |
| 670 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 671 } | |
| 672 show_times(thread_ft, ntest_threads, "Destroy [runnable] thread"); | |
| 673 | |
| 0 | 674 // Set my priority lower than any I plan to create |
| 675 cyg_thread_set_priority(cyg_thread_self(), 3); | |
| 676 | |
| 677 // Set up the end-of-threads synchronizer | |
| 678 cyg_semaphore_init(&synchro, 0); | |
| 679 | |
| 680 // Recreate the test set | |
| 2 | 681 for (i = 0; i < ntest_threads; i++) { |
| 0 | 682 cyg_thread_create(2, // Priority - just a number |
| 683 test1, // entry | |
| 684 i, // index | |
| 685 thread_name("thread", i), // Name | |
| 686 &stacks[i][0], // Stack | |
| 687 STACK_SIZE, // Size | |
| 688 &threads[i], // Handle | |
| 689 &test_threads[i] // Thread data structure | |
| 690 ); | |
| 691 } | |
| 692 | |
| 693 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 694 for (i = 0; i < ntest_threads; i++) { |
| 0 | 695 HAL_CLOCK_READ(&thread_ft[i].start); |
| 696 cyg_thread_resume(threads[i]); | |
| 697 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 698 } | |
| 2 | 699 show_times(thread_ft, ntest_threads, "Resume [high priority] thread"); |
| 0 | 700 cyg_semaphore_wait(&synchro); // Wait for all threads to finish |
| 701 // Make sure they are all dead | |
| 2 | 702 for (i = 0; i < ntest_threads; i++) { |
| 703 cyg_thread_delete(threads[i]); | |
| 0 | 704 } |
| 705 | |
| 706 run_thread_switch_test(); | |
| 2 | 707 end_of_test_group(); |
| 0 | 708 } |
| 709 | |
| 710 void | |
| 711 run_thread_switch_test(void) | |
| 712 { | |
| 713 int i; | |
| 714 | |
| 715 // Set up for thread context switch | |
| 716 for (i = 0; i < 2; i++) { | |
| 717 cyg_thread_create(10, // Priority - just a number | |
| 718 test2, // entry | |
| 719 i, // index | |
| 720 thread_name("thread", i), // Name | |
| 721 &stacks[i][0], // Stack | |
| 722 STACK_SIZE, // Size | |
| 723 &threads[i], // Handle | |
| 724 &test_threads[i] // Thread data structure | |
| 725 ); | |
| 726 cyg_thread_resume(threads[i]); | |
| 727 } | |
| 728 // Set up the end-of-threads synchronizer | |
| 729 cyg_semaphore_init(&synchro, 0); | |
| 730 cyg_semaphore_wait(&synchro); | |
| 731 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 732 show_times(test2_ft, nthread_switches, "Thread switch"); |
| 0 | 733 // Clean up |
| 734 for (i = 0; i < 2; i++) { | |
| 2 | 735 cyg_thread_delete(threads[i]); |
| 0 | 736 } |
| 737 } | |
| 738 | |
| 739 void | |
| 740 run_mutex_tests(void) | |
| 741 { | |
| 742 int i; | |
| 743 | |
| 744 // Mutex primitives | |
| 745 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 746 for (i = 0; i < nmutexes; i++) { |
| 0 | 747 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 748 cyg_mutex_init(&test_mutexes[i]); | |
| 749 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 750 } | |
| 2 | 751 show_times(mutex_ft, nmutexes, "Init mutex"); |
| 0 | 752 |
| 753 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 754 for (i = 0; i < nmutexes; i++) { |
| 0 | 755 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 756 cyg_mutex_lock(&test_mutexes[i]); | |
| 757 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 758 } | |
| 2 | 759 show_times(mutex_ft, nmutexes, "Lock [unlocked] mutex"); |
| 0 | 760 |
| 761 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 762 for (i = 0; i < nmutexes; i++) { |
| 0 | 763 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 764 cyg_mutex_unlock(&test_mutexes[i]); | |
| 765 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 766 } | |
| 2 | 767 show_times(mutex_ft, nmutexes, "Unlock [locked] mutex"); |
| 0 | 768 |
| 769 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 770 for (i = 0; i < nmutexes; i++) { |
| 0 | 771 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 772 cyg_mutex_trylock(&test_mutexes[i]); | |
| 773 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 774 } | |
| 2 | 775 show_times(mutex_ft, nmutexes, "Trylock [unlocked] mutex"); |
| 0 | 776 |
| 777 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 778 for (i = 0; i < nmutexes; i++) { |
| 0 | 779 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 780 cyg_mutex_trylock(&test_mutexes[i]); | |
| 781 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 782 } | |
| 2 | 783 show_times(mutex_ft, nmutexes, "Trylock [locked] mutex"); |
| 0 | 784 |
|
38
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
785 // Must unlock mutices before destroying them. |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
786 for (i = 0; i < nmutexes; i++) { |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
787 cyg_mutex_unlock(&test_mutexes[i]); |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
788 } |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
789 |
| 0 | 790 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
| 2 | 791 for (i = 0; i < nmutexes; i++) { |
| 0 | 792 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 793 cyg_mutex_destroy(&test_mutexes[i]); | |
| 794 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 795 } | |
| 2 | 796 show_times(mutex_ft, nmutexes, "Destroy mutex"); |
| 0 | 797 run_mutex_circuit_test(); |
| 2 | 798 end_of_test_group(); |
| 0 | 799 } |
| 800 | |
| 801 void | |
| 802 run_mutex_circuit_test(void) | |
| 803 { | |
| 804 int i; | |
| 805 // Set my priority lower than any I plan to create | |
| 806 cyg_thread_set_priority(cyg_thread_self(), 4); | |
| 807 // Set up for full mutex unlock/lock test | |
| 808 cyg_mutex_init(&test_mutexes[0]); | |
| 809 cyg_semaphore_init(&synchro, 0); | |
| 810 cyg_thread_create(3, // Priority - just a number | |
| 811 mutex_test, // entry | |
| 812 0, // index | |
| 813 thread_name("thread", 0), // Name | |
| 814 &stacks[0][0], // Stack | |
| 815 STACK_SIZE, // Size | |
| 816 &mutex_test_thread_handle, // Handle | |
| 817 &mutex_test_thread // Thread data structure | |
| 818 ); | |
| 819 cyg_thread_resume(mutex_test_thread_handle); | |
| 820 // Need to raise priority so that this thread will block on the "lock" | |
| 821 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 2 | 822 for (i = 0; i < nmutexes; i++) { |
| 0 | 823 cyg_semaphore_post(&synchro); |
| 824 cyg_mutex_lock(&test_mutexes[0]); | |
| 825 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 826 cyg_mutex_unlock(&test_mutexes[0]); | |
| 827 cyg_semaphore_wait(&synchro); | |
| 828 } | |
| 2 | 829 cyg_thread_delete(mutex_test_thread_handle); |
| 830 show_times(mutex_ft, nmutexes, "Unlock/Lock mutex"); | |
| 0 | 831 } |
| 832 | |
| 833 void | |
| 834 run_mbox_tests(void) | |
| 835 { | |
| 836 int i, cnt; | |
| 837 void *item; | |
| 838 // Mailbox primitives | |
| 839 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 840 for (i = 0; i < nmboxes; i++) { |
| 0 | 841 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 842 cyg_mbox_create(&test_mbox_handles[i], &test_mboxes[i]); | |
| 843 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 844 } | |
| 2 | 845 show_times(mbox_ft, nmboxes, "Create mbox"); |
| 0 | 846 |
| 847 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 848 for (i = 0; i < nmboxes; i++) { |
| 0 | 849 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 850 cnt = cyg_mbox_peek(test_mbox_handles[i]); | |
| 851 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 852 } | |
| 2 | 853 show_times(mbox_ft, nmboxes, "Peek [empty] mbox"); |
| 0 | 854 |
| 2 | 855 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT |
| 0 | 856 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
| 2 | 857 for (i = 0; i < nmboxes; i++) { |
| 0 | 858 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 859 cyg_mbox_put(test_mbox_handles[i], (void *)i); | |
| 860 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 861 } | |
| 2 | 862 show_times(mbox_ft, nmboxes, "Put [first] mbox"); |
| 0 | 863 |
| 864 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 865 for (i = 0; i < nmboxes; i++) { |
| 0 | 866 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 867 cnt = cyg_mbox_peek(test_mbox_handles[i]); | |
| 868 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 869 } | |
| 2 | 870 show_times(mbox_ft, nmboxes, "Peek [1 msg] mbox"); |
| 0 | 871 |
| 872 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 873 for (i = 0; i < nmboxes; i++) { |
| 874 HAL_CLOCK_READ(&mbox_ft[i].start); | |
| 875 cyg_mbox_put(test_mbox_handles[i], (void *)i); | |
| 876 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 877 } | |
| 878 show_times(mbox_ft, nmboxes, "Put [second] mbox"); | |
| 879 | |
| 880 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 881 for (i = 0; i < nmboxes; i++) { | |
| 882 HAL_CLOCK_READ(&mbox_ft[i].start); | |
| 883 cnt = cyg_mbox_peek(test_mbox_handles[i]); | |
| 884 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 885 } | |
| 886 show_times(mbox_ft, nmboxes, "Peek [2 msgs] mbox"); | |
| 887 | |
| 888 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 889 for (i = 0; i < nmboxes; i++) { | |
| 0 | 890 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 891 item = cyg_mbox_get(test_mbox_handles[i]); | |
| 892 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 893 } | |
| 2 | 894 show_times(mbox_ft, nmboxes, "Get [first] mbox"); |
| 0 | 895 |
| 896 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 897 for (i = 0; i < nmboxes; i++) { |
| 0 | 898 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 899 item = cyg_mbox_get(test_mbox_handles[i]); | |
| 900 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 901 } | |
| 2 | 902 show_times(mbox_ft, nmboxes, "Get [second] mbox"); |
| 903 #endif // ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT | |
| 0 | 904 |
| 905 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 906 for (i = 0; i < nmboxes; i++) { |
| 0 | 907 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 908 cyg_mbox_tryput(test_mbox_handles[i], (void *)i); | |
| 909 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 910 } | |
| 2 | 911 show_times(mbox_ft, nmboxes, "Tryput [first] mbox"); |
| 0 | 912 |
| 913 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 914 for (i = 0; i < nmboxes; i++) { |
| 0 | 915 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 916 item = cyg_mbox_peek_item(test_mbox_handles[i]); | |
| 917 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 918 } | |
| 2 | 919 show_times(mbox_ft, nmboxes, "Peek item [non-empty] mbox"); |
| 0 | 920 |
| 921 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 922 for (i = 0; i < nmboxes; i++) { |
| 0 | 923 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 924 item = cyg_mbox_tryget(test_mbox_handles[i]); | |
| 925 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 926 } | |
| 2 | 927 show_times(mbox_ft, nmboxes, "Tryget [non-empty] mbox"); |
| 0 | 928 |
| 929 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 930 for (i = 0; i < nmboxes; i++) { |
| 0 | 931 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 932 item = cyg_mbox_peek_item(test_mbox_handles[i]); | |
| 933 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 934 } | |
| 2 | 935 show_times(mbox_ft, nmboxes, "Peek item [empty] mbox"); |
| 0 | 936 |
| 937 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 938 for (i = 0; i < nmboxes; i++) { |
| 0 | 939 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 940 item = cyg_mbox_tryget(test_mbox_handles[i]); | |
| 941 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 942 } | |
| 2 | 943 show_times(mbox_ft, nmboxes, "Tryget [empty] mbox"); |
| 0 | 944 |
| 945 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 946 for (i = 0; i < nmboxes; i++) { |
| 0 | 947 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 948 cyg_mbox_waiting_to_get(test_mbox_handles[i]); | |
| 949 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 950 } | |
| 2 | 951 show_times(mbox_ft, nmboxes, "Waiting to get mbox"); |
| 0 | 952 |
| 953 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 954 for (i = 0; i < nmboxes; i++) { |
| 0 | 955 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 956 cyg_mbox_waiting_to_put(test_mbox_handles[i]); | |
| 957 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 958 } | |
| 2 | 959 show_times(mbox_ft, nmboxes, "Waiting to put mbox"); |
| 0 | 960 |
| 961 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 962 for (i = 0; i < nmboxes; i++) { |
| 0 | 963 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 964 cyg_mbox_delete(test_mbox_handles[i]); | |
| 965 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 966 } | |
| 2 | 967 show_times(mbox_ft, nmboxes, "Delete mbox"); |
| 0 | 968 |
| 969 run_mbox_circuit_test(); | |
| 2 | 970 end_of_test_group(); |
| 0 | 971 } |
| 972 | |
| 973 void | |
| 974 run_mbox_circuit_test(void) | |
| 975 { | |
| 2 | 976 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT |
| 0 | 977 int i; |
| 978 // Set my priority lower than any I plan to create | |
| 979 cyg_thread_set_priority(cyg_thread_self(), 3); | |
| 980 // Set up for full mbox put/get test | |
| 981 cyg_mbox_create(&test_mbox_handles[0], &test_mboxes[0]); | |
| 982 cyg_semaphore_init(&synchro, 0); | |
| 983 cyg_thread_create(2, // Priority - just a number | |
| 984 mbox_test, // entry | |
| 985 0, // index | |
| 986 thread_name("thread", 0), // Name | |
| 987 &stacks[0][0], // Stack | |
| 988 STACK_SIZE, // Size | |
| 989 &mbox_test_thread_handle, // Handle | |
| 990 &mbox_test_thread // Thread data structure | |
| 991 ); | |
| 992 cyg_thread_resume(mbox_test_thread_handle); | |
| 2 | 993 for (i = 0; i < nmboxes; i++) { |
| 0 | 994 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
| 995 HAL_CLOCK_READ(&mbox_ft[i].start); | |
| 996 cyg_mbox_put(test_mbox_handles[0], (void *)i); | |
| 997 cyg_semaphore_wait(&synchro); | |
| 998 } | |
| 2 | 999 cyg_thread_delete(mbox_test_thread_handle); |
| 1000 show_times(mbox_ft, nmboxes, "Put/Get mbox"); | |
| 1001 #endif | |
| 0 | 1002 } |
| 1003 | |
| 1004 void | |
| 1005 run_semaphore_tests(void) | |
| 1006 { | |
| 1007 int i; | |
| 2 | 1008 cyg_count32 sem_val; |
| 0 | 1009 // Semaphore primitives |
| 1010 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1011 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1012 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1013 cyg_semaphore_init(&test_semaphores[i], 0); | |
| 1014 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1015 } | |
| 2 | 1016 show_times(semaphore_ft, nsemaphores, "Init semaphore"); |
| 0 | 1017 |
| 1018 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1019 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1020 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1021 cyg_semaphore_post(&test_semaphores[i]); | |
| 1022 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1023 } | |
| 2 | 1024 show_times(semaphore_ft, nsemaphores, "Post [0] semaphore"); |
| 0 | 1025 |
| 1026 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1027 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1028 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1029 cyg_semaphore_wait(&test_semaphores[i]); | |
| 1030 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1031 } | |
| 2 | 1032 show_times(semaphore_ft, nsemaphores, "Wait [1] semaphore"); |
| 0 | 1033 |
| 1034 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1035 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1036 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1037 cyg_semaphore_trywait(&test_semaphores[i]); | |
| 1038 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1039 } | |
| 2 | 1040 show_times(semaphore_ft, nsemaphores, "Trywait [0] semaphore"); |
| 0 | 1041 |
| 1042 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1043 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1044 cyg_semaphore_post(&test_semaphores[i]); |
| 1045 HAL_CLOCK_READ(&semaphore_ft[i].start); | |
| 1046 cyg_semaphore_trywait(&test_semaphores[i]); | |
| 1047 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1048 } | |
| 2 | 1049 show_times(semaphore_ft, nsemaphores, "Trywait [1] semaphore"); |
| 0 | 1050 |
| 1051 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1052 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1053 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1054 cyg_semaphore_peek(&test_semaphores[i], &sem_val); | |
| 1055 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1056 } | |
| 2 | 1057 show_times(semaphore_ft, nsemaphores, "Peek semaphore"); |
| 0 | 1058 |
| 1059 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1060 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1061 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1062 cyg_semaphore_destroy(&test_semaphores[i]); | |
| 1063 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1064 } | |
| 2 | 1065 show_times(semaphore_ft, nsemaphores, "Destroy semaphore"); |
| 0 | 1066 |
| 1067 run_semaphore_circuit_test(); | |
| 2 | 1068 end_of_test_group(); |
| 0 | 1069 } |
| 1070 | |
| 1071 void | |
| 1072 run_semaphore_circuit_test(void) | |
| 1073 { | |
| 1074 int i; | |
| 1075 // Set my priority lower than any I plan to create | |
| 1076 cyg_thread_set_priority(cyg_thread_self(), 3); | |
| 1077 // Set up for full semaphore post/wait test | |
| 1078 cyg_semaphore_init(&test_semaphores[0], 0); | |
| 1079 cyg_semaphore_init(&synchro, 0); | |
| 1080 cyg_thread_create(2, // Priority - just a number | |
| 1081 semaphore_test, // entry | |
| 1082 0, // index | |
| 1083 thread_name("thread", 0), // Name | |
| 1084 &stacks[0][0], // Stack | |
| 1085 STACK_SIZE, // Size | |
| 1086 &semaphore_test_thread_handle, // Handle | |
| 1087 &semaphore_test_thread // Thread data structure | |
| 1088 ); | |
| 1089 cyg_thread_resume(semaphore_test_thread_handle); | |
| 2 | 1090 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1091 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
| 1092 HAL_CLOCK_READ(&semaphore_ft[i].start); | |
| 1093 cyg_semaphore_post(&test_semaphores[0]); | |
| 1094 cyg_semaphore_wait(&synchro); | |
| 1095 } | |
| 2 | 1096 cyg_thread_delete(semaphore_test_thread_handle); |
| 1097 show_times(semaphore_ft, nsemaphores, "Post/Wait semaphore"); | |
| 0 | 1098 } |
| 1099 | |
| 1100 void | |
| 1101 run_counter_tests(void) | |
| 1102 { | |
| 1103 int i; | |
| 2 | 1104 cyg_tick_count_t val=0; |
| 0 | 1105 |
| 1106 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1107 for (i = 0; i < ncounters; i++) { |
| 0 | 1108 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1109 cyg_counter_create(&counters[i], &test_counters[i]); | |
| 1110 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1111 } | |
| 2 | 1112 show_times(counter_ft, ncounters, "Create counter"); |
| 0 | 1113 |
| 1114 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1115 for (i = 0; i < ncounters; i++) { |
| 0 | 1116 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1117 val = cyg_counter_current_value(counters[i]); | |
| 1118 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1119 } | |
| 2 | 1120 show_times(counter_ft, ncounters, "Get counter value"); |
| 0 | 1121 |
| 1122 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1123 for (i = 0; i < ncounters; i++) { |
| 0 | 1124 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1125 cyg_counter_set_value(counters[i], val); | |
| 1126 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1127 } | |
| 2 | 1128 show_times(counter_ft, ncounters, "Set counter value"); |
| 0 | 1129 |
| 1130 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1131 for (i = 0; i < ncounters; i++) { |
| 0 | 1132 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1133 cyg_counter_tick(counters[i]); | |
| 1134 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1135 } | |
| 2 | 1136 show_times(counter_ft, ncounters, "Tick counter"); |
| 0 | 1137 |
| 1138 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1139 for (i = 0; i < ncounters; i++) { |
| 0 | 1140 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1141 cyg_counter_delete(counters[i]); | |
| 1142 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1143 } | |
| 2 | 1144 show_times(counter_ft, ncounters, "Delete counter"); |
| 1145 end_of_test_group(); | |
| 0 | 1146 } |
| 1147 | |
| 1148 // Alarm callback function | |
| 1149 void | |
| 1150 alarm_cb(cyg_handle_t alarm, cyg_addrword_t val) | |
| 1151 { | |
| 1152 // empty call back | |
| 1153 } | |
| 1154 | |
| 1155 // Callback used to test determinancy | |
| 1156 static volatile int alarm_cnt; | |
| 1157 void | |
| 1158 alarm_cb2(cyg_handle_t alarm, cyg_addrword_t indx) | |
| 1159 { | |
| 2 | 1160 if (alarm_cnt == nscheds) return; |
| 0 | 1161 sched_ft[alarm_cnt].start = 0; |
| 1162 HAL_CLOCK_READ(&sched_ft[alarm_cnt++].end); | |
| 2 | 1163 if (alarm_cnt == nscheds) { |
| 0 | 1164 cyg_semaphore_post(&synchro); |
| 1165 } | |
| 1166 } | |
| 1167 | |
|
60
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1168 static void |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1169 alarm_cb3(cyg_handle_t alarm, cyg_addrword_t indx) |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1170 { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1171 if (alarm_cnt == nscheds) { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1172 cyg_semaphore_post(&synchro); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1173 } else { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1174 sched_ft[alarm_cnt].start = 0; |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1175 cyg_thread_resume((cyg_handle_t)indx); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1176 } |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1177 } |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1178 |
| 0 | 1179 // Null thread, used to keep scheduler busy |
| 1180 void | |
| 1181 alarm_test(cyg_uint32 id) | |
| 1182 { | |
| 1183 while (true) { | |
| 1184 cyg_thread_yield(); | |
| 1185 } | |
| 1186 } | |
| 1187 | |
|
60
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1188 // Thread that suspends itself at the first opportunity |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1189 void |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1190 alarm_test2(cyg_uint32 id) |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1191 { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1192 cyg_handle_t me = cyg_thread_self(); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1193 while (true) { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1194 HAL_CLOCK_READ(&sched_ft[alarm_cnt++].end); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1195 cyg_thread_suspend(me); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1196 } |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1197 } |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1198 |
| 0 | 1199 void |
| 1200 run_alarm_tests(void) | |
| 1201 { | |
| 1202 int i; | |
| 1203 cyg_tick_count_t init_val, step_val; | |
| 1204 cyg_handle_t rtc_handle; | |
| 1205 | |
| 1206 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1207 for (i = 0; i < ncounters; i++) { |
| 0 | 1208 cyg_counter_create(&counters[i], &test_counters[i]); |
| 1209 } | |
| 2 | 1210 for (i = 0; i < nalarms; i++) { |
| 0 | 1211 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1212 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[i], &test_alarms[i]); | |
| 1213 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1214 } | |
| 2 | 1215 show_times(alarm_ft, nalarms, "Create alarm"); |
| 0 | 1216 |
| 1217 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1218 init_val = 0; step_val = 0; | |
| 2 | 1219 for (i = 0; i < nalarms; i++) { |
| 0 | 1220 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1221 cyg_alarm_initialize(alarms[i], init_val, step_val); | |
| 1222 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1223 } | |
| 2 | 1224 show_times(alarm_ft, nalarms, "Initialize alarm"); |
| 0 | 1225 |
| 1226 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1227 init_val = 0; step_val = 0; | |
| 2 | 1228 for (i = 0; i < nalarms; i++) { |
| 0 | 1229 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1230 cyg_alarm_disable(alarms[i]); | |
| 1231 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1232 } | |
| 2 | 1233 show_times(alarm_ft, nalarms, "Disable alarm"); |
| 0 | 1234 |
| 1235 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1236 init_val = 0; step_val = 0; | |
| 2 | 1237 for (i = 0; i < nalarms; i++) { |
| 0 | 1238 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1239 cyg_alarm_enable(alarms[i]); | |
| 1240 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1241 } | |
| 2 | 1242 show_times(alarm_ft, nalarms, "Enable alarm"); |
| 0 | 1243 |
| 1244 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1245 for (i = 0; i < nalarms; i++) { |
| 0 | 1246 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1247 cyg_alarm_delete(alarms[i]); | |
| 1248 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1249 } | |
| 2 | 1250 show_times(alarm_ft, nalarms, "Delete alarm"); |
| 0 | 1251 |
| 1252 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1253 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 1254 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[0], &test_alarms[0]); | |
| 1255 init_val = 9999; step_val = 9999; | |
| 1256 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1257 cyg_alarm_enable(alarms[0]); | |
| 2 | 1258 for (i = 0; i < ncounters; i++) { |
| 0 | 1259 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1260 cyg_counter_tick(counters[0]); | |
| 1261 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1262 } | |
| 2 | 1263 show_times(counter_ft, ncounters, "Tick counter [1 alarm]"); |
| 0 | 1264 |
| 1265 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1266 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 2 | 1267 for (i = 0; i < nalarms; i++) { |
| 0 | 1268 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[i], &test_alarms[i]); |
| 1269 init_val = 9999; step_val = 9999; | |
| 1270 cyg_alarm_initialize(alarms[i], init_val, step_val); | |
| 1271 cyg_alarm_enable(alarms[i]); | |
| 1272 } | |
| 2 | 1273 for (i = 0; i < ncounters; i++) { |
| 0 | 1274 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1275 cyg_counter_tick(counters[0]); | |
| 1276 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1277 } | |
| 2 | 1278 show_times(counter_ft, ncounters, "Tick counter [many alarms]"); |
| 0 | 1279 |
| 1280 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1281 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 1282 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[0], &test_alarms[0]); | |
| 1283 init_val = 1; step_val = 1; | |
| 1284 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1285 cyg_alarm_enable(alarms[0]); | |
| 2 | 1286 for (i = 0; i < ncounters; i++) { |
| 0 | 1287 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1288 cyg_counter_tick(counters[0]); | |
| 1289 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1290 } | |
| 2 | 1291 show_times(counter_ft, ncounters, "Tick & fire counter [1 alarm]"); |
| 0 | 1292 |
| 1293 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1294 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 2 | 1295 for (i = 0; i < nalarms; i++) { |
| 0 | 1296 cyg_alarm_create(counters[0], alarm_cb, i, &alarms[i], &test_alarms[i]); |
| 1297 init_val = 1; step_val = 1; | |
| 1298 cyg_alarm_initialize(alarms[i], init_val, step_val); | |
| 1299 cyg_alarm_enable(alarms[i]); | |
| 1300 } | |
| 2 | 1301 for (i = 0; i < nalarms; i++) { |
| 1302 HAL_CLOCK_READ(&alarm_ft[i].start); | |
| 0 | 1303 cyg_counter_tick(counters[0]); |
| 2 | 1304 HAL_CLOCK_READ(&alarm_ft[i].end); |
| 0 | 1305 } |
| 2 | 1306 for (i = 0; i < nalarms; i++) { |
| 0 | 1307 cyg_alarm_delete(alarms[i]); |
| 1308 } | |
| 2 | 1309 show_times(alarm_ft, nalarms, "Tick & fire counters [>1 together]"); |
| 1310 | |
| 1311 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1312 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 1313 for (i = 0; i < nalarms; i++) { | |
| 1314 cyg_alarm_create(counters[0], alarm_cb, i, &alarms[i], &test_alarms[i]); | |
| 1315 init_val = i+1; step_val = nalarms+1; | |
| 1316 cyg_alarm_initialize(alarms[i], init_val, step_val); | |
| 1317 cyg_alarm_enable(alarms[i]); | |
| 1318 } | |
| 1319 for (i = 0; i < nalarms; i++) { | |
| 1320 HAL_CLOCK_READ(&alarm_ft[i].start); | |
| 1321 cyg_counter_tick(counters[0]); | |
| 1322 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1323 } | |
| 1324 for (i = 0; i < nalarms; i++) { | |
| 1325 cyg_alarm_delete(alarms[i]); | |
| 1326 } | |
| 1327 show_times(alarm_ft, nalarms, "Tick & fire counters [>1 separately]"); | |
| 0 | 1328 |
| 1329 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1330 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle); | |
| 1331 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]); | |
| 1332 init_val = 5; step_val = 5; alarm_cnt = 0; | |
| 1333 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1334 cyg_semaphore_init(&synchro, 0); | |
| 1335 cyg_alarm_enable(alarms[0]); | |
| 1336 cyg_semaphore_wait(&synchro); | |
| 1337 cyg_alarm_disable(alarms[0]); | |
| 1338 cyg_alarm_delete(alarms[0]); | |
| 2 | 1339 show_times(sched_ft, nscheds, "Alarm latency [0 threads]"); |
| 0 | 1340 |
| 1341 // Set my priority higher than any I plan to create | |
| 1342 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 1343 for (i = 0; i < 2; i++) { | |
| 1344 cyg_thread_create(10, // Priority - just a number | |
| 1345 alarm_test, // entry | |
| 1346 i, // index | |
| 1347 thread_name("thread", i), // Name | |
| 1348 &stacks[i][0], // Stack | |
| 1349 STACK_SIZE, // Size | |
| 1350 &threads[i], // Handle | |
| 1351 &test_threads[i] // Thread data structure | |
| 1352 ); | |
| 1353 cyg_thread_resume(threads[i]); | |
| 1354 } | |
| 1355 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1356 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle); | |
| 1357 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]); | |
| 1358 init_val = 5; step_val = 5; alarm_cnt = 0; | |
| 1359 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1360 cyg_semaphore_init(&synchro, 0); | |
| 1361 cyg_alarm_enable(alarms[0]); | |
| 1362 cyg_semaphore_wait(&synchro); | |
| 1363 cyg_alarm_disable(alarms[0]); | |
| 1364 cyg_alarm_delete(alarms[0]); | |
| 2 | 1365 show_times(sched_ft, nscheds, "Alarm latency [2 threads]"); |
| 0 | 1366 for (i = 0; i < 2; i++) { |
| 1367 cyg_thread_suspend(threads[i]); | |
| 2 | 1368 cyg_thread_delete(threads[i]); |
| 0 | 1369 } |
| 1370 | |
| 1371 // Set my priority higher than any I plan to create | |
| 1372 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 2 | 1373 for (i = 0; i < ntest_threads; i++) { |
| 0 | 1374 cyg_thread_create(10, // Priority - just a number |
| 1375 alarm_test, // entry | |
| 1376 i, // index | |
| 1377 thread_name("thread", i), // Name | |
| 1378 &stacks[i][0], // Stack | |
| 1379 STACK_SIZE, // Size | |
| 1380 &threads[i], // Handle | |
| 1381 &test_threads[i] // Thread data structure | |
| 1382 ); | |
| 1383 cyg_thread_resume(threads[i]); | |
| 1384 } | |
| 1385 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1386 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle); | |
| 1387 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]); | |
| 1388 init_val = 5; step_val = 5; alarm_cnt = 0; | |
| 1389 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1390 cyg_semaphore_init(&synchro, 0); | |
| 1391 cyg_alarm_enable(alarms[0]); | |
| 1392 cyg_semaphore_wait(&synchro); | |
| 1393 cyg_alarm_disable(alarms[0]); | |
| 1394 cyg_alarm_delete(alarms[0]); | |
| 2 | 1395 show_times(sched_ft, nscheds, "Alarm latency [many threads]"); |
| 1396 for (i = 0; i < ntest_threads; i++) { | |
| 0 | 1397 cyg_thread_suspend(threads[i]); |
| 2 | 1398 cyg_thread_delete(threads[i]); |
| 0 | 1399 } |
|
60
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1400 |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1401 // Set my priority higher than any I plan to create |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1402 cyg_thread_set_priority(cyg_thread_self(), 2); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1403 cyg_thread_create(10, // Priority - just a number |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1404 alarm_test2, // entry |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1405 i, // index |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1406 thread_name("thread", 0), // Name |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1407 &stacks[0][0], // Stack |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1408 STACK_SIZE, // Size |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1409 &threads[0], // Handle |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1410 &test_threads[0] // Thread data structure |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1411 ); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1412 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1413 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1414 cyg_alarm_create(rtc_handle, alarm_cb3, threads[0], &alarms[0], |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1415 &test_alarms[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1416 init_val = 5; step_val = 5; alarm_cnt = 0; |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1417 cyg_alarm_initialize(alarms[0], init_val, step_val); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1418 cyg_semaphore_init(&synchro, 0); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1419 cyg_alarm_enable(alarms[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1420 cyg_semaphore_wait(&synchro); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1421 cyg_alarm_disable(alarms[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1422 cyg_alarm_delete(alarms[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1423 show_times(sched_ft, nscheds, "Alarm -> thread resume latency"); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1424 cyg_thread_suspend(threads[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1425 cyg_thread_delete(threads[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1426 |
| 2 | 1427 end_of_test_group(); |
| 0 | 1428 } |
| 1429 | |
| 1430 void | |
| 1431 run_sched_tests(void) | |
| 1432 { | |
| 1433 int i; | |
| 1434 | |
| 1435 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1436 for (i = 0; i < nscheds; i++) { |
| 0 | 1437 HAL_CLOCK_READ(&sched_ft[i].start); |
| 1438 cyg_scheduler_lock(); | |
| 1439 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1440 cyg_scheduler_unlock(); | |
| 1441 } | |
| 2 | 1442 show_times(sched_ft, nscheds, "Scheduler lock"); |
| 0 | 1443 |
| 1444 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1445 for (i = 0; i < nscheds; i++) { |
| 0 | 1446 cyg_scheduler_lock(); |
| 1447 HAL_CLOCK_READ(&sched_ft[i].start); | |
| 1448 cyg_scheduler_unlock(); | |
| 1449 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1450 } | |
| 2 | 1451 show_times(sched_ft, nscheds, "Scheduler unlock [0 threads]"); |
| 0 | 1452 |
| 1453 // Set my priority higher than any I plan to create | |
| 1454 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 1455 for (i = 0; i < 1; i++) { | |
| 1456 cyg_thread_create(10, // Priority - just a number | |
| 1457 test0, // entry | |
| 1458 i, // index | |
| 1459 thread_name("thread", i), // Name | |
| 1460 &stacks[i][0], // Stack | |
| 1461 STACK_SIZE, // Size | |
| 1462 &threads[i], // Handle | |
| 1463 &test_threads[i] // Thread data structure | |
| 1464 ); | |
| 1465 } | |
| 1466 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1467 for (i = 0; i < nscheds; i++) { |
| 0 | 1468 cyg_scheduler_lock(); |
| 1469 HAL_CLOCK_READ(&sched_ft[i].start); | |
| 1470 cyg_scheduler_unlock(); | |
| 1471 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1472 } | |
| 2 | 1473 show_times(sched_ft, nscheds, "Scheduler unlock [1 suspended]"); |
| 0 | 1474 for (i = 0; i < 1; i++) { |
| 2 | 1475 cyg_thread_delete(threads[i]); |
| 0 | 1476 } |
| 1477 | |
| 1478 // Set my priority higher than any I plan to create | |
| 1479 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 2 | 1480 for (i = 0; i < ntest_threads; i++) { |
| 0 | 1481 cyg_thread_create(10, // Priority - just a number |
| 1482 test0, // entry | |
| 1483 i, // index | |
| 1484 thread_name("thread", i), // Name | |
| 1485 &stacks[i][0], // Stack | |
| 1486 STACK_SIZE, // Size | |
| 1487 &threads[i], // Handle | |
| 1488 &test_threads[i] // Thread data structure | |
| 1489 ); | |
| 1490 } | |
| 1491 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1492 for (i = 0; i < nscheds; i++) { |
| 0 | 1493 cyg_scheduler_lock(); |
| 1494 HAL_CLOCK_READ(&sched_ft[i].start); | |
| 1495 cyg_scheduler_unlock(); | |
| 1496 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1497 } | |
| 2 | 1498 show_times(sched_ft, nscheds, "Scheduler unlock [many suspended]"); |
| 1499 for (i = 0; i < ntest_threads; i++) { | |
| 1500 cyg_thread_delete(threads[i]); | |
| 0 | 1501 } |
| 1502 | |
| 1503 // Set my priority higher than any I plan to create | |
| 1504 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 2 | 1505 for (i = 0; i < ntest_threads; i++) { |
| 0 | 1506 cyg_thread_create(10, // Priority - just a number |
| 1507 test0, // entry | |
| 1508 i, // index | |
| 1509 thread_name("thread", i), // Name | |
| 1510 &stacks[i][0], // Stack | |
| 1511 STACK_SIZE, // Size | |
| 1512 &threads[i], // Handle | |
| 1513 &test_threads[i] // Thread data structure | |
| 1514 ); | |
| 1515 cyg_thread_resume(threads[i]); | |
| 1516 } | |
| 1517 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1518 for (i = 0; i < nscheds; i++) { |
| 0 | 1519 cyg_scheduler_lock(); |
| 1520 HAL_CLOCK_READ(&sched_ft[i].start); | |
| 1521 cyg_scheduler_unlock(); | |
| 1522 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1523 } | |
| 2 | 1524 show_times(sched_ft, nscheds, "Scheduler unlock [many low prio]"); |
| 1525 for (i = 0; i < ntest_threads; i++) { | |
| 1526 cyg_thread_delete(threads[i]); | |
| 0 | 1527 } |
| 2 | 1528 end_of_test_group(); |
| 0 | 1529 } |
| 1530 | |
| 1531 void | |
| 1532 run_all_tests(CYG_ADDRESS id) | |
| 1533 { | |
| 2 | 1534 int i, j; |
| 1535 cyg_uint32 tv[nsamples], tv0, tv1; | |
| 1536 cyg_uint32 min_stack, max_stack, total_stack, actual_stack; | |
| 1537 cyg_tick_count_t ticks, tick0, tick1; | |
| 0 | 1538 #ifdef CYG_SCHEDULER_LOCK_TIMINGS |
| 1539 cyg_uint32 lock_ave, lock_max; | |
| 1540 #endif | |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1541 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 0 | 1542 cyg_int32 clock_ave; |
| 1543 #endif | |
| 1544 | |
| 2 | 1545 disable_clock_latency_measurement(); |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1546 |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1547 #ifndef CYGPKG_KERNEL_SMP_SUPPORT |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1548 cyg_test_dump_thread_stack_stats( "Startup, main stack", thread[0] ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1549 cyg_test_dump_interrupt_stack_stats( "Startup" ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1550 cyg_test_dump_idlethread_stack_stats( "Startup" ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1551 cyg_test_clear_interrupt_stack(); |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1552 #endif |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1553 |
| 2 | 1554 diag_printf("\neCos Kernel Timings\n"); |
| 1555 diag_printf("Notes: all times are in microseconds (.000001) unless otherwise stated\n"); | |
| 1556 #ifdef STATS_WITHOUT_FIRST_SAMPLE | |
| 1557 diag_printf(" second line of results have first sample removed\n"); | |
| 1558 #endif | |
| 1559 | |
| 1560 cyg_thread_delay(2); // Make sure the clock is actually running | |
| 1561 | |
| 1562 ns_per_system_clock = 1000000/rtc_resolution[1]; | |
| 1563 | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1564 wait_for_tick(); |
| 2 | 1565 for (i = 0; i < nsamples; i++) { |
| 0 | 1566 HAL_CLOCK_READ(&tv[i]); |
| 1567 } | |
| 1568 tv0 = 0; | |
| 2 | 1569 for (i = 1; i < nsamples; i++) { |
| 1570 tv0 += tv[i] - tv[i-1]; | |
| 0 | 1571 } |
| 2 | 1572 end_of_test_group(); |
| 0 | 1573 |
| 2 | 1574 overhead = tv0 / (nsamples-1); |
| 1575 diag_printf("Reading the hardware clock takes %d 'ticks' overhead\n", overhead); | |
| 1576 diag_printf("... this value will be factored out of all other measurements\n"); | |
| 0 | 1577 |
| 1578 // Try and measure how long the clock interrupt handling takes | |
| 2 | 1579 for (i = 0; i < nsamples; i++) { |
| 1580 tick0 = cyg_current_time(); | |
| 1581 while (true) { | |
| 1582 tick1 = cyg_current_time(); | |
| 1583 if (tick0 != tick1) break; | |
| 1584 } | |
| 1585 HAL_CLOCK_READ(&tv[i]); | |
| 0 | 1586 } |
| 2 | 1587 tv1 = 0; |
| 1588 for (i = 0; i < nsamples; i++) { | |
| 1589 tv1 += tv[i] * 1000; | |
| 1590 } | |
| 1591 tv1 = tv1 / nsamples; | |
| 0 | 1592 tv1 -= overhead; // Adjust out the cost of getting the timer value |
| 2 | 1593 diag_printf("Clock interrupt took"); |
| 1594 show_ticks_in_us(tv1); | |
| 1595 diag_printf(" microseconds (%d raw clock ticks)\n", tv1/1000); | |
| 1596 enable_clock_latency_measurement(); | |
| 0 | 1597 |
| 1598 ticks = cyg_current_time(); | |
| 1599 | |
| 1600 show_test_parameters(); | |
| 1601 show_times_hdr(); | |
| 1602 | |
| 2 | 1603 reset_clock_latency_measurement(); |
| 1604 | |
| 0 | 1605 run_thread_tests(); |
| 1606 run_sched_tests(); | |
| 1607 run_mutex_tests(); | |
| 1608 run_mbox_tests(); | |
| 1609 run_semaphore_tests(); | |
| 1610 run_counter_tests(); | |
| 1611 run_alarm_tests(); | |
| 1612 | |
| 1613 #ifdef CYG_SCHEDULER_LOCK_TIMINGS | |
| 1614 Cyg_Scheduler::get_lock_times(&lock_ave, &lock_max); | |
| 2 | 1615 diag_printf("\nMax lock:"); |
| 1616 show_ticks_in_us(lock_max); | |
| 1617 diag_printf(", Ave lock:"); | |
| 1618 show_ticks_in_us(lock_ave); | |
| 1619 diag_printf("\n"); | |
| 0 | 1620 #endif |
| 1621 | |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1622 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 2 | 1623 // Display latency figures in same format as all other numbers |
| 1624 disable_clock_latency_measurement(); | |
| 1625 clock_ave = (total_clock_latency*1000) / total_clock_interrupts; | |
| 1626 show_ticks_in_us(clock_ave); | |
| 1627 show_ticks_in_us(min_clock_latency*1000); | |
| 1628 show_ticks_in_us(max_clock_latency*1000); | |
| 1629 show_ticks_in_us(0); | |
| 1630 diag_printf(" Clock/interrupt latency\n\n"); | |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1631 enable_clock_latency_measurement(); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1632 #endif |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1633 |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
1634 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY) |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1635 disable_clock_latency_measurement(); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1636 clock_ave = (total_clock_dsr_latency*1000) / total_clock_dsr_calls; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1637 show_ticks_in_us(clock_ave); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1638 show_ticks_in_us(min_clock_dsr_latency*1000); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1639 show_ticks_in_us(max_clock_dsr_latency*1000); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1640 show_ticks_in_us(0); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1641 diag_printf(" Clock DSR latency\n\n"); |
| 2 | 1642 enable_clock_latency_measurement(); |
| 0 | 1643 #endif |
| 1644 | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1645 #ifndef CYGPKG_KERNEL_SMP_SUPPORT |
| 2 | 1646 disable_clock_latency_measurement(); |
| 1647 min_stack = STACK_SIZE; | |
| 1648 max_stack = 0; | |
| 1649 total_stack = 0; | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1650 for (i = 0; i < (int)NTEST_THREADS; i++) { |
| 2 | 1651 for (j = 0; j < STACK_SIZE; j++) { |
| 1652 if (stacks[i][j]) break; | |
| 1653 } | |
| 1654 actual_stack = STACK_SIZE-j; | |
| 1655 if (actual_stack < min_stack) min_stack = actual_stack; | |
| 1656 if (actual_stack > max_stack) max_stack = actual_stack; | |
| 1657 total_stack += actual_stack; | |
| 1658 } | |
| 1659 for (j = 0; j < STACKSIZE; j++) { | |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1660 if (((char *)stack[0])[j]) break; |
| 2 | 1661 } |
| 1662 diag_printf("%5d %5d %5d (main stack: %5d) Thread stack used (%d total)\n", | |
| 1663 total_stack/NTEST_THREADS, min_stack, max_stack, | |
| 1664 STACKSIZE - j, STACK_SIZE); | |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1665 |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1666 cyg_test_dump_thread_stack_stats( "All done, main stack", thread[0] ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1667 cyg_test_dump_interrupt_stack_stats( "All done" ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1668 cyg_test_dump_idlethread_stack_stats( "All done" ); |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1669 #endif |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1670 |
| 2 | 1671 enable_clock_latency_measurement(); |
| 1672 | |
| 0 | 1673 ticks = cyg_current_time(); |
| 2 | 1674 diag_printf("\nTiming complete - %d ms total\n\n", (int)((ticks*ns_per_system_clock)/1000)); |
| 0 | 1675 |
| 1676 CYG_TEST_PASS_FINISH("Basic timing OK"); | |
| 1677 } | |
| 1678 | |
| 1679 void tm_basic_main( void ) | |
| 1680 { | |
| 1681 CYG_TEST_INIT(); | |
| 1682 | |
| 2 | 1683 if (cyg_test_is_simulator) { |
| 1684 nsamples = NSAMPLES_SIM; | |
| 1685 ntest_threads = NTEST_THREADS_SIM; | |
| 1686 nthread_switches = NTHREAD_SWITCHES_SIM; | |
| 1687 nmutexes = NMUTEXES_SIM; | |
| 1688 nmboxes = NMBOXES_SIM; | |
| 1689 nsemaphores = NSEMAPHORES_SIM; | |
| 1690 nscheds = NSCHEDS_SIM; | |
| 1691 ncounters = NCOUNTERS_SIM; | |
| 1692 nalarms = NALARMS_SIM; | |
| 1693 } else { | |
| 1694 nsamples = NSAMPLES; | |
| 1695 ntest_threads = NTEST_THREADS; | |
| 1696 nthread_switches = NTHREAD_SWITCHES; | |
| 1697 nmutexes = NMUTEXES; | |
| 1698 nmboxes = NMBOXES; | |
| 1699 nsemaphores = NSEMAPHORES; | |
| 1700 nscheds = NSCHEDS; | |
| 1701 ncounters = NCOUNTERS; | |
| 1702 nalarms = NALARMS; | |
| 1703 } | |
| 1704 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1705 // Sanity |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1706 #ifdef WORKHORSE_TEST |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1707 ntest_threads = max(512, ntest_threads); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1708 nmutexes = max(1024, nmutexes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1709 nsemaphores = max(1024, nsemaphores); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1710 nmboxes = max(1024, nmboxes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1711 ncounters = max(1024, ncounters); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1712 nalarms = max(1024, nalarms); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1713 #else |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1714 ntest_threads = max(64, ntest_threads); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1715 nmutexes = max(32, nmutexes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1716 nsemaphores = max(32, nsemaphores); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1717 nmboxes = max(32, nmboxes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1718 ncounters = max(32, ncounters); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1719 nalarms = max(32, nalarms); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1720 #endif |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1721 |
| 0 | 1722 new_thread(run_all_tests, 0); |
| 1723 | |
| 1724 Cyg_Scheduler::scheduler.start(); | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
1725 |
| 0 | 1726 } |
| 1727 | |
|
130
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1728 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1729 externC void |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1730 cyg_hal_invoke_constructors(); |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1731 #endif |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1732 |
| 0 | 1733 externC void |
| 1734 cyg_start( void ) | |
| 1735 { | |
|
130
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1736 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1737 cyg_hal_invoke_constructors(); |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1738 #endif |
| 0 | 1739 tm_basic_main(); |
| 1740 } | |
| 2 | 1741 |
| 1742 #else // CYGFUN_KERNEL_API_C | |
| 1743 | |
| 1744 externC void | |
| 1745 cyg_start( void ) | |
| 1746 { | |
| 1747 CYG_TEST_INIT(); | |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1748 CYG_TEST_NA("Timing tests require:\n" |
|
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1749 "CYGFUN_KERNEL_API_C && \n" |
|
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1750 "CYGSEM_KERNEL_SCHED_MLQUEUE &&\n" |
|
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1751 "CYGVAR_KERNEL_COUNTERS_CLOCK &&\n" |
|
76
435cced73e2f
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents:
66
diff
changeset
|
1752 "!CYGDBG_INFRA_DIAG_USE_DEVICE &&\n" |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1753 "(CYGNUM_KERNEL_SCHED_PRIORITIES > 12)\n"); |
| 2 | 1754 } |
| 1755 #endif // CYGFUN_KERNEL_API_C, etc. | |
| 1756 | |
| 0 | 1757 // EOF tm_basic.cxx |
