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